diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 6082bdf9e..0cca2cf74 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -13,6 +13,8 @@ import { useApp } from '../stores/app'; config(); +const DEV_BUILD_AGREEMENT_COOLDOWN = 8 * 24 * 60 * 60 * 1000; + interface RootLayoutProps { children: ReactNode; } @@ -29,7 +31,10 @@ export default function RootLayout({ children }: RootLayoutProps) { useEffect(() => { setShowDevBuildAlert( - isDev() && !isLocalhost() && !useApp.getState().bypassDevBuildAlert, + isDev() && + !isLocalhost() && + Date.now() - useApp.getState().devBuildAgreementTime >= + DEV_BUILD_AGREEMENT_COOLDOWN, ); }, []); @@ -68,9 +73,9 @@ export default function RootLayout({ children }: RootLayoutProps) { . Also consider using{' '} - the more stable version + the more stable release version - . + . You will be asked again in 8 days. @@ -78,7 +83,7 @@ export default function RootLayout({ children }: RootLayoutProps) { variant="solid" onClick={() => { setShowDevBuildAlert(false); - useApp.setState({ bypassDevBuildAlert: true }); + useApp.setState({ devBuildAgreementTime: Date.now() }); }} > Continue diff --git a/src/stores/app.ts b/src/stores/app.ts index 9f2bf263c..1c1366937 100644 --- a/src/stores/app.ts +++ b/src/stores/app.ts @@ -2,13 +2,13 @@ import { create } from 'zustand'; import { persist } from 'zustand/middleware'; export interface App { - bypassDevBuildAlert: boolean; + devBuildAgreementTime: number; } export const useApp = create()( persist( (set) => ({ - bypassDevBuildAlert: false, + devBuildAgreementTime: 0, }), { name: 'app' }, ),