mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: 8 day dev cooldown
This commit is contained in:
1 parent
b9c5c3c931
commit
e69e66f5f7
2 files changed
+11
-6
No files matched your search
+9
-4
@@ -13,6 +13,8 @@ import { useApp } from '../stores/app';
|
|||||||
|
|
||||||
config();
|
config();
|
||||||
|
|
||||||
|
const DEV_BUILD_AGREEMENT_COOLDOWN = 8 * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
interface RootLayoutProps {
|
interface RootLayoutProps {
|
||||||
children: ReactNode;
|
children: ReactNode;
|
||||||
}
|
}
|
||||||
@@ -29,7 +31,10 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setShowDevBuildAlert(
|
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) {
|
|||||||
</a>
|
</a>
|
||||||
. Also consider using{' '}
|
. Also consider using{' '}
|
||||||
<a href="https://blitz-krieg.vercel.app/">
|
<a href="https://blitz-krieg.vercel.app/">
|
||||||
the more stable version
|
the more stable release version
|
||||||
</a>
|
</a>
|
||||||
.
|
. You will be asked again in 8 days.
|
||||||
</AlertDialog.Description>
|
</AlertDialog.Description>
|
||||||
|
|
||||||
<Flex justify="end">
|
<Flex justify="end">
|
||||||
@@ -78,7 +83,7 @@ export default function RootLayout({ children }: RootLayoutProps) {
|
|||||||
variant="solid"
|
variant="solid"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowDevBuildAlert(false);
|
setShowDevBuildAlert(false);
|
||||||
useApp.setState({ bypassDevBuildAlert: true });
|
useApp.setState({ devBuildAgreementTime: Date.now() });
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Continue
|
Continue
|
||||||
|
|||||||
+2
-2
@@ -2,13 +2,13 @@ import { create } from 'zustand';
|
|||||||
import { persist } from 'zustand/middleware';
|
import { persist } from 'zustand/middleware';
|
||||||
|
|
||||||
export interface App {
|
export interface App {
|
||||||
bypassDevBuildAlert: boolean;
|
devBuildAgreementTime: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useApp = create<App>()(
|
export const useApp = create<App>()(
|
||||||
persist(
|
persist(
|
||||||
(set) => ({
|
(set) => ({
|
||||||
bypassDevBuildAlert: false,
|
devBuildAgreementTime: 0,
|
||||||
}),
|
}),
|
||||||
{ name: 'app' },
|
{ name: 'app' },
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in new issue
Block a user