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,89 @@
|
||||
<script lang="ts">
|
||||
import { page } from '$app/state';
|
||||
import { api, ApiError } from '$lib/api';
|
||||
import { i18n, t } from '$lib/i18n/index.svelte';
|
||||
import { mood } from '$lib/mood.svelte';
|
||||
import { toasts } from '$lib/toast.svelte';
|
||||
|
||||
let dialog: HTMLDialogElement | undefined = $state();
|
||||
let body = $state('');
|
||||
let busy = $state(false);
|
||||
let error = $state('');
|
||||
|
||||
export function open() {
|
||||
error = '';
|
||||
dialog?.showModal();
|
||||
}
|
||||
|
||||
async function send(e: SubmitEvent) {
|
||||
e.preventDefault();
|
||||
if (!body.trim()) return;
|
||||
busy = true;
|
||||
try {
|
||||
await api.post('/feedback', {
|
||||
route: page.url.pathname + page.url.search,
|
||||
body,
|
||||
context: {
|
||||
lang: i18n.lang,
|
||||
mood: mood.current,
|
||||
viewport: `${innerWidth}x${innerHeight}`,
|
||||
build: __LD_BUILD__,
|
||||
},
|
||||
});
|
||||
body = '';
|
||||
dialog?.close();
|
||||
toasts.show(t('feedback.sent'));
|
||||
} catch (err) {
|
||||
error = t(`error.${err instanceof ApiError ? err.code : 'internal'}` as never);
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<dialog bind:this={dialog} class="dialog card" aria-labelledby="fb-title">
|
||||
<form onsubmit={send}>
|
||||
<h2 id="fb-title">{t('feedback.title')}</h2>
|
||||
<label class="field">
|
||||
<span>{t('feedback.prompt')}</span>
|
||||
<textarea class="textarea" bind:value={body} rows="6" maxlength="4000"></textarea>
|
||||
</label>
|
||||
<p class="faint small">{t('feedback.context')}</p>
|
||||
{#if error}<p class="err" role="alert">{error}</p>{/if}
|
||||
<div class="actions">
|
||||
<button class="btn quiet" type="button" onclick={() => dialog?.close()}>{t('common.cancel')}</button>
|
||||
<button class="btn primary" type="submit" disabled={busy || !body.trim()}>{t('feedback.send')}</button>
|
||||
</div>
|
||||
</form>
|
||||
</dialog>
|
||||
|
||||
<style>
|
||||
.dialog {
|
||||
border: 0;
|
||||
padding: 1.5rem;
|
||||
width: min(92vw, 32rem);
|
||||
color: var(--ink);
|
||||
}
|
||||
.dialog::backdrop {
|
||||
background: var(--veil);
|
||||
}
|
||||
form {
|
||||
display: grid;
|
||||
gap: 1rem;
|
||||
}
|
||||
h2 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
.small {
|
||||
font-size: 0.82rem;
|
||||
}
|
||||
.err {
|
||||
color: var(--ochre);
|
||||
font-weight: 650;
|
||||
}
|
||||
.actions {
|
||||
display: flex;
|
||||
justify-content: flex-end;
|
||||
gap: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user