import { useState } from 'react' import { useTranslation } from 'next-i18next' import useBackend from 'site/hooks/useBackend.js' import Link from 'next/link' import { Choice } from '../shared.js' export const namespaces = ['control'] const welcomeSteps = { 1: { href: '/docs/guide/', steps: 0, }, 2: { href: '/welcome/newsletter', steps: 3, }, 3: { href: '/welcome/newsletter', steps: 5, }, 4: { href: '/welcome/newsletter', steps: 7, }, 5: { href: '/', steps: 0, }, } export const ControlSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(namespaces) const [selection, setSelection] = useState(app.account.control || 2) const update = async (control) => { if (control !== selection) { const result = await backend.updateAccount({ control }) if (result) setSelection(control) } } return ( <> {title ?