From e2502abd9b4ce331268bc096a6ebb6a77219a4ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tr=C3=A8sAbhi?= <43380238+tresabhi@users.noreply.github.com>
Date: Thu, 23 May 2024 12:33:47 -0500
Subject: [PATCH] feat: agreements
---
src/app/components/Checks.tsx | 117 +++++++++++++++++++++++++++-------
src/stores/app.ts | 4 ++
2 files changed, 97 insertions(+), 24 deletions(-)
diff --git a/src/app/components/Checks.tsx b/src/app/components/Checks.tsx
index 39cb31b3d..4453ebb9b 100644
--- a/src/app/components/Checks.tsx
+++ b/src/app/components/Checks.tsx
@@ -1,18 +1,22 @@
'use client';
-import { AlertDialog, Button, Flex } from '@radix-ui/themes';
+import { AlertDialog, Button, Flex, Heading, Text } from '@radix-ui/themes';
import { useEffect, useState } from 'react';
+import { Link } from '../../components/Link';
import { extendAuth } from '../../core/blitz/extendAuth';
import { logout } from '../../core/blitz/logout';
import isDev from '../../core/blitzkit/isDev';
import { isLocalhost } from '../../core/blitzkit/isLocalhost';
-import { useApp } from '../../stores/app';
+import { CURRENT_POLICIES_AGREEMENT_INDEX, useApp } from '../../stores/app';
const DEV_BUILD_AGREEMENT_COOLDOWN = 8 * 24 * 60 * 60 * 1000;
export function Checks() {
const [showDevBuildAlert, setShowDevBuildAlert] = useState(false);
const login = useApp((state) => state.login);
+ const policiesAgreementIndex = useApp(
+ (state) => state.policiesAgreementIndex,
+ );
useEffect(() => {
setShowDevBuildAlert(
@@ -37,31 +41,96 @@ export function Checks() {
});
return (
-
-
- Experimental version!
-
- This version may have a lot of issues. Report issues to{' '}
-
- the official Discord server
-
- . Also consider using{' '}
- the more stable release version.
- You will be asked again in 8 days.
-
+ <>
+
+
+ Experimental version!
+
+ This version may have a lot of issues. Report issues to{' '}
+
+ the official Discord server
+
+ . Also consider using{' '}
+ the more stable release version.
+ You will be asked again in 8 days.
+
-
-
+
+
+ {policiesAgreementIndex !== CURRENT_POLICIES_AGREEMENT_INDEX && (
+
+
- Continue
-
+
+
+
+ {policiesAgreementIndex === -1
+ ? "BlitzKit's cookies"
+ : "BlitzKit's policies have changed"}
+
+
+
+ This website utilizes cookies to perform analytics and
+ personalize your experience. You can learn more through{' '}
+ our privacy policy.
+ You may opt out of personalized advertizement by visiting{' '}
+
+ Google Ad Settings
+
+ . By using BlitzKit, you also agree to our{' '}
+ terms of service.
+
+
+
+ {
+ useApp.setState({
+ policiesAgreementIndex: CURRENT_POLICIES_AGREEMENT_INDEX,
+ });
+ }}
+ >
+ I Agree
+
+
+
-
-
+ )}
+ >
);
}
diff --git a/src/stores/app.ts b/src/stores/app.ts
index cb036b2db..0931749f3 100644
--- a/src/stores/app.ts
+++ b/src/stores/app.ts
@@ -13,13 +13,17 @@ export interface App {
devBuildAgreementTime: number;
developerMode: boolean;
login?: Login;
+ policiesAgreementIndex: number;
}
+export const CURRENT_POLICIES_AGREEMENT_INDEX = 0;
+
export const useApp = create()(
persist(
(set) => ({
devBuildAgreementTime: 0,
developerMode: false,
+ policiesAgreementIndex: -1,
}),
{ name: 'app', merge: (a, b) => merge(b, a) },
),