feat(design-system): apply Max_Design_System tokens to all components

Add docs/Max_Design_System.md as the mandatory source of truth for
every Max Avatar component (existing and future): CSS custom properties
(tokens.css), the documented component library for the upcoming coach
pipeline UI (chat bubble, module panel, exercise card, stepper, input
bar, badge, code block — components.css), and bespoke app-level
components that follow the same tokens where the doc has no direct
equivalent (thinking indicator, banners, login panel — app.css).

Rewrite LoginView, ThinkingIndicator, UpdateBanner and VoiceErrorBanner
to use these classes instead of ad-hoc inline styles with hardcoded
hex colors. Self-host Inter and JetBrains Mono via @fontsource (the
only two fonts the design system allows) since the renderer's CSP has
no external font-src. Drop base.css's unused electron-vite boilerplate
palette (--ev-c-*) in favor of the design tokens.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
william
2026-10-31 21:07:54 +01:00
co-authored by Claude Sonnet 5
parent 253c65b00a
commit d46a1ca69f
12 changed files with 1017 additions and 183 deletions
+20
View File
@@ -11,6 +11,8 @@
"dependencies": {
"@electron-toolkit/preload": "^3.0.2",
"@electron-toolkit/utils": "^4.0.0",
"@fontsource/inter": "^5.3.0",
"@fontsource/jetbrains-mono": "^5.3.0",
"dotenv": "^18.0.8",
"electron-updater": "^6.8.11",
"pdf-lib": "^1.17.1",
@@ -1240,6 +1242,24 @@
}
}
},
"node_modules/@fontsource/inter": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource/inter/-/inter-5.3.0.tgz",
"integrity": "sha512-RofMylZmjlJEfELXeNHFWBRcSs75rGU/6bV2S2jfnvv/3rPXPGe0LgUJTklcHZ9lM4OZmAVFhcJPnACfb91A3g==",
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@fontsource/jetbrains-mono": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/@fontsource/jetbrains-mono/-/jetbrains-mono-5.3.0.tgz",
"integrity": "sha512-fqDfB5I9f1p1TV486aUgB9t8zP84P0O1FtQR5Ol9vjwPy+S+EIGlVYm1cvj2W5shcZMTg2nZFdVMoH5wFu8a1A==",
"license": "OFL-1.1",
"funding": {
"url": "https://github.com/sponsors/ayuhito"
}
},
"node_modules/@humanfs/core": {
"version": "0.19.2",
"resolved": "https://registry.npmjs.org/@humanfs/core/-/core-0.19.2.tgz",
+2
View File
@@ -44,6 +44,8 @@
"dependencies": {
"@electron-toolkit/preload": "^3.0.2",
"@electron-toolkit/utils": "^4.0.0",
"@fontsource/inter": "^5.3.0",
"@fontsource/jetbrains-mono": "^5.3.0",
"dotenv": "^18.0.8",
"electron-updater": "^6.8.11",
"pdf-lib": "^1.17.1",
+6 -48
View File
@@ -1,35 +1,5 @@
:root {
--ev-c-white: #ffffff;
--ev-c-white-soft: #f8f8f8;
--ev-c-white-mute: #f2f2f2;
--ev-c-black: #1b1b1f;
--ev-c-black-soft: #222222;
--ev-c-black-mute: #282828;
--ev-c-gray-1: #515c67;
--ev-c-gray-2: #414853;
--ev-c-gray-3: #32363f;
--ev-c-text-1: rgba(255, 255, 245, 0.86);
--ev-c-text-2: rgba(235, 235, 245, 0.6);
--ev-c-text-3: rgba(235, 235, 245, 0.38);
--ev-button-alt-border: transparent;
--ev-button-alt-text: var(--ev-c-text-1);
--ev-button-alt-bg: var(--ev-c-gray-3);
--ev-button-alt-hover-border: transparent;
--ev-button-alt-hover-text: var(--ev-c-text-1);
--ev-button-alt-hover-bg: var(--ev-c-gray-2);
}
:root {
--color-background: var(--ev-c-black);
--color-background-soft: var(--ev-c-black-soft);
--color-background-mute: var(--ev-c-black-mute);
--color-text: var(--ev-c-text-1);
}
/* Les tokens de couleur/typographie/espace vivent dans ../styles/tokens.css (design system,
docs/Max_Design_System.md) : ce fichier ne garde que le reset de base. */
*,
*::before,
@@ -45,22 +15,10 @@ ul {
body {
min-height: 100vh;
color: var(--color-text);
background: var(--color-background);
line-height: 1.6;
font-family:
Inter,
-apple-system,
BlinkMacSystemFont,
'Segoe UI',
Roboto,
Oxygen,
Ubuntu,
Cantarell,
'Fira Sans',
'Droid Sans',
'Helvetica Neue',
sans-serif;
color: var(--text-1);
background: var(--bg);
line-height: var(--leading-body);
font-family: var(--font-sans);
text-rendering: optimizeLegibility;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
@@ -28,85 +28,43 @@ export default function LoginView(): React.JSX.Element {
}
return (
<div
style={{
background: '#1e1e1e',
color: '#eee',
minHeight: '100vh',
padding: 24,
fontFamily: 'sans-serif',
boxSizing: 'border-box'
}}
>
<h1 style={{ fontSize: 18, marginBottom: 20 }}>Connexion a Max</h1>
<div className="auth-panel">
<h1 className="auth-panel__title">Connexion a Max</h1>
{success ? (
<p style={{ color: '#8bc34a' }}>
<p className="auth-panel__success">
Connexion reussie. Cette fenetre se ferme automatiquement...
</p>
) : (
<form onSubmit={submit}>
<label style={{ display: 'block', marginBottom: 12 }}>
<span style={{ display: 'block', marginBottom: 4, fontSize: 13, color: '#aaa' }}>
Email
</span>
<label className="auth-field">
<span className="auth-field__label">Email</span>
<input
type="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
autoFocus
style={{
width: '100%',
boxSizing: 'border-box',
padding: 10,
background: '#111',
color: '#eee',
border: '1px solid #444',
borderRadius: 4
}}
className="auth-field__input"
/>
</label>
<label style={{ display: 'block', marginBottom: 16 }}>
<span style={{ display: 'block', marginBottom: 4, fontSize: 13, color: '#aaa' }}>
Mot de passe
</span>
<label className="auth-field">
<span className="auth-field__label">Mot de passe</span>
<input
type="password"
value={password}
onChange={(e) => setPassword(e.target.value)}
style={{
width: '100%',
boxSizing: 'border-box',
padding: 10,
background: '#111',
color: '#eee',
border: '1px solid #444',
borderRadius: 4
}}
className="auth-field__input"
/>
</label>
{error && (
<p style={{ color: '#e57373', fontSize: 13, marginBottom: 16 }} role="alert">
<p className="auth-panel__error" role="alert">
{error}
</p>
)}
<button
type="submit"
disabled={!canSubmit}
style={{
width: '100%',
padding: '10px 24px',
fontSize: 14,
background: canSubmit ? '#3f6fd1' : '#444',
color: '#fff',
border: 'none',
borderRadius: 4,
cursor: canSubmit ? 'pointer' : 'not-allowed'
}}
>
<button type="submit" disabled={!canSubmit} className="auth-panel__submit">
{submitting ? 'Connexion...' : 'Se connecter'}
</button>
</form>
@@ -1,12 +1,3 @@
const dotStyle = (delay: string): React.CSSProperties => ({
width: 10,
height: 10,
borderRadius: '50%',
backgroundColor: '#ffffff',
animation: 'forge-avatar-think-bounce 1s infinite ease-in-out',
animationDelay: delay
})
/**
* Doit rester visible meme sur une tache tres longue (pipeline Coach : plusieurs dizaines de
* secondes, constate en test reel) pour que l'utilisateur sache que Max travaille encore, pas
@@ -15,35 +6,12 @@ const dotStyle = (delay: string): React.CSSProperties => ({
*/
function ThinkingIndicator(): React.JSX.Element {
return (
<div
style={{
position: 'absolute',
top: '4%',
left: '50%',
transform: 'translateX(-50%)',
display: 'flex',
alignItems: 'center',
gap: 10,
padding: '10px 18px',
borderRadius: 999,
backgroundColor: 'rgba(0, 0, 0, 0.75)',
boxShadow: '0 0 0 2px rgba(255, 255, 255, 0.25)',
pointerEvents: 'none'
}}
>
<style>{`
@keyframes forge-avatar-think-bounce {
0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
40% { transform: scale(1); opacity: 1; }
}
`}</style>
<span style={{ color: '#ffffff', fontSize: 13, fontFamily: 'sans-serif' }}>
Max reflechit...
</span>
<span style={{ display: 'flex', gap: 6 }}>
<span style={dotStyle('0s')} />
<span style={dotStyle('0.15s')} />
<span style={dotStyle('0.3s')} />
<div className="thinking">
<span className="thinking__label">Max reflechit...</span>
<span className="thinking__dots">
<span className="thinking__dot" style={{ animationDelay: '0s' }} />
<span className="thinking__dot" style={{ animationDelay: '0.15s' }} />
<span className="thinking__dot" style={{ animationDelay: '0.3s' }} />
</span>
</div>
)
@@ -9,28 +9,7 @@ function UpdateBanner({ status }: { status: 'available' | 'ready' }): React.JSX.
? 'Mise a jour prete : elle sera installee a la prochaine fermeture de Max.'
: 'Mise a jour disponible, telechargement en cours...'
return (
<div
style={{
position: 'absolute',
bottom: '4%',
left: '50%',
transform: 'translateX(-50%)',
maxWidth: '90%',
padding: '10px 18px',
borderRadius: 12,
backgroundColor: 'rgba(30, 90, 150, 0.9)',
boxShadow: '0 0 0 2px rgba(255, 255, 255, 0.25)',
color: '#ffffff',
fontSize: 13,
fontFamily: 'sans-serif',
textAlign: 'center',
pointerEvents: 'none'
}}
>
{message}
</div>
)
return <div className="banner banner--info">{message}</div>
}
export default UpdateBanner
@@ -4,28 +4,7 @@
* alors qu'une erreur reseau transitoire avait simplement coupe la transcription.
*/
function VoiceErrorBanner({ message }: { message: string }): React.JSX.Element {
return (
<div
style={{
position: 'absolute',
top: '4%',
left: '50%',
transform: 'translateX(-50%)',
maxWidth: '90%',
padding: '10px 18px',
borderRadius: 12,
backgroundColor: 'rgba(150, 30, 30, 0.9)',
boxShadow: '0 0 0 2px rgba(255, 255, 255, 0.25)',
color: '#ffffff',
fontSize: 13,
fontFamily: 'sans-serif',
textAlign: 'center',
pointerEvents: 'none'
}}
>
Erreur : {message}
</div>
)
return <div className="banner banner--error">Erreur : {message}</div>
}
export default VoiceErrorBanner
+7
View File
@@ -1,3 +1,10 @@
import '@fontsource/inter/400.css'
import '@fontsource/inter/500.css'
import '@fontsource/inter/600.css'
import '@fontsource/jetbrains-mono/400.css'
import './styles/tokens.css'
import './styles/components.css'
import './styles/app.css'
import './assets/main.css'
import { StrictMode } from 'react'
+170
View File
@@ -0,0 +1,170 @@
/* Composants propres a Max Avatar qui n'ont pas d'equivalent direct dans la bibliotheque du
design system (docs/Max_Design_System.md) mais doivent en respecter les tokens, rayons, ombres
et regles visuelles (section "ce que l'IA codeuse ne doit pas faire"). */
/* ── Indicateur de reflexion ── */
.thinking {
position: absolute;
top: 4%;
left: 50%;
transform: translateX(-50%);
display: flex;
align-items: center;
gap: var(--space-3);
padding: var(--space-2) var(--space-4);
border-radius: var(--radius-full);
background: var(--surface);
border: 1px solid var(--border);
box-shadow: var(--shadow-panel);
pointer-events: none;
}
.thinking__label {
font-family: var(--font-sans);
font-size: var(--text-sm);
color: var(--text-1);
}
.thinking__dots {
display: flex;
gap: var(--space-1);
}
.thinking__dot {
width: 6px;
height: 6px;
border-radius: 50%;
background: var(--accent);
animation: thinking-bounce 1s infinite ease-in-out;
}
@keyframes thinking-bounce {
0%,
80%,
100% {
transform: scale(0.6);
opacity: 0.5;
}
40% {
transform: scale(1);
opacity: 1;
}
}
/* ── Bannieres flottantes (erreur, mise a jour) ── */
.banner {
position: absolute;
left: 50%;
transform: translateX(-50%);
max-width: min(90%, 420px);
padding: var(--space-2) var(--space-4);
border-radius: var(--radius-md);
background: var(--surface);
box-shadow: var(--shadow-panel);
font-family: var(--font-sans);
font-size: var(--text-sm);
line-height: var(--leading-tight);
text-align: center;
color: var(--text-1);
pointer-events: none;
}
.banner--error {
top: 4%;
border: 1px solid rgba(248, 113, 113, 0.3);
}
.banner--info {
bottom: 4%;
border: 1px solid var(--border-active);
}
/* ── Fenetre de connexion ── */
.auth-panel {
width: 100%;
height: 100%;
box-sizing: border-box;
padding: var(--space-5);
background: var(--bg);
font-family: var(--font-sans);
display: flex;
flex-direction: column;
}
.auth-panel__title {
font-size: var(--text-md);
font-weight: var(--weight-semi);
color: var(--text-1);
margin-bottom: var(--space-5);
}
.auth-panel__success {
font-size: var(--text-base);
color: var(--green);
}
.auth-field {
display: block;
margin-bottom: var(--space-4);
}
.auth-field__label {
display: block;
margin-bottom: var(--space-1);
font-size: var(--text-sm);
color: var(--text-2);
}
.auth-field__input {
width: 100%;
box-sizing: border-box;
padding: var(--space-3);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
color: var(--text-1);
font-family: var(--font-sans);
font-size: var(--text-base);
outline: none;
caret-color: var(--accent);
transition: border-color var(--ease);
}
.auth-field__input:focus {
border-color: var(--border-active);
}
.auth-panel__error {
margin-bottom: var(--space-4);
font-size: var(--text-sm);
color: var(--red);
}
.auth-panel__submit {
width: 100%;
padding: var(--space-3) var(--space-4);
border: none;
border-radius: var(--radius-md);
background: var(--accent);
color: white;
font-family: var(--font-sans);
font-size: var(--text-base);
font-weight: var(--weight-medium);
cursor: pointer;
opacity: 0.9;
transition: opacity var(--ease);
}
.auth-panel__submit:hover:not(:disabled) {
opacity: 1;
}
.auth-panel__submit:disabled {
background: var(--surface-2);
color: var(--text-3);
cursor: not-allowed;
opacity: 1;
}
@@ -0,0 +1,333 @@
/* Bibliotheque de composants du design system (docs/Max_Design_System.md). A reutiliser tel quel
pour toute nouvelle surface du pipeline coach (bulle de chat, panneau de module, carte
d'exercice, stepper, barre de saisie, badge) plutot que d'ecrire de nouvelles classes. */
/* ── Chat bubble — bulle de message ── */
.chat-bubble {
max-width: 280px;
padding: var(--space-3) var(--space-4);
border-radius: var(--radius-lg);
font-family: var(--font-sans);
font-size: var(--text-base);
line-height: var(--leading-body);
box-shadow: var(--shadow-panel);
}
.chat-bubble--max {
background: var(--surface);
border: 1px solid var(--border);
color: var(--text-1);
border-bottom-left-radius: var(--radius-sm);
}
.chat-bubble--user {
background: var(--accent-dim);
border: 1px solid var(--border-active);
color: var(--text-1);
border-bottom-right-radius: var(--radius-sm);
align-self: flex-end;
}
/* ── Module panel — panneau de cours ── */
.module-panel {
width: 420px;
max-height: 520px;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-lg);
box-shadow: var(--shadow-panel);
display: flex;
flex-direction: column;
overflow: hidden;
}
.module-panel__header {
padding: var(--space-4) var(--space-5);
border-bottom: 1px solid var(--border);
flex-shrink: 0;
}
.module-panel__tag {
font-size: var(--text-xs);
font-weight: var(--weight-medium);
color: var(--accent);
margin-bottom: var(--space-1);
}
.module-panel__title {
font-size: var(--text-md);
font-weight: var(--weight-semi);
letter-spacing: -0.3px;
color: var(--text-1);
}
.module-panel__body {
flex: 1;
overflow-y: auto;
padding: var(--space-5);
font-size: var(--text-base);
line-height: var(--leading-body);
color: #9097b0;
scrollbar-width: thin;
scrollbar-color: var(--surface-2) transparent;
}
/* ── Exercise card — carte d'exercice ── */
.ex-card {
padding: var(--space-4);
background: var(--bg);
border: 1px solid var(--border);
border-radius: var(--radius-md);
cursor: pointer;
transition: border-color var(--ease);
}
.ex-card:hover {
border-color: var(--border-active);
}
.ex-card__level {
font-size: var(--text-xs);
font-weight: var(--weight-medium);
margin-bottom: var(--space-2);
}
.ex-card__level--easy {
color: var(--green);
}
.ex-card__level--medium {
color: var(--amber);
}
.ex-card__level--hard {
color: var(--red);
}
.ex-card__text {
font-size: var(--text-sm);
color: var(--text-2);
line-height: var(--leading-tight);
}
/* ── Pipeline stepper — progression session ── */
.step {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2) var(--space-2);
border-radius: var(--radius-sm);
border: 1px solid transparent;
}
.step--done {
opacity: 0.45;
}
.step--pending {
opacity: 0.25;
}
.step--active {
background: var(--accent-dim);
border-color: var(--border-active);
}
.step__num {
width: 18px;
height: 18px;
border-radius: 5px;
display: flex;
align-items: center;
justify-content: center;
font-size: 9px;
font-weight: var(--weight-semi);
flex-shrink: 0;
}
.step--done .step__num {
background: var(--green-dim);
color: var(--green);
}
.step--active .step__num {
background: var(--accent);
color: white;
}
.step--pending .step__num {
background: var(--surface-2);
color: var(--text-3);
border: 1px solid var(--border);
}
.step__label {
font-size: var(--text-sm);
font-weight: var(--weight-medium);
color: var(--text-2);
}
.step--active .step__label {
color: var(--text-1);
}
/* ── Input bar — barre de saisie ── */
.input-bar {
display: flex;
align-items: center;
gap: var(--space-2);
padding: var(--space-2) var(--space-3);
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius-md);
transition: border-color var(--ease);
width: 320px;
}
.input-bar:focus-within {
border-color: var(--border-active);
}
.input-bar input {
flex: 1;
border: none;
background: none;
outline: none;
font-family: var(--font-sans);
font-size: var(--text-base);
color: var(--text-1);
caret-color: var(--accent);
}
.input-bar input::placeholder {
color: var(--text-3);
}
.input-bar__btn {
width: 28px;
height: 28px;
border-radius: var(--radius-sm);
border: 1px solid var(--border);
background: none;
color: var(--text-2);
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
transition: all var(--ease);
flex-shrink: 0;
}
.input-bar__btn:hover {
background: var(--surface-2);
color: var(--text-1);
}
.input-bar__send {
width: 28px;
height: 28px;
border-radius: var(--radius-sm);
border: none;
background: var(--accent);
color: white;
display: flex;
align-items: center;
justify-content: center;
cursor: pointer;
opacity: 0.9;
transition: opacity var(--ease);
flex-shrink: 0;
}
.input-bar__send:hover {
opacity: 1;
}
/* ── Badge — statut et labels ── */
.badge {
display: inline-flex;
align-items: center;
gap: var(--space-1);
padding: 3px var(--space-2);
border-radius: var(--radius-full);
font-size: var(--text-xs);
font-weight: var(--weight-medium);
white-space: nowrap;
}
.badge--active {
background: var(--accent-dim);
color: #a5b4fc;
border: 1px solid var(--border-active);
}
.badge--success {
background: var(--green-dim);
color: var(--green);
}
.badge--neutral {
background: var(--surface-2);
color: var(--text-2);
border: 1px solid var(--border);
}
.live-dot {
width: 5px;
height: 5px;
border-radius: 50%;
background: var(--green);
animation: blink 2.5s ease-in-out infinite;
}
@keyframes blink {
0%,
100% {
opacity: 1;
}
60% {
opacity: 0.3;
}
}
/* ── Code block — affichage de code ── */
.code-block {
background: #0a0b0f;
border: 1px solid var(--border);
border-radius: var(--radius-md);
padding: var(--space-4) var(--space-5);
font-family: var(--font-mono);
font-size: 12px;
line-height: 1.65;
color: #8892b0;
overflow-x: auto;
tab-size: 2;
}
.token-kw {
color: #8b8bdb;
}
.token-fn {
color: #88c0d0;
}
.token-str {
color: #a3be8c;
}
.token-num {
color: #d08770;
}
.token-cm {
color: #3b4261;
font-style: italic;
}
@@ -0,0 +1,65 @@
:root {
/* ── Couleurs de base ── */
--bg: #0c0d12; /* fond principal de la fenetre */
--surface: #111318; /* surface des panneaux */
--surface-2: #16181f; /* surface secondaire, hover */
/* ── Bordures ── */
--border: rgba(255, 255, 255, 0.06);
--border-active: rgba(99, 102, 241, 0.3);
--border-hover: rgba(255, 255, 255, 0.1);
/* ── Accent ── */
--accent: #6366f1; /* indigo — couleur principale */
--accent-dim: rgba(99, 102, 241, 0.12); /* fond des elements actifs */
--accent-glow: rgba(99, 102, 241, 0.08); /* halo tres subtil avatar uniquement */
/* ── Texte ── */
--text-1: #e4e6ee; /* texte principal */
--text-2: #6b7280; /* texte secondaire, labels */
--text-3: #2d3148; /* texte desactive, placeholders */
/* ── Semantique ── */
--green: #34d399;
--green-dim: rgba(52, 211, 153, 0.1);
--amber: #fbbf24;
--red: #f87171;
/* ── Typographie ── */
--font-sans: 'Inter', system-ui, sans-serif;
--font-mono: 'JetBrains Mono', 'Fira Code', monospace;
--text-xs: 11px;
--text-sm: 12px;
--text-base: 13.5px;
--text-md: 15px;
--text-lg: 18px;
--weight-normal: 400;
--weight-medium: 500;
--weight-semi: 600;
--leading-tight: 1.4;
--leading-body: 1.75;
/* ── Espace ── */
--space-1: 4px;
--space-2: 8px;
--space-3: 12px;
--space-4: 16px;
--space-5: 20px;
--space-6: 24px;
/* ── Rayons ── */
--radius-sm: 6px;
--radius-md: 9px;
--radius-lg: 14px;
--radius-full: 9999px;
/* ── Ombres ── */
--shadow-panel: 0 8px 32px rgba(0, 0, 0, 0.45);
--shadow-card: 0 2px 8px rgba(0, 0, 0, 0.3);
/* ── Transitions ── */
--ease: 0.15s ease;
}