mirror of
https://github.com/IliesAllali/parenthese.git
synced 2026-11-19 08:52:50 +00:00
feat(entree): accueil à deux choix, porte unique, prénom du compte
- Backend : prénom du compte facultatif à l'inscription (colonne users.firstName, migration additive), renvoyé à l'inscription, à la connexion et sur GET /auth/me - Accueil sans session : deux choix (J'ai reçu un lien, Se connecter) et Créer mon arbre en lien, à la place de la démo (variante B validée) - Porte : mot de passe puis prénom facultatif pour un nouveau venu ; compte connecté non rattaché : bandeau avec son prénom, sans champ prénom, et « Ce n'est pas mon compte » (déconnexion, retour à la porte du même arbre) - Sur-titre « Arbre partagé » retiré de la porte - Compte déjà rattaché : inchangé, la racine ouvre l'arbre directement Vérifié : vitest front 154/154, back 228/228 (sans .env local, le test CORS attend localhost:5173), tsc back, eslint front, vite build, landing test et build. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f1ecb3951c
commit
92ceea6565
11 files changed
+293
-21
No files matched your search
@@ -27,6 +27,7 @@ const AccessGate = ({
|
||||
connectedName = '',
|
||||
onSubmit,
|
||||
onUseAccount,
|
||||
onNotMyAccount,
|
||||
}) => {
|
||||
const [treeId, setTreeId] = useState(initialTreeId || '')
|
||||
const [password, setPassword] = useState('')
|
||||
@@ -57,7 +58,6 @@ const AccessGate = ({
|
||||
|
||||
<form className="pz-card pz-screen-card" onSubmit={handleSubmit}>
|
||||
<div className="pz-auth-head">
|
||||
<p className="pz-eyebrow">{t('Arbre partagé')}</p>
|
||||
{treeNotFound ? (
|
||||
<h1 className="pz-title">{richText(t('Cet arbre est *introuvable*'))}</h1>
|
||||
) : (
|
||||
@@ -69,7 +69,7 @@ const AccessGate = ({
|
||||
{treeNotFound
|
||||
? t("Le lien est peut-être incomplet, ou l'arbre a été supprimé. Demandez un nouveau lien à la personne qui vous l'a envoyé.")
|
||||
: treeName
|
||||
? t('Entrez le mot de passe reçu avec le lien. Pas besoin de compte pour regarder.')
|
||||
? t('Tapez le mot de passe reçu avec le lien. Pas besoin de compte pour regarder.')
|
||||
: t('Entrez le code et le mot de passe reçus avec votre lien de partage.')}
|
||||
</p>
|
||||
</div>
|
||||
@@ -119,20 +119,6 @@ const AccessGate = ({
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="pz-field">
|
||||
<label htmlFor="visitorFirstName">{t('Votre prénom (facultatif)')}</label>
|
||||
<input
|
||||
id="visitorFirstName"
|
||||
type="text"
|
||||
value={firstName}
|
||||
onChange={(event) => setFirstName(event.target.value)}
|
||||
disabled={loading}
|
||||
autoComplete="given-name"
|
||||
maxLength={60}
|
||||
/>
|
||||
<p className="pz-hint">{t("Il sert à savoir qui est venu voir l'arbre.")}</p>
|
||||
</div>
|
||||
|
||||
<div className="pz-field">
|
||||
<label htmlFor="sharePassword">{t('Mot de passe reçu avec le lien')}</label>
|
||||
<input
|
||||
@@ -145,6 +131,23 @@ const AccessGate = ({
|
||||
required
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Compte connecté : son prénom sert déjà, on ne le redemande pas */}
|
||||
{!connected && (
|
||||
<div className="pz-field">
|
||||
<label htmlFor="visitorFirstName">{t('Votre prénom (facultatif)')}</label>
|
||||
<input
|
||||
id="visitorFirstName"
|
||||
type="text"
|
||||
value={firstName}
|
||||
onChange={(event) => setFirstName(event.target.value)}
|
||||
disabled={loading}
|
||||
autoComplete="given-name"
|
||||
maxLength={60}
|
||||
/>
|
||||
<p className="pz-hint">{t("Il sert à savoir qui est venu voir l'arbre.")}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
|
||||
@@ -163,7 +166,15 @@ const AccessGate = ({
|
||||
)}
|
||||
</form>
|
||||
|
||||
{onUseAccount && !treeNotFound && (
|
||||
{connected && onNotMyAccount && !treeNotFound && (
|
||||
<div className="pz-account-foot">
|
||||
<button type="button" className="pz-btn pz-btn--ghost pz-btn--sm" onClick={onNotMyAccount} disabled={loading}>
|
||||
{t("Ce n'est pas mon compte")}
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{!connected && onUseAccount && !treeNotFound && (
|
||||
<div className="pz-account-foot">
|
||||
<button type="button" className="pz-btn pz-btn--ghost pz-btn--sm" onClick={() => onUseAccount('login')} disabled={loading}>
|
||||
{t("J'ai déjà un compte")}
|
||||
|
||||
@@ -45,6 +45,12 @@
|
||||
.access-gate-session { display: grid; gap: 4px; padding: 12px 14px; border-radius: var(--pz-r-m); background: var(--pz-a50); border: 1px solid var(--pz-a100); color: var(--pz-ink); font: 400 14px/1.45 var(--pz-sans); }
|
||||
.access-gate-session-step { color: var(--pz-ink-2); }
|
||||
|
||||
/* Accueil sans session (variante B) */
|
||||
.pz-btn.pz-btn--line { background: transparent; border: 1px solid var(--pz-ink); color: var(--pz-ink); }
|
||||
.entry-choice-title { text-align: center; }
|
||||
.entry-choice-card { padding: 18px; display: grid; gap: 10px; }
|
||||
.entry-choice-name { font: 400 20px/1.2 var(--pz-serif); color: var(--pz-ink); margin: 0; }
|
||||
|
||||
/* Fenêtre « Mon compte » (personne liée) */
|
||||
.ap-linked { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--pz-r-m); background: var(--pz-a50); border: 1px solid var(--pz-a100); }
|
||||
.ap-avatar { width: 44px; height: 44px; flex: none; display: grid; place-items: center; overflow: hidden; border-radius: 50%; background: var(--pz-a100); color: var(--pz-a700); font: 400 20px/1 var(--pz-serif); }
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
import logoUrl from '../assets/parenthese-logo.svg?url'
|
||||
import './AccountScreens.css'
|
||||
import LanguageSwitch from './navbar/LanguageSwitch'
|
||||
import { t } from '../i18n/index.js'
|
||||
|
||||
// Accueil sans session (variante B validée le 18/10) : deux choix, rien d'autre au premier regard.
|
||||
const EntryChoice = ({ onFamilyLink, onLogin, onRegister }) => (
|
||||
<div className="entry-choice pz-screen">
|
||||
<div className="pz-screen-inner">
|
||||
<img src={logoUrl} alt="Parenthèse" className="pz-screen-logo" />
|
||||
|
||||
<h1 className="pz-title entry-choice-title">{t('Que voulez-vous faire ?')}</h1>
|
||||
|
||||
<div className="entry-choice-card pz-card">
|
||||
<h2 className="entry-choice-name">{t("J'ai reçu un lien")}</h2>
|
||||
<p className="pz-sub">{t("Pas besoin de compte pour regarder l'arbre.")}</p>
|
||||
<button type="button" className="pz-btn pz-btn--primary pz-btn--block" onClick={onFamilyLink}>
|
||||
{t("J'ai reçu un lien de famille")}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="entry-choice-card pz-card">
|
||||
<h2 className="entry-choice-name">{t("J'ai déjà un compte")}</h2>
|
||||
<p className="pz-sub">{t('Pour retrouver vos arbres et ajouter des souvenirs.')}</p>
|
||||
<button type="button" className="pz-btn pz-btn--line pz-btn--block" onClick={onLogin}>
|
||||
{t('Se connecter')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div className="pz-account-foot">
|
||||
<button type="button" className="pz-btn pz-btn--ghost pz-btn--sm" onClick={onRegister}>
|
||||
{t('Créer mon arbre')}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<LanguageSwitch className="pz-lang--screen" />
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default EntryChoice
|
||||
Reference in new issue
Block a user