// Hooks
import { useState } from 'react'
import { useAccount } from 'shared/hooks/use-account.mjs'
import { useBackend } from 'shared/hooks/use-backend.mjs'
import { useRouter } from 'next/router'
import { useTranslation } from 'next-i18next'
// Components
import { Popout } from 'shared/components/popout/index.mjs'
import { Link } from 'shared/components/link.mjs'
import { GdprAccountDetails, ns as gdprNs } from 'shared/components/gdpr/details.mjs'
export const ns = ['gdpr']
const Checkbox = ({ value, setter, label, children = null }) => (
setter(value ? false : true)}
>
setter(value ? false : true)}
/>
{label}
{children}
)
export const ConsentForm = ({ submit }) => {
// State
const [details, setDetails] = useState(false)
const [consent1, setConsent1] = useState(false)
const [consent2, setConsent2] = useState(false)
// Hooks
const router = useRouter()
const { setAccount, setToken } = useAccount()
const backend = useBackend()
const { t } = useTranslation(ns)
const giveConsent = () => {
setConsent1(true)
setConsent2(true)
}
return (
<>
{t('gdpr:privacyMatters')}
{t('gdpr:compliant')}
{t('gdpr:consentWhyAnswer')}
{t('gdpr:accountQuestion')}
{details ? : null}
{consent1 ? (
<>
>
) : (
)}
{consent1 && !consent2 ? {t('openDataInfo')} : null}
{!consent1 && {t('gdpr:noConsentNoAccountCreation')}}
{consent1 && (
)}
FreeSewing Privacy Notice
>
)
}