// Hooks import { useState } from 'react' import { useTranslation } from 'next-i18next' import { useBackend } from 'site/hooks/useBackend.mjs' import { useToast } from 'site/hooks/useToast.mjs' // Components import { BackToAccountButton, Choice, Icons, welcomeSteps } from './shared.mjs' import { ContinueButton } from 'site/components/buttons/continue-button.mjs' export const ns = ['account', 'toast'] export const ControlSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const toast = useToast() const { t } = useTranslation(ns) const [selection, setSelection] = useState(app.account.control || 2) const update = async (control) => { if (control !== selection) { app.startLoading() const result = await backend.updateAccount({ control }) if (result) setSelection(control) if (result === true) toast.for.settingsSaved() else toast.for.backendError() app.stopLoading() } } const nextHref = welcomeSteps[selection].length > 1 ? '/welcome/' + welcomeSteps[selection][1] : '/docs/guide' return ( <> {title ?