import Link from 'next/link'
import { useTranslation } from 'next-i18next'
import { Loader } from 'shared/components/loader.mjs'
import { useAccount } from 'shared/hooks/use-account.mjs'
export const ns = ['auth']
const Wrap = ({ children }) => (
{children}
)
const ContactSupport = ({ t }) => (
{t('contactSupport')}
)
const AuthRequired = ({ t }) => (
{t('authRequired')}
{t('membersOnly')}
{t('signUp')}
{t('signIn')}
)
const AccountInactive = ({ t }) => (
{t('accountInactive')}
{t('accountInactiveMsg')}
{t('signupAgain')}
{t('signUp')}
)
const AccountDisabled = ({ t }) => (
{t('accountDisabled')}
{t('accountDisabledMsg')}
)
const AccountProhibited = ({ t }) => (
{t('accountProhibited')}
{t('accountProhibitedMsg')}
)
const AccountStatusUnknown = ({ t }) => (
{t('statusUnknown')}
{t('statusUnknownMsg')}
)
const ConsentLacking = ({ t }) => (
{t('consentLacking')}
{t('membersOnly')}
{t('signUp')}
{t('signIn')}
)
export const AuthWrapper = ({ children, app }) => {
const { t } = useTranslation(ns)
const { account, token } = useAccount()
if (!token || !account.username) return
if (account.status !== 1) {
if (account.status === 0) return
if (account.status === -1) return
if (account.status === -2) return
return
}
if (account.consent < 1) return
return children
}