chore(org): Tweaks to account pages
This commit is contained in:
parent
52264a4925
commit
3c31901c2a
5 changed files with 16 additions and 7 deletions
|
@ -309,7 +309,7 @@ export const Apikeys = ({ app }) => {
|
||||||
href="https://freesewing.dev/reference/backend/api/apikeys"
|
href="https://freesewing.dev/reference/backend/api/apikeys"
|
||||||
txt="the API keys reference documentation"
|
txt="the API keys reference documentation"
|
||||||
/>{' '}
|
/>{' '}
|
||||||
on <WebLink href="https://freesewing.dev/" txt="FreeSewing.dev" /> our site for
|
on <WebLink href="https://freesewing.dev/" txt="FreeSewing.dev" />, our site for
|
||||||
developers and contributors.
|
developers and contributors.
|
||||||
</p>
|
</p>
|
||||||
</Popout>
|
</Popout>
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { useToast } from 'site/hooks/useToast.mjs'
|
||||||
import { BackToAccountButton } from './shared.mjs'
|
import { BackToAccountButton } from './shared.mjs'
|
||||||
import { SaveSettingsButton } from 'site/components/buttons/save-settings-button.mjs'
|
import { SaveSettingsButton } from 'site/components/buttons/save-settings-button.mjs'
|
||||||
|
|
||||||
export const ns = ['account']
|
export const ns = ['account', 'toast']
|
||||||
|
|
||||||
export const GithubSettings = ({ app, title = false, welcome = false }) => {
|
export const GithubSettings = ({ app, title = false, welcome = false }) => {
|
||||||
const backend = useBackend(app)
|
const backend = useBackend(app)
|
||||||
|
|
|
@ -17,6 +17,7 @@ export const PasswordSettings = ({ app, title = false, welcome = false }) => {
|
||||||
const { t } = useTranslation(ns)
|
const { t } = useTranslation(ns)
|
||||||
const toast = useToast()
|
const toast = useToast()
|
||||||
const [password, setPassword] = useState('')
|
const [password, setPassword] = useState('')
|
||||||
|
const [reveal, setReveal] = useState(false)
|
||||||
|
|
||||||
const save = async () => {
|
const save = async () => {
|
||||||
app.startLoading()
|
app.startLoading()
|
||||||
|
@ -29,18 +30,26 @@ export const PasswordSettings = ({ app, title = false, welcome = false }) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
{title ? <h2 className="text-4xl">{t('passwordTitle')}</h2> : null}
|
{title ? <h2 className="text-4xl">{t('passwordTitle')}</h2> : null}
|
||||||
<div className="flex flex-row items-center mt-4">
|
<div className="flex flex-row items-center mt-4 gap-2">
|
||||||
<input
|
<input
|
||||||
value={password}
|
value={password}
|
||||||
onChange={(evt) => setPassword(evt.target.value)}
|
onChange={(evt) => setPassword(evt.target.value)}
|
||||||
className="input w-full input-bordered flex flex-row"
|
className="input w-full input-bordered flex flex-row"
|
||||||
type="text"
|
type={reveal ? 'text' : 'password'}
|
||||||
placeholder={t('newPasswordPlaceholder')}
|
placeholder={t('newPasswordPlaceholder')}
|
||||||
/>
|
/>
|
||||||
|
<button
|
||||||
|
className="btn hover:bg-opacity-10 border-0 btn-outline"
|
||||||
|
onClick={() => setReveal(!reveal)}
|
||||||
|
>
|
||||||
|
<span role="img" className="text-3xl">
|
||||||
|
{reveal ? '👀' : '🙈'}
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<SaveSettingsButton app={app} btnProps={{ onClick: save, disabled: password.length < 4 }} />
|
<SaveSettingsButton app={app} btnProps={{ onClick: save, disabled: password.length < 4 }} />
|
||||||
{!welcome && <BackToAccountButton loading={app.loading} />}
|
{!welcome && <BackToAccountButton loading={app.loading} />}
|
||||||
{!app.account.mfa && (
|
{!app.account.mfaEnabled && (
|
||||||
<Popout tip>
|
<Popout tip>
|
||||||
<h5>{t('mfaTipTitle')}</h5>
|
<h5>{t('mfaTipTitle')}</h5>
|
||||||
<p>{t('mfaTipMsg')}</p>
|
<p>{t('mfaTipMsg')}</p>
|
||||||
|
|
|
@ -27,7 +27,7 @@ const btnClasses = {
|
||||||
'border border-secondary hover:border hover:border-secondary',
|
'border border-secondary hover:border hover:border-secondary',
|
||||||
}
|
}
|
||||||
const spanClasses =
|
const spanClasses =
|
||||||
'p-4 w-8 h-8 shrink-0 rounded-full text-center p-0 py-2 bg-secondary text-secondary-content'
|
'p-2 w-8 h-8 shrink-0 rounded-full text-center p-0 py-2 bg-secondary text-secondary-content'
|
||||||
|
|
||||||
export const BackToAccountButton = ({ loading = false }) => {
|
export const BackToAccountButton = ({ loading = false }) => {
|
||||||
const { t } = useTranslation(['account'])
|
const { t } = useTranslation(['account'])
|
||||||
|
|
|
@ -30,7 +30,7 @@ const AccountPage = (props) => {
|
||||||
const app = useApp(props)
|
const app = useApp(props)
|
||||||
const { t } = useTranslation(namespaces)
|
const { t } = useTranslation(namespaces)
|
||||||
const crumbs = [
|
const crumbs = [
|
||||||
[t('yourAccount'), '/account'],
|
[t('account:yourAccount'), '/account'],
|
||||||
[t('consent'), '/account/consent'],
|
[t('consent'), '/account/consent'],
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue