diff --git a/src/components/AnalyticsConsent/AnalyticsConsent.tsx b/src/components/AnalyticsConsent/AnalyticsConsent.tsx index 6e4ed373c..419dcab8d 100644 --- a/src/components/AnalyticsConsent/AnalyticsConsent.tsx +++ b/src/components/AnalyticsConsent/AnalyticsConsent.tsx @@ -1,34 +1,33 @@ -import { Button } from "@mui/material"; import Drawer from "@mui/material/Drawer"; -import { ReactElement, useState } from "react"; +import { ReactElement } from "react"; interface ConsentProps { - onChangeConsent: (consentVal: boolean) => void; + onChangeConsent: (consentVal: boolean | undefined) => void; + required: boolean; } export function AnalyticsConsent(props: ConsentProps): ReactElement { - - const [responded, setResponded] = useState(false); const acceptAnalytics = (): void => { - - setResponded(true); props.onChangeConsent(true); }; const rejectAnalytics = (): void => { - - setResponded(false); props.onChangeConsent(false); }; + const clickedAway = (): void => { + props.onChangeConsent(undefined); + }; return (
- - MyDrawer! + -
); } diff --git a/src/components/App/AppLoggedIn.tsx b/src/components/App/AppLoggedIn.tsx index 46367202a..9577c46a7 100644 --- a/src/components/App/AppLoggedIn.tsx +++ b/src/components/App/AppLoggedIn.tsx @@ -54,7 +54,9 @@ export default function AppWithBar(): ReactElement { getCurrentUser()?.answeredConsent ); - async function handleConsentChange(otelConsent: boolean): Promise { + async function handleConsentChange( + otelConsent: boolean | undefined + ): Promise { await updateUser({ ...getCurrentUser()!, otelConsent, @@ -101,6 +103,7 @@ export default function AppWithBar(): ReactElement { {answeredConsent ? null : ( )} diff --git a/src/components/UserSettings/UserSettings.tsx b/src/components/UserSettings/UserSettings.tsx index 07661cd47..016665b41 100644 --- a/src/components/UserSettings/UserSettings.tsx +++ b/src/components/UserSettings/UserSettings.tsx @@ -79,8 +79,8 @@ export function UserSettings(props: { const [displayConsent, setDisplayConsent] = useState(false); const show = (): void => setDisplayConsent(true); - const handleConsentChange = (consentVal: boolean): void => { - setOtelConsent(consentVal); + const handleConsentChange = (consentVal: boolean | undefined): void => { + setOtelConsent(consentVal ?? otelConsent); setDisplayConsent(false); }; @@ -308,6 +308,7 @@ export function UserSettings(props: { {displayConsent ? ( ) : null}