idk tweaks

This commit is contained in:
Evert Prants 2024-06-08 15:56:23 +03:00
parent cfa8ff7048
commit 03c2e5c5db
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 16 additions and 12 deletions

View File

@ -1,8 +1,5 @@
<script lang="ts"> <script lang="ts">
import { useThemeMode } from '$lib/theme-mode';
import '../app.css'; import '../app.css';
useThemeMode();
</script> </script>
<slot></slot> <slot></slot>

View File

@ -1,11 +1,17 @@
import { browser } from '$app/environment';
import { loadTranslations } from '$lib/i18n'; import { loadTranslations } from '$lib/i18n';
import { themeMode } from '$lib/theme-mode';
export const load = async ({ url }) => { export const load = async ({ url }) => {
const { pathname } = url; const { pathname } = url;
const initLocale = 'en'; // get from cookie, user session, ... const initLocale = 'en'; // get from cookie, user session, ...
if (browser) {
themeMode.subscribe((value) => document.documentElement.setAttribute('theme-base', value));
}
await loadTranslations(initLocale, pathname); await loadTranslations(initLocale, pathname);
return {}; return {};
} };

View File

@ -2,6 +2,7 @@
import type { ActionData, PageData } from './$types'; import type { ActionData, PageData } from './$types';
import { env } from '$env/dynamic/public'; import { env } from '$env/dynamic/public';
import { t } from '$lib/i18n'; import { t } from '$lib/i18n';
import { enhance } from '$app/forms';
import Alert from '$lib/components/Alert.svelte'; import Alert from '$lib/components/Alert.svelte';
import Button from '$lib/components/Button.svelte'; import Button from '$lib/components/Button.svelte';
import MainContainer from '$lib/components/container/MainContainer.svelte'; import MainContainer from '$lib/components/container/MainContainer.svelte';
@ -36,13 +37,13 @@
<OAuth2ScopesCard client={form.client} /> <OAuth2ScopesCard client={form.client} />
<div class="decision"> <div class="decision">
<form action="" method="POST"> <form action="" method="POST" use:enhance>
<input type="hidden" value={form.code} name="code" /> <input type="hidden" value={form.code} name="code" />
<input type="hidden" value="1" name="decision" /> <input type="hidden" value="1" name="decision" />
<Button type="submit" variant="primary">{$t('oauth2.authorize.authorize')}</Button> <Button type="submit" variant="primary">{$t('oauth2.authorize.authorize')}</Button>
</form> </form>
<form action="" method="POST"> <form action="" method="POST" use:enhance>
<input type="hidden" value={form.code} name="code" /> <input type="hidden" value={form.code} name="code" />
<input type="hidden" value="0" name="decision" /> <input type="hidden" value="0" name="decision" />
<Button type="submit" variant="link">{$t('oauth2.authorize.reject')}</Button> <Button type="submit" variant="link">{$t('oauth2.authorize.reject')}</Button>
@ -54,9 +55,9 @@
<h2 class="title">{$t('oauth2.device.title')}</h2> <h2 class="title">{$t('oauth2.device.title')}</h2>
<p>{$t('oauth2.device.description')}</p> <p>{$t('oauth2.device.description')}</p>
<form action="" method="POST"> <form action="" method="POST" use:enhance>
<FormWrapper> <FormWrapper>
<FormErrors errors={form?.errors} prefix="oauth2.errors" /> <FormErrors errors={form?.errors || []} prefix="oauth2.errors" />
<FormControl> <FormControl>
<label for="form-code">{$t('oauth2.device.deviceCode')}</label> <label for="form-code">{$t('oauth2.device.deviceCode')}</label>
<input type="text" autocomplete="off" name="code" id="form-code" /> <input type="text" autocomplete="off" name="code" id="form-code" />