Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit edb3d1e

Browse files
committed
fix: migrate over time changes
1 parent 3f3e201 commit edb3d1e

File tree

12 files changed

+497
-183
lines changed

12 files changed

+497
-183
lines changed

site/src/App.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar";
1414
import { ThemeProvider } from "./contexts/ThemeProvider";
1515
import { AuthProvider } from "./contexts/auth/AuthProvider";
1616
import { router } from "./router";
17+
import { TimeSyncProvider } from "hooks/useTimeSync";
1718

1819
const defaultQueryClient = new QueryClient({
1920
defaultOptions: {
@@ -37,6 +38,8 @@ declare global {
3738
}
3839
}
3940

41+
const initialDatetime = new Date();
42+
4043
export const AppProviders: FC<AppProvidersProps> = ({
4144
children,
4245
queryClient = defaultQueryClient,
@@ -64,15 +67,17 @@ export const AppProviders: FC<AppProvidersProps> = ({
6467

6568
return (
6669
<HelmetProvider>
67-
<QueryClientProvider client={queryClient}>
68-
<AuthProvider>
69-
<ThemeProvider>
70-
{children}
71-
<GlobalSnackbar />
72-
</ThemeProvider>
73-
</AuthProvider>
74-
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
75-
</QueryClientProvider>
70+
<TimeSyncProvider options={{ initialDatetime }}>
71+
<QueryClientProvider client={queryClient}>
72+
<AuthProvider>
73+
<ThemeProvider>
74+
{children}
75+
<GlobalSnackbar />
76+
</ThemeProvider>
77+
</AuthProvider>
78+
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
79+
</QueryClientProvider>
80+
</TimeSyncProvider>
7681
</HelmetProvider>
7782
);
7883
};

site/src/components/SignInLayout/SignInLayout.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import type { Interpolation, Theme } from "@emotion/react";
2+
import { useTimeSync } from "hooks/useTimeSync";
23
import type { FC, PropsWithChildren } from "react";
34

45
export const SignInLayout: FC<PropsWithChildren> = ({ children }) => {
6+
const year = useTimeSync({
7+
maxRefreshIntervalMs: Number.POSITIVE_INFINITY,
8+
select: (date) => date.getFullYear(),
9+
});
10+
511
return (
612
<div css={styles.container}>
713
<div css={styles.content}>
814
<div css={styles.signIn}>{children}</div>
915
<div css={styles.copyright}>
10-
{"\u00a9"} {new Date().getFullYear()} Coder Technologies, Inc.
16+
{"\u00a9"} {year} Coder Technologies, Inc.
1117
</div>
1218
</div>
1319
</div>

site/src/hooks/useTime.ts

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)