v3 : interface Svelte — accueil, groupes, lecteur du texte en vigueur, panneau contextuel, éditeur à assistant, trustinWallet
- Accueil sobre, menu complet à gauche (Décisions, Docs de référence, Mandats, Protocoles), intro demandée, quatre sections, connexion Ğ1. - Lecteur : texte en vigueur en Literata, actions contextuelles par article (le vote, propositions, proposer), propositions en cours sous la « surface » avec leur niveau d'eau, aperçus « si les bien cotées passent » / « si tout passe », langue du texte fr/en/es (traductions éditoriales). - Panneau : vote pour/contre, seuil et formule (MathML), inertie et son changement (voté en inertie +), coquille sans vote, traduction, signalement de contradiction, historique des corrections. - trustinWallet (/acces) : groupes et membres, invitations à usage unique, administrateurs, retours d'usage. - Contrôles : vitest (markdown, catalogues, anti-lexique), Playwright C1–C10 + M1. - Sections du seed portées jusqu'à l'écran. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,100 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation';
|
||||
import { page } from '$app/state';
|
||||
import { api, ApiError } from '$lib/api';
|
||||
import { t, type Key } from '$lib/i18n/index.svelte';
|
||||
import { session } from '$lib/session.svelte';
|
||||
import type { Me } from '$lib/types';
|
||||
|
||||
const back = $derived(page.url.searchParams.get('return') ?? '/groupes');
|
||||
const error = $derived(page.url.searchParams.get('erreur'));
|
||||
let devName = $state('');
|
||||
let devAdmin = $state(false);
|
||||
let devError = $state('');
|
||||
|
||||
$effect(() => {
|
||||
if (session.me) void goto(back, { replaceState: true });
|
||||
});
|
||||
|
||||
async function dev(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
try {
|
||||
const r = await api.post<{ me: Me }>('/auth/dev', { name: devName, admin: devAdmin });
|
||||
session.me = r.me;
|
||||
} catch (err) {
|
||||
devError = t(`error.${err instanceof ApiError ? err.code : 'internal'}` as Key);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="page">
|
||||
<h1>{t('signin.title')}</h1>
|
||||
|
||||
{#if error}
|
||||
<p class="alert" role="alert">{t(`signin.error.${error}` as Key)}</p>
|
||||
{/if}
|
||||
|
||||
<section class="card block">
|
||||
{#if session.g1}
|
||||
<a class="btn primary big" href="/api/auth/g1/start?return={encodeURIComponent(back)}">{t('signin.g1')}</a>
|
||||
<p>{t('signin.g1.how')}</p>
|
||||
<p class="faint">{t('signin.g1.members')}</p>
|
||||
{:else}
|
||||
<button class="btn primary big" type="button" disabled>{t('signin.g1')}</button>
|
||||
<p>{t('signin.g1.pending')}</p>
|
||||
{/if}
|
||||
</section>
|
||||
|
||||
<p class="muted invite">{t('signin.invite')}</p>
|
||||
|
||||
{#if session.dev}
|
||||
<form class="card block dev" onsubmit={dev}>
|
||||
<h2 class="eyebrow">{t('signin.dev')}</h2>
|
||||
<label class="field"><span>{t('signin.dev.name')}</span><input class="input" bind:value={devName} required maxlength="40" /></label>
|
||||
<label class="check"><input type="checkbox" bind:checked={devAdmin} /> {t('signin.dev.admin')}</label>
|
||||
{#if devError}<p class="alert">{devError}</p>{/if}
|
||||
<button class="btn" type="submit">{t('signin.dev.go')}</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<style>
|
||||
.page {
|
||||
max-width: 34rem;
|
||||
margin: 0 auto;
|
||||
padding: clamp(2.5rem, 9vh, 6rem) 1.4rem 4rem;
|
||||
display: grid;
|
||||
gap: 1.2rem;
|
||||
}
|
||||
h1 {
|
||||
font-family: var(--font-text);
|
||||
font-weight: 500;
|
||||
font-size: 2.2rem;
|
||||
}
|
||||
.block {
|
||||
padding: 1.5rem;
|
||||
display: grid;
|
||||
gap: 0.9rem;
|
||||
}
|
||||
.big {
|
||||
min-height: 3rem;
|
||||
font-size: 1.02rem;
|
||||
justify-self: start;
|
||||
}
|
||||
.invite {
|
||||
padding: 0 0.3rem;
|
||||
}
|
||||
.alert {
|
||||
color: var(--ochre);
|
||||
font-weight: 700;
|
||||
}
|
||||
.check {
|
||||
display: flex;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
color: var(--ink-soft);
|
||||
}
|
||||
.dev .btn {
|
||||
justify-self: start;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user