misc: add ref to /accounts for login buttons

This commit is contained in:
Xylight committed 2024-09-22 14:47:04 -07:00
1 parent d567e7e45e
commit 7c7df02e3d
5 files changed
+55 -8

No files matched your search

+11 -6
View File
@@ -114,12 +114,12 @@
<h1 class="font-bold text-3xl">No accounts</h1>
</div>
<div class="flex flex-row items-center gap-2">
<Button href="/login" size="lg">
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" mini />
<Button href="/accounts/login" size="lg">
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" micro />
Log in
</Button>
<Button href="/signup" size="lg">
<Icon slot="prefix" src={Identification} size="16" mini />
<Icon slot="prefix" src={Identification} size="16" micro />
Sign up
</Button>
</div>
@@ -131,13 +131,18 @@
{$t('routes.accounts')}
<div class="flex" slot="extended">
<div class="flex gap-2 mr-auto">
<Button href="/login" size="lg" class="flex-1 px-8" color="primary">
<Button
href="/accounts/login"
size="lg"
class="flex-1 px-8"
color="primary"
>
<Icon slot="prefix" src={ArrowLeftOnRectangle} size="16" mini />
{$t('account.login')}
</Button>
{#if !LINKED_INSTANCE_URL}
<Button href="/login/guest" size="lg">
<Icon slot="prefix" src={Plus} size="16" mini />
<Button href="/accounts/login/guest" size="lg">
<Icon slot="prefix" src={Plus} size="16" micro />
{$t('account.addGuest')}
</Button>
{/if}
+18
View File
@@ -0,0 +1,18 @@
<script lang="ts">
import { Button } from 'mono-svelte'
import LoginPage from '../../login/+page.svelte'
import { ArrowLeft, Icon } from 'svelte-hero-icons'
import { t } from '$lib/translations'
</script>
<LoginPage ref="/accounts">
<Button
size="custom"
color="none"
class="w-max hover:underline text-slate-600 dark:text-zinc-400"
on:click={() => history?.back()}
>
<Icon src={ArrowLeft} size="16" micro />
{$t('account.accounts')}
</Button>
</LoginPage>
@@ -0,0 +1,18 @@
<script lang="ts">
import { Button } from 'mono-svelte'
import LoginPage from '../../../login/guest/+page.svelte'
import { ArrowLeft, Icon } from 'svelte-hero-icons'
import { t } from '$lib/translations'
</script>
<LoginPage ref="/accounts">
<Button
size="custom"
color="none"
class="w-max hover:underline text-slate-600 dark:text-zinc-400"
on:click={() => history?.back()}
>
<Icon src={ArrowLeft} size="16" micro />
{$t('account.accounts')}
</Button>
</LoginPage>
+4 -1
View File
@@ -27,6 +27,8 @@
} from '$lib/components/error/ErrorContainer.svelte'
import { page } from '$app/stores'
export let ref: string = '/'
let data = {
instance: DEFAULT_INSTANCE_URL,
username: '',
@@ -57,7 +59,7 @@
if (result) {
toast({ content: $t('toast.logIn'), type: 'success' })
goto('/')
goto(ref)
}
} else {
throw new Error('Invalid credentials')
@@ -89,6 +91,7 @@
<div class="max-w-xl w-full mx-auto h-max my-auto">
<form on:submit|preventDefault={logIn} class="flex flex-col gap-5">
<div class="flex flex-col">
<slot />
<Header>{$t('account.login')}</Header>
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
<Note>
+4 -1
View File
@@ -10,6 +10,8 @@
import { t } from '$lib/translations'
import Header from '$lib/components/ui/layout/pages/Header.svelte'
export let ref: string = '/'
let form = {
instance: '',
username: `${$t('account.guest')} ${$profileData.profiles.filter((p) => p.jwt == undefined).length + 1}`,
@@ -42,7 +44,7 @@
toast({ content: $t('toast.addAccount'), type: 'success' })
goto('/')
goto(ref)
form.loading = false
}
@@ -51,6 +53,7 @@
<div class="max-w-xl w-full mx-auto h-max my-auto">
<form on:submit|preventDefault={addGuest} class="flex flex-col gap-5">
<div class="flex flex-col gap-2">
<slot />
<Header>{$t('account.addGuest')}</Header>
{#if $site && mayBeIncompatible(MINIMUM_VERSION, $site.version.replace('v', ''))}
<Note>