Espace web du Dirigeant retravaillé
Barre du haut fixe, bandeau d'accueil, étapes d'ouverture (abonnement, carte, programme ouvert), raccourcis : lien d'inscription à copier, affichette, app MonEspacePro ; conception de la carte en dessous. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5d6e7692fa
commit
f51920f1a6
7 changed files with 145 additions and 56 deletions
|
|
@ -74,48 +74,113 @@ export function MerchantLoginPage({ onLogin }: { onLogin: () => void }) {
|
|||
export function MerchantSpace() {
|
||||
const [store, setStore] = useState<MerchantStore | null>(null);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const [copied, setCopied] = useState(false);
|
||||
const [hasCard, setHasCard] = useState<boolean | null>(null);
|
||||
|
||||
const reload = useCallback(() => {
|
||||
api
|
||||
.get<MerchantStore>('/api/staff/store')
|
||||
.then(setStore)
|
||||
.catch((e) => setError(e instanceof ApiError && e.status === 403 ? 'Cet espace est réservé au Dirigeant du magasin. Utilisez l’app MonEspacePro pour scanner les cartes.' : e.message));
|
||||
api
|
||||
.get<unknown>('/api/staff/card-design')
|
||||
.then((d) => setHasCard(!!d))
|
||||
.catch(() => setHasCard(null));
|
||||
}, []);
|
||||
useEffect(reload, [reload]);
|
||||
|
||||
function copy(url: string) {
|
||||
navigator.clipboard?.writeText(url).then(() => {
|
||||
setCopied(true);
|
||||
setTimeout(() => setCopied(false), 2000);
|
||||
});
|
||||
}
|
||||
|
||||
const paid = !!store && !store.subscribeUrl;
|
||||
const open = store?.status === 'ACTIVE';
|
||||
// Parcours d'ouverture : abonnement → carte → programme ouvert.
|
||||
const steps: [string, string, boolean][] = [
|
||||
['Abonnement', paid ? `Formule ${store?.subscription ? PLAN_LABEL[store.subscription.plan] : ''} active` : 'En attente du paiement', paid],
|
||||
['Carte de fidélité', hasCard ? 'Conçue' : 'Logo, couleurs, récompenses', !!hasCard],
|
||||
['Programme ouvert', open ? 'Vos clients peuvent s’inscrire' : 'S’ouvre automatiquement', open],
|
||||
];
|
||||
const current = steps.findIndex(([, , done]) => !done);
|
||||
|
||||
return (
|
||||
<div style={{ minHeight: '100vh' }}>
|
||||
<header className="row between" style={{ padding: '16px 24px', borderBottom: '1px solid var(--border)' }}>
|
||||
<header className="m-top">
|
||||
<Brand admin={false} />
|
||||
<span className="grow" />
|
||||
{store && <span className="muted" style={{ fontSize: 14 }}>{store.name}</span>}
|
||||
{store && <span className="m-avatar" aria-hidden="true">{store.name.charAt(0).toUpperCase()}</span>}
|
||||
<button type="button" className="btn secondary small" onClick={logout}>Se déconnecter</button>
|
||||
</header>
|
||||
|
||||
<main className="container" style={{ padding: 24, display: 'flex', flexDirection: 'column', gap: 24 }}>
|
||||
{error && <div className="alert error" role="alert">{error}</div>}
|
||||
{!store && !error && <p className="muted">Chargement…</p>}
|
||||
{store && (
|
||||
<>
|
||||
<section className="m-hero">
|
||||
<div>
|
||||
<h1>{store.name}</h1>
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
<p>
|
||||
{store.subscription ? `Formule ${PLAN_LABEL[store.subscription.plan]}` : 'Aucune formule'} ·{' '}
|
||||
{store.status === 'ACTIVE' ? 'Programme ouvert à vos clients' : store.status === 'DRAFT' ? 'Programme pas encore ouvert' : 'Programme suspendu'}
|
||||
{open ? 'programme ouvert à vos clients' : store.status === 'SUSPENDED' ? 'programme suspendu' : 'programme pas encore ouvert'}
|
||||
</p>
|
||||
</div>
|
||||
{store.subscribeUrl && (
|
||||
<div className="alert warn row between" style={{ gap: 12 }}>
|
||||
<span>Votre abonnement n’est pas encore actif : le programme s’ouvrira dès le paiement validé.</span>
|
||||
<a className="btn small" href={store.subscribeUrl}>Activer mon abonnement</a>
|
||||
</div>
|
||||
)}
|
||||
{store.subscribeUrl && <a className="btn" href={store.subscribeUrl}>Activer mon abonnement</a>}
|
||||
</section>
|
||||
|
||||
{store.status === 'SUSPENDED' && <div className="alert warn">Programme suspendu. Il rouvre automatiquement dès le paiement de l’abonnement régularisé.</div>}
|
||||
{store.status === 'ACTIVE' && (
|
||||
<div className="alert ok">
|
||||
Vos clients s’inscrivent sur <a href={store.enrollUrl} target="_blank" rel="noreferrer">{store.enrollUrl}</a> (QR code de l’affichette).
|
||||
|
||||
{/* Étapes d'ouverture */}
|
||||
<ol className="m-steps" aria-label="Étapes d’ouverture">
|
||||
{steps.map(([title, sub, done], i) => (
|
||||
<li key={title} className={`m-step${done ? ' done' : ''}${i === current ? ' current' : ''}`} aria-current={i === current ? 'step' : undefined}>
|
||||
<span className="dot">{done ? '✓' : i + 1}</span>
|
||||
<div>
|
||||
<strong>{title}</strong>
|
||||
<span>{sub}</span>
|
||||
</div>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
|
||||
{/* Raccourcis */}
|
||||
<div className="m-grid">
|
||||
<section className="card m-tile">
|
||||
<span className="ico" aria-hidden="true">🔗</span>
|
||||
<h2>Lien d’inscription</h2>
|
||||
<p className="muted" style={{ margin: 0, fontSize: 14 }}>Vos clients s’inscrivent ici (c’est le QR code de l’affichette).</p>
|
||||
<div className="m-copy">
|
||||
<code>{store.enrollUrl}</code>
|
||||
<button type="button" className="btn secondary small" onClick={() => copy(store.enrollUrl)}>{copied ? 'Copié ✓' : 'Copier'}</button>
|
||||
</div>
|
||||
</section>
|
||||
<section className="card m-tile">
|
||||
<span className="ico" aria-hidden="true">🖨️</span>
|
||||
<h2>Affichette du comptoir</h2>
|
||||
<p className="muted" style={{ margin: 0, fontSize: 14 }}>À imprimer en A5 ou A6 et à poser près de la caisse.</p>
|
||||
<div>
|
||||
{hasCard ? (
|
||||
<Link className="btn secondary" to="/espace/affichette">Imprimer l’affichette</Link>
|
||||
) : (
|
||||
<span className="muted" style={{ fontSize: 14 }}>Disponible une fois la carte conçue.</span>
|
||||
)}
|
||||
<p className="muted" style={{ margin: 0 }}>
|
||||
Employés, modules (campagnes, anniversaire, relances…) et statistiques : dans l’app MonEspacePro, avec les mêmes identifiants.
|
||||
</div>
|
||||
</section>
|
||||
<section className="card m-tile">
|
||||
<span className="ico" aria-hidden="true">📱</span>
|
||||
<h2>App MonEspacePro</h2>
|
||||
<p className="muted" style={{ margin: 0, fontSize: 14 }}>
|
||||
Scan des cartes, employés, modules (campagnes, anniversaire, relances…) et statistiques : avec les mêmes identifiants.
|
||||
</p>
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<section style={{ display: 'flex', flexDirection: 'column', gap: 12 }}>
|
||||
<h2>Ma carte de fidélité</h2>
|
||||
<CardWizard
|
||||
store={store}
|
||||
onSaved={reload}
|
||||
|
|
@ -129,6 +194,7 @@ export function MerchantSpace() {
|
|||
</p>
|
||||
}
|
||||
/>
|
||||
</section>
|
||||
</>
|
||||
)}
|
||||
</main>
|
||||
|
|
|
|||
|
|
@ -178,3 +178,26 @@ dialog::backdrop { background: rgb(0 0 0 / 0.45); }
|
|||
|
||||
/* Bouton d’apparence lien (actions secondaires). */
|
||||
.link { background: none; border: 0; padding: 0; color: var(--primary); font: inherit; text-decoration: underline; cursor: pointer; }
|
||||
|
||||
/* ── Espace web du Dirigeant (monespacepro.eu/espace) ── */
|
||||
.m-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 14px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
|
||||
.m-top .grow { flex: 1; }
|
||||
.m-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 800; display: grid; place-items: center; }
|
||||
.m-hero { border-radius: 24px; padding: 28px; background: var(--primary); color: #fff; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; }
|
||||
.m-hero h1 { color: #fff; }
|
||||
.m-hero p { margin: 4px 0 0; opacity: .85; }
|
||||
.m-hero .btn { background: #fff; color: var(--primary); border-color: #fff; }
|
||||
.m-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; list-style: none; margin: 0; padding: 0; }
|
||||
.m-step { display: flex; gap: 12px; align-items: flex-start; padding: 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
|
||||
.m-step .dot { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 14px; background: var(--surface-2); color: var(--text-3); }
|
||||
.m-step.done .dot { background: var(--ok); color: #fff; }
|
||||
.m-step.current { border: 2px solid var(--primary); }
|
||||
.m-step.current .dot { background: var(--primary); color: #fff; }
|
||||
.m-step strong { display: block; }
|
||||
.m-step span { font-size: 14px; color: var(--text-3); }
|
||||
.m-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
|
||||
.m-tile { display: flex; flex-direction: column; gap: 8px; }
|
||||
.m-tile .ico { width: 44px; height: 44px; border-radius: 12px; background: var(--primary-soft); display: grid; place-items: center; font-size: 22px; }
|
||||
.m-copy { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: 14px; word-break: break-all; }
|
||||
.m-copy code { flex: 1; font: inherit; }
|
||||
@media (max-width: 600px) { .m-top { padding: 12px 16px; } .m-hero { padding: 22px; } }
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
|
@ -8,8 +8,8 @@
|
|||
<title>Affichette — MonEspacePro</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/assets/espace/index-C1uHARHs.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-Co2TMa3A.css">
|
||||
<script type="module" crossorigin src="/assets/espace/index-Bea8juAd.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-CbAJ7a2F.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
|
|
@ -8,8 +8,8 @@
|
|||
<title>Mon espace — MonEspacePro</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/assets/espace/index-C1uHARHs.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-Co2TMa3A.css">
|
||||
<script type="module" crossorigin src="/assets/espace/index-Bea8juAd.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-CbAJ7a2F.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
|
|
@ -7,8 +7,8 @@
|
|||
<title>Créer mon programme de fidélité — MonEspacePro</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link href="https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700;800&display=swap" rel="stylesheet" />
|
||||
<script type="module" crossorigin src="/assets/espace/index-C1uHARHs.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-Co2TMa3A.css">
|
||||
<script type="module" crossorigin src="/assets/espace/index-Bea8juAd.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/espace/index-CbAJ7a2F.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="root"></div>
|
||||
|
|
|
|||
Loading…
Reference in a new issue