// Dependencies import { useState } from 'react' import { useTranslation } from 'next-i18next' // Hooks import { useAccount } from 'shared/hooks/use-account.mjs' import { useBackend } from 'shared/hooks/use-backend.mjs' import { useLoadingStatus } from 'shared/hooks/use-loading-status.mjs' // Components import Markdown from 'react-markdown' import { Icons, welcomeSteps, BackToAccountButton } from './shared.mjs' import { Popout } from 'shared/components/popout/index.mjs' import { SaveSettingsButton } from 'shared/components/buttons/save-settings-button.mjs' import { ContinueButton } from 'shared/components/buttons/continue-button.mjs' export const ns = ['account', 'status'] export const Tab = ({ id, activeTab, setActiveTab, t }) => ( ) export const BioSettings = ({ title = false, welcome = false }) => { // Hooks const { account, setAccount } = useAccount() const backend = useBackend() const { t } = useTranslation(ns) const { setLoadingStatus, LoadingStatus } = useLoadingStatus() // State const [bio, setBio] = useState(account.bio) const [activeTab, setActiveTab] = useState('edit') // Helper method to save bio const save = async () => { setLoadingStatus([true, 'processingUpdate']) const result = await backend.updateAccount({ bio }) if (result.success) { setAccount(result.data.account) setLoadingStatus([true, 'settingsSaved', true, true]) } else setLoadingStatus([true, 'backendError', true, true]) } // Next step in the onboarding const nextHref = welcomeSteps[account.control].length > 5 ? '/welcome/' + welcomeSteps[account.control][6] : '/docs/guide' // Shared props for tabs const tabProps = { activeTab, setActiveTab, t } return (
{title ?

{t('bioTitle')}

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