import Link from 'next/link'
import { useTranslation } from 'next-i18next'
import Loader from 'shared/components/loader.js'
export const namespaces = ['auth']
const Wrap = ({ children }) => (
{children}
)
const ContactSupport = ({ t }) => (
{t('contactSupport')}
)
const AuthRequired = ({ t }) => (
{t('authRequired')}
{t('membersOnly')}
{t('signUp')}
{t('logIn')}
)
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('logIn')}
)
const AuthWrapper = ({ children, app }) => {
const { t } = useTranslation(namespaces)
if (!app.accountReady) return
if (!app.token || !app.account?.username) return
if (app.account.status !== 1) {
if (app.account.status === 0) return
if (app.account.status === -1) return
if (app.account.status === -2) return
return
}
if (app.account.consent < 1) return
return children
}
export default AuthWrapper