// 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 { useToast } from 'shared/hooks/use-toast.mjs' // Components import { BackToAccountButton } from './shared.mjs' import { SaveSettingsButton } from 'site/components/buttons/save-settings-button.mjs' export const ns = ['account', 'toast'] export const GithubSettings = ({ app, title = false, welcome = false }) => { const { account, setAccount, token } = useAccount() const backend = useBackend(token) const { t } = useTranslation(ns) const toast = useToast() const [github, setGithub] = useState(account.github || '') const save = async () => { app.startLoading() const result = await backend.updateAccount({ github }) if (result.success) { setAccount(result.data.account) toast.for.settingsSaved() } else toast.for.backendError() app.stopLoading() } return (
{title ?

{t('githubTitle')}

: null}
setGithub(evt.target.value)} className="input w-full input-bordered flex flex-row" type="text" placeholder={t('github')} />
{!welcome && }
) }