Design moderne + seed reel engagements forgeron avec votes

- CSS: couleurs saturees sans pastels, border-radius 4-6px, inputs mood-aware
- Header: allege (3.25rem), logo typographique, bouton connexion fin
- Login: redesign complet avec steps dots et input natif style
- Dashboard: entry cards epurees, tags toolbox compacts
- Seed: 34 vraies clauses forgeron v2.0.0 (forum topic 33165)
- Seed: 9 clauses certification (licence G1)
- Seed: 11 votants simules + 3 sessions de vote (10 pour / 1 contre)
- MoodSwitcher: dots colores au lieu d'icones

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-02-28 18:28:14 +01:00
parent 77dceb49c3
commit 61a414d214
10 changed files with 1774 additions and 1015 deletions

View File

@@ -19,11 +19,9 @@ async function handleLogin() {
step.value = 'signing'
await auth.login(address.value.trim())
step.value = 'success'
// Redirect to home after a brief moment
setTimeout(() => {
router.push('/')
}, 1000)
}, 800)
} catch (err: any) {
errorMessage.value = err?.data?.detail || err?.message || 'Erreur lors de la connexion'
step.value = 'input'
@@ -31,37 +29,22 @@ async function handleLogin() {
}
const steps = computed(() => [
{
title: 'Adresse Duniter',
description: 'Entrez votre adresse SS58 Duniter V2',
icon: 'i-lucide-user',
active: step.value === 'input',
complete: step.value !== 'input',
},
{
title: 'Challenge cryptographique',
description: 'Un challenge aleatoire est genere par le serveur',
icon: 'i-lucide-shield',
active: step.value === 'challenge',
complete: step.value === 'signing' || step.value === 'success',
},
{
title: 'Signature Ed25519',
description: 'Signez le challenge avec votre cle privee',
icon: 'i-lucide-key',
active: step.value === 'signing',
complete: step.value === 'success',
},
{
title: 'Connexion',
description: 'Votre identite est verifiee et la session creee',
icon: 'i-lucide-check-circle',
active: step.value === 'success',
complete: false,
},
{ label: 'Adresse SS58', icon: 'i-lucide-user', done: step.value !== 'input' },
{ label: 'Challenge', icon: 'i-lucide-shield', done: step.value === 'signing' || step.value === 'success' },
{ label: 'Signature', icon: 'i-lucide-key', done: step.value === 'success' },
{ label: 'Connecte', icon: 'i-lucide-check', done: false },
])
// Redirect if already authenticated
const activeStepIndex = computed(() => {
switch (step.value) {
case 'input': return 0
case 'challenge': return 1
case 'signing': return 2
case 'success': return 3
default: return 0
}
})
onMounted(() => {
if (auth.isAuthenticated) {
router.push('/')
@@ -70,108 +53,289 @@ onMounted(() => {
</script>
<template>
<div class="max-w-lg mx-auto space-y-8 py-8">
<div class="text-center">
<UIcon name="i-lucide-vote" class="text-5xl text-primary mb-4" />
<h1 class="text-2xl font-bold text-gray-900 dark:text-white">
Connexion a Glibredecision
</h1>
<p class="mt-2 text-gray-600 dark:text-gray-400">
Authentification via votre identite Duniter V2
</p>
</div>
<div class="login-page">
<div class="login-card">
<!-- Logo -->
<div class="login-card__header">
<span class="login-card__logo">G</span>
<h1 class="login-card__title">Connexion</h1>
<p class="login-card__subtitle">Identite Duniter V2 · Ed25519</p>
</div>
<!-- Login form -->
<UCard>
<div class="space-y-6">
<div>
<label class="block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2">
Adresse Duniter (SS58)
</label>
<UInput
v-model="address"
placeholder="5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY"
size="lg"
icon="i-lucide-wallet"
:disabled="auth.loading || step !== 'input'"
/>
</div>
<!-- Error message -->
<div v-if="errorMessage || auth.error" class="p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg">
<div class="flex items-center gap-2">
<UIcon name="i-lucide-alert-circle" class="text-red-500" />
<p class="text-sm text-red-700 dark:text-red-400">
{{ errorMessage || auth.error }}
</p>
<!-- Steps indicator -->
<div class="login-steps">
<div
v-for="(s, i) in steps"
:key="i"
class="login-step"
:class="{
'login-step--done': s.done,
'login-step--active': i === activeStepIndex,
}"
>
<div class="login-step__dot">
<UIcon v-if="s.done" name="i-lucide-check" class="text-xs" />
<span v-else class="login-step__num">{{ i + 1 }}</span>
</div>
<span class="login-step__label">{{ s.label }}</span>
</div>
</div>
<!-- Success message -->
<div v-if="step === 'success'" class="p-3 bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg">
<div class="flex items-center gap-2">
<UIcon name="i-lucide-check-circle" class="text-green-500" />
<p class="text-sm text-green-700 dark:text-green-400">
Connexion reussie ! Redirection en cours...
</p>
</div>
</div>
<UButton
:label="auth.loading ? 'Connexion en cours...' : 'Se connecter avec Duniter'"
icon="i-lucide-log-in"
size="lg"
block
:loading="auth.loading"
:disabled="!address.trim() || step === 'success'"
@click="handleLogin"
<!-- Input -->
<div class="login-card__field">
<label class="login-card__label">Adresse Duniter (SS58)</label>
<input
v-model="address"
type="text"
class="login-card__input"
placeholder="5GrwvaEF5zXb26Fz9rcQpDWS57Ct..."
:disabled="auth.loading || step !== 'input'"
@keydown.enter="handleLogin"
/>
</div>
</UCard>
<!-- Challenge flow steps -->
<UCard>
<div class="space-y-4">
<h3 class="text-sm font-semibold text-gray-700 dark:text-gray-300 uppercase tracking-wide">
Processus d'authentification
</h3>
<div class="space-y-3">
<div
v-for="(s, index) in steps"
:key="index"
class="flex items-start gap-3"
:class="{ 'opacity-40': !s.active && !s.complete }"
>
<div
class="w-8 h-8 rounded-full flex items-center justify-center flex-shrink-0"
:class="{
'bg-primary text-white': s.active,
'bg-green-500 text-white': s.complete,
'bg-gray-200 dark:bg-gray-700 text-gray-500': !s.active && !s.complete,
}"
>
<UIcon v-if="s.complete" name="i-lucide-check" class="text-sm" />
<span v-else class="text-xs font-bold">{{ index + 1 }}</span>
</div>
<div>
<p class="text-sm font-medium text-gray-900 dark:text-white">
{{ s.title }}
</p>
<p class="text-xs text-gray-500 dark:text-gray-400">
{{ s.description }}
</p>
</div>
</div>
</div>
<!-- Error -->
<div v-if="errorMessage || auth.error" class="login-card__error">
<UIcon name="i-lucide-alert-circle" class="text-sm flex-shrink-0" />
<span>{{ errorMessage || auth.error }}</span>
</div>
</UCard>
<!-- Info note -->
<div class="text-center">
<p class="text-xs text-gray-400">
L'authentification utilise la cryptographie Ed25519 de Duniter V2.
Aucun mot de passe n'est transmis au serveur.
<!-- Success -->
<div v-if="step === 'success'" class="login-card__success">
<UIcon name="i-lucide-check-circle" class="text-sm flex-shrink-0" />
<span>Connecte. Redirection...</span>
</div>
<!-- Button -->
<button
class="login-card__btn"
:disabled="!address.trim() || step === 'success' || auth.loading"
@click="handleLogin"
>
<UIcon v-if="auth.loading" name="i-lucide-loader-2" class="animate-spin text-sm" />
<UIcon v-else name="i-lucide-log-in" class="text-sm" />
<span>{{ auth.loading ? 'Verification...' : 'Se connecter' }}</span>
</button>
<!-- Note -->
<p class="login-card__note">
Aucun mot de passe. Authentification par signature cryptographique.
</p>
</div>
</div>
</template>
<style scoped>
.login-page {
display: flex;
align-items: center;
justify-content: center;
min-height: 70vh;
padding: 2rem 1rem;
}
.login-card {
width: 100%;
max-width: 24rem;
display: flex;
flex-direction: column;
gap: 1.25rem;
}
.login-card__header {
text-align: center;
}
.login-card__logo {
display: inline-flex;
align-items: center;
justify-content: center;
width: 3rem;
height: 3rem;
font-size: 1.5rem;
font-weight: 800;
color: var(--mood-accent-text);
background: var(--mood-accent);
border-radius: 8px;
margin-bottom: 0.75rem;
}
.login-card__title {
font-size: 1.375rem;
font-weight: 700;
color: var(--mood-text);
margin: 0;
}
.login-card__subtitle {
font-size: 0.75rem;
color: var(--mood-text-muted);
margin-top: 0.25rem;
letter-spacing: 0.02em;
}
/* Steps */
.login-steps {
display: flex;
align-items: center;
justify-content: space-between;
gap: 0.25rem;
padding: 0.75rem 0;
}
.login-step {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.25rem;
flex: 1;
}
.login-step__dot {
width: 1.5rem;
height: 1.5rem;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 0.625rem;
font-weight: 700;
border: 1.5px solid var(--mood-border);
color: var(--mood-text-muted);
background: var(--mood-surface);
transition: all 0.2s ease;
}
.login-step--active .login-step__dot {
border-color: var(--mood-accent);
color: var(--mood-accent);
box-shadow: 0 0 0 3px var(--mood-accent-soft);
}
.login-step--done .login-step__dot {
border-color: var(--mood-success);
background: var(--mood-success);
color: white;
}
.login-step__num {
font-size: 0.5625rem;
}
.login-step__label {
font-size: 0.5625rem;
font-weight: 500;
color: var(--mood-text-muted);
text-align: center;
letter-spacing: 0.02em;
}
.login-step--active .login-step__label {
color: var(--mood-accent);
font-weight: 600;
}
/* Field */
.login-card__field {
display: flex;
flex-direction: column;
gap: 0.375rem;
}
.login-card__label {
font-size: 0.6875rem;
font-weight: 600;
color: var(--mood-text-muted);
text-transform: uppercase;
letter-spacing: 0.04em;
}
.login-card__input {
width: 100%;
padding: 0.625rem 0.75rem;
font-size: 0.8125rem;
font-family: ui-monospace, SFMono-Regular, 'Cascadia Code', monospace;
color: var(--mood-text);
background: var(--mood-input-bg, var(--mood-surface));
border: 1px solid var(--mood-input-border, var(--mood-border));
border-radius: 4px;
outline: none;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.login-card__input:focus {
border-color: var(--mood-input-focus, var(--mood-accent));
box-shadow: 0 0 0 2px var(--mood-accent-soft);
}
.login-card__input:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.login-card__input::placeholder {
color: var(--mood-text-muted);
opacity: 0.5;
}
/* Messages */
.login-card__error {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
font-weight: 500;
color: var(--mood-error);
background: rgba(196, 43, 43, 0.08);
border-radius: 4px;
}
.login-card__success {
display: flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
font-weight: 500;
color: var(--mood-success);
background: rgba(24, 132, 59, 0.08);
border-radius: 4px;
}
/* Button */
.login-card__btn {
display: flex;
align-items: center;
justify-content: center;
gap: 0.5rem;
width: 100%;
padding: 0.625rem 1rem;
font-size: 0.8125rem;
font-weight: 600;
color: var(--mood-accent-text);
background: var(--mood-accent);
border: none;
border-radius: 4px;
cursor: pointer;
transition: opacity 0.15s ease;
letter-spacing: 0.01em;
}
.login-card__btn:hover:not(:disabled) {
opacity: 0.88;
}
.login-card__btn:disabled {
opacity: 0.4;
cursor: not-allowed;
}
/* Note */
.login-card__note {
text-align: center;
font-size: 0.6875rem;
color: var(--mood-text-muted);
opacity: 0.7;
}
</style>