File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,12 +6,6 @@ import { toast } from "react-toastify";
66import { useRouter } from "next/navigation" ;
77import { useSearchParams } from "next/navigation" ;
88import HCaptcha from "@hcaptcha/react-hcaptcha" ;
9- import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" ;
10- import {
11- faGithub ,
12- faGoogle ,
13- faMicrosoft ,
14- } from "@fortawesome/free-brands-svg-icons" ;
159import Oauth2 from "./Oauth2" ;
1610
1711export default function LoginForm ( ) {
Original file line number Diff line number Diff line change @@ -16,7 +16,6 @@ import Machines from "./widgets/Machines";
1616import Categories from "./widgets/Categories" ;
1717import Dependencies from "./widgets/Dependencies" ;
1818import CodingConsistencyHeatmap from "./widgets/CodingConsistencyHeatmap" ;
19- import NavProfileDropdown from "../common/NavProfileDropdown" ;
2019
2120export interface StatsData {
2221 total_seconds : number ;
@@ -33,17 +32,7 @@ export interface StatsData {
3332 last_fetched_at ?: string ;
3433}
3534
36- interface StatsProps {
37- name ?: string ;
38- email ?: string ;
39- avatar : string | null ;
40- }
41-
42- export default function Stats ( {
43- name = "User" ,
44- email = "user@example.com" ,
45- avatar = null ,
46- } : StatsProps ) {
35+ export default function Stats ( ) {
4736 const toDateKey = ( value : string ) => value . slice ( 0 , 10 ) ;
4837 const parseDateKeyLocal = ( dateKey : string ) => {
4938 const [ y , m , d ] = dateKey . split ( "-" ) . map ( Number ) ;
@@ -120,8 +109,12 @@ export default function Stats({
120109 ) ;
121110
122111 useEffect ( ( ) => {
123- // Always fetch fresh data on first load so refresh reflects live values.
124- void fetchStats ( true ) ;
112+ // Defer to avoid synchronous setState inside effect.
113+ const timeout = window . setTimeout ( ( ) => {
114+ void fetchStats ( true ) ;
115+ } , 0 ) ;
116+
117+ return ( ) => window . clearTimeout ( timeout ) ;
125118 } , [ fetchStats ] ) ;
126119
127120 useEffect ( ( ) => {
Original file line number Diff line number Diff line change @@ -15,14 +15,5 @@ export default async function Dashboard() {
1515 if ( ! profile ?. wakatime_api_key ) {
1616 return < DashboardWithoutKey email = { profile ?. email || user . email ! } /> ;
1717 }
18-
19- const email = profile ?. email || user . email ! ;
20- const name = user ?. user_metadata ?. name || email . split ( "@" ) [ 0 ] ;
21- const prefferedAvatar =
22- user ?. user_metadata ?. avatar_url ||
23- user ?. user_metadata ?. picture ||
24- user ?. user_metadata ?. avatar ||
25- null ;
26-
27- return < Stats name = { name } email = { email } avatar = { prefferedAvatar } /> ;
18+ return < Stats /> ;
2819}
Original file line number Diff line number Diff line change 1- import type { MetadataRoute } from "next" ;
1+ import type { MetadataRoute } from "next/types " ;
22
33export default function sitemap ( ) : MetadataRoute . Sitemap {
44 return [
You can’t perform that action at this time.
0 commit comments