// 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 Markdown from 'react-markdown' import { Icons, welcomeSteps, BackToAccountButton } from './shared.mjs' import { Popout } from 'shared/components/popout.mjs' import { SaveSettingsButton } from 'site/components/buttons/save-settings-button.mjs' import { ContinueButton } from 'site/components/buttons/continue-button.mjs' export const ns = ['account', 'toast'] const Tab = ({ id, activeTab, setActiveTab, t }) => ( ) export const BioSettings = ({ app, title = false, welcome = false }) => { const backend = useBackend(app) const { t } = useTranslation(ns) const toast = useToast() const [bio, setBio] = useState(app.account.bio) const [activeTab, setActiveTab] = useState('edit') const save = async () => { app.startLoading() const result = await backend.updateAccount({ bio }) if (result === true) toast.for.settingsSaved() else toast.for.backendError() app.stopLoading() } const nextHref = welcomeSteps[app.account.control].length > 5 ? '/welcome/' + welcomeSteps[app.account.control][6] : '/docs/guide' const tabProps = { activeTab, setActiveTab, t } return ( <> {title ?

{t('bioTitle')}

: null}
{activeTab === 'edit' ? (