@spunto/brand-kit 0.9.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,149 @@
1
+ "use client"
2
+
3
+ import { FONT, hexAlpha } from "../../../theme"
4
+ import { AppWindow, Float, MUTED, Stage, u, useStage, type StageColors } from "../stage"
5
+ import { AppShell, Btn, Bubble, Chip, Glyph, Painting, Pill, ROOM, t, Thread, WIN, type Lang } from "./parts"
6
+ import { APP, BOOK, FROM_PHOTO, THREAD, UI, type BookCard } from "./sample"
7
+
8
+ /* The household's cookbook: a page of a book, photographed, goes to the assistant; it reads it and writes the
9
+ recipe in — the card takes the first place, « À tester », painted as its family (a recipe written by the household
10
+ has no painting of its own), and the others make room.
11
+
12
+ Drawn from app/src/views/recettes.jsx (tabs « Notre carnet » / « Idées Foyer », the filters, the cards: painting,
13
+ « De saison », « Officielle » / « À tester », time, « Au menu n fois ») and the assistant's own example prompt,
14
+ « Ajoute cette recette (photo) ». */
15
+
16
+ const H = 500
17
+ const STILL = 4
18
+ /* 0 rest · 1 the page · 2 it reads · 3 the card goes in · 4 added · 5 the panel closes · 6 rest */
19
+ const LENGTHS = [1200, 1500, 1300, 900, 3200, 500, 1000] as const
20
+
21
+ const GAP = 10
22
+ const COL = (ROOM - GAP * 3) / 4
23
+ const CARD_H = 158
24
+ const GRID_TOP = 66
25
+
26
+ export function BookScreen({ lang, colors, night, label }: { lang: Lang; colors: StageColors; night: boolean; label: string }) {
27
+ const { ref, step } = useStage(LENGTHS, STILL)
28
+ const added = step >= 3 && step <= 5
29
+ const cards = added ? [FROM_PHOTO, ...BOOK] : BOOK
30
+
31
+ return (
32
+ <Stage stageRef={ref} colors={colors} night={night} height={H} label={label}>
33
+ <AppWindow {...WIN} h={H} address="foyer.spunto.net/app/#/recettes">
34
+ <AppShell lang={lang} colors={colors} active={1} title={t(UI.recipes, lang)}>
35
+ <div style={{ display: "flex", alignItems: "center", gap: u(8) }}>
36
+ <div style={{ display: "flex", padding: u(2), borderRadius: u(6), background: APP.muted, fontSize: u(9.4) }}>
37
+ <span style={{ display: "flex", alignItems: "center", gap: u(5), padding: `${u(4)} ${u(9)}`, borderRadius: u(4), background: "#ffffff", boxShadow: `0 1px 2px rgba(0,0,0,0.08)`, fontWeight: 550 }}>
38
+ {t(UI.ours, lang)}
39
+ <span style={{ padding: `0 ${u(5)}`, borderRadius: u(8), background: APP.accent, color: colors.tone, fontSize: u(8) }}>{cards.length}</span>
40
+ </span>
41
+ <span style={{ padding: `${u(4)} ${u(9)}`, color: MUTED }}>{t(UI.ideas, lang)}</span>
42
+ </div>
43
+ <div style={{ flex: 1, display: "flex", alignItems: "center", gap: u(6), height: u(24), padding: `0 ${u(8)}`, borderRadius: u(5), background: "#ffffff", boxShadow: `inset 0 0 0 1px ${APP.border}`, fontSize: u(9), color: MUTED }}>
44
+ <Glyph id="search" size={10} color={MUTED} />
45
+ {t(UI.searchBook, lang)}
46
+ </div>
47
+ <Btn icon="plus" tone={colors.tone} size={9}>
48
+ {t(UI.newRecipe, lang)}
49
+ </Btn>
50
+ </div>
51
+ <div style={{ display: "flex", gap: u(5), marginTop: u(10) }}>
52
+ {[UI.all(cards.length), UI.seasonFilter, UI.official, UI.toTry].map((f, i) => (
53
+ <span key={i} style={{ padding: `${u(2.5)} ${u(9)}`, borderRadius: u(20), fontSize: u(8.6), background: i ? "transparent" : APP.accent, color: i ? MUTED : APP.accentInk, boxShadow: `inset 0 0 0 1px ${i ? APP.border : hexAlpha(colors.tone, 0.35)}` }}>
54
+ {t(f, lang)}
55
+ </span>
56
+ ))}
57
+ </div>
58
+ {cards.map((c, i) => (
59
+ <Card key={t(c.title, "fr")} lang={lang} card={c} x={(i % 4) * (COL + GAP)} y={GRID_TOP + Math.floor(i / 4) * (CARD_H + GAP)} fresh={added && c === FROM_PHOTO} />
60
+ ))}
61
+ </AppShell>
62
+ </AppWindow>
63
+
64
+ <Float x={34} y={168} w={146} depth={150} show={step >= 1 && step <= 4} style={{ borderRadius: 0, boxShadow: "none", overflow: "visible" }}>
65
+ <BookPage lang={lang} />
66
+ </Float>
67
+
68
+ <Float x={28} y={338} w={226} depth={90} show={step >= 1 && step <= 4}>
69
+ <Thread lang={lang} colors={colors}>
70
+ <Bubble from="you" tone={colors.tone}>
71
+ <span style={{ display: "flex", alignItems: "center", gap: u(5) }}>
72
+ <Glyph id="camera" size={10} color="#ffffff" />
73
+ {t(THREAD.page, lang)}
74
+ </span>
75
+ </Bubble>
76
+ <div style={{ display: step >= 2 ? "flex" : "none" }}>
77
+ <Chip icon="book" done={step >= 3}>
78
+ {t(THREAD.readPage, lang)}
79
+ </Chip>
80
+ </div>
81
+ <div style={{ display: step >= 4 ? "flex" : "none", justifyContent: "center" }}>
82
+ <Pill kind="done" size={8.4}>
83
+ {t(THREAD.added, lang)}
84
+ </Pill>
85
+ </div>
86
+ </Thread>
87
+ </Float>
88
+ </Stage>
89
+ )
90
+ }
91
+
92
+ /** A recipe of the cookbook. Cards slide to their place when one is added before them. */
93
+ function Card({ lang, card: c, x, y, fresh }: { lang: Lang; card: BookCard; x: number; y: number; fresh: boolean }) {
94
+ return (
95
+ <div
96
+ style={{
97
+ position: "absolute",
98
+ left: 0,
99
+ top: 0,
100
+ width: u(COL),
101
+ height: u(CARD_H),
102
+ transform: `translate(${u(x)}, ${u(y)})`,
103
+ transition: "transform 0.6s cubic-bezier(0.3, 0.7, 0.2, 1)",
104
+ borderRadius: u(9),
105
+ overflow: "hidden",
106
+ background: APP.card,
107
+ boxShadow: fresh ? `0 0 0 ${u(1.5)} ${APP.green}, 0 ${u(10)} ${u(24)} ${u(-10)} rgba(0,0,0,0.35)` : `0 0 0 1px ${APP.border}`,
108
+ }}
109
+ >
110
+ <Painting src={c.painting} w="100%" h={98} radius={0}>
111
+ <span style={{ position: "absolute", top: u(6), left: u(6) }}>{c.season && <Pill kind="season" size={7.4}>{t(UI.inSeason, lang)}</Pill>}</span>
112
+ <span style={{ position: "absolute", top: u(6), right: u(6) }}>
113
+ <Pill kind={c.badge} size={7.4}>
114
+ {t(c.badge === "official" ? UI.official : UI.toTry, lang)}
115
+ </Pill>
116
+ </span>
117
+ <span style={{ position: "absolute", bottom: u(6), left: u(6), display: "flex", alignItems: "center", gap: u(3), padding: `${u(1)} ${u(5)}`, borderRadius: u(20), background: "rgba(255,255,255,0.88)", fontSize: u(7.6) }}>
118
+ <Glyph id="clock" size={8} />
119
+ {c.time}
120
+ </span>
121
+ </Painting>
122
+ <div style={{ padding: `${u(7)} ${u(9)}` }}>
123
+ <div style={{ fontFamily: FONT.display, fontSize: u(10.4), lineHeight: 1.2, height: u(25), overflow: "hidden" }}>{t(c.title, lang)}</div>
124
+ <div style={{ display: "flex", alignItems: "center", gap: u(4), marginTop: u(5), fontSize: u(7.6), color: MUTED, whiteSpace: "nowrap" }}>
125
+ {t(c.cat, lang)}
126
+ <Glyph id="people" size={8} color={MUTED} />4
127
+ <span style={{ marginLeft: "auto" }}>{t(c.menu ?? UI.neverUsed, lang)}</span>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ )
132
+ }
133
+
134
+ /** The photographed page: a recipe in a book, its title and its lines. */
135
+ function BookPage({ lang }: { lang: Lang }) {
136
+ const line = (w: number, i: number) => <div key={i} style={{ height: u(3), width: `${w}%`, marginTop: u(4), borderRadius: u(2), background: "#d6cbbb" }} />
137
+ return (
138
+ <div style={{ transform: "rotate(3deg)", filter: `drop-shadow(0 ${u(14)} ${u(16)} rgba(0,0,0,0.4))` }}>
139
+ <div style={{ padding: u(11), background: "#fbf6ec", borderRadius: u(2), color: "#4a3f35" }}>
140
+ <div style={{ fontFamily: FONT.display, fontSize: u(11), lineHeight: 1.15 }}>{t(FROM_PHOTO.title, lang)}</div>
141
+ <div style={{ marginTop: u(3), fontSize: u(6.6), letterSpacing: "0.12em", textTransform: "uppercase", color: "#9a8b7a" }}>4 · 35 min</div>
142
+ <div style={{ display: "flex", gap: u(8), marginTop: u(6) }}>
143
+ <div style={{ flex: 1 }}>{[90, 70, 84, 60, 76].map(line)}</div>
144
+ <div style={{ flex: 1.4 }}>{[100, 94, 98, 66, 100, 88, 72].map(line)}</div>
145
+ </div>
146
+ </div>
147
+ </div>
148
+ )
149
+ }
@@ -0,0 +1,159 @@
1
+ "use client"
2
+
3
+ import { FONT, hexAlpha } from "../../../theme"
4
+ import { AppWindow, Float, MUTED, Stage, u, useStage, type StageColors } from "../stage"
5
+ import { AppShell, Bubble, Chip, eur, Glyph, num, Painting, Pill, ROOM, t, Thread, WIN, type Lang } from "./parts"
6
+ import { APP, CUPBOARDS, FRIDGE, RECEIPT, THREAD, UI, type StockRow } from "./sample"
7
+
8
+ /* The Stock page, back from the shops: a photo of the receipt goes to the assistant, it reads it, and the pantry
9
+ fills — the milk, the eggs, the lentils and the penne go up, their « à racheter » goes, and the figures on top follow.
10
+
11
+ Drawn from app/src/views/stock.jsx (the four figures, « Dans la cuisine », a row per item with its painting and
12
+ its − qty + ) — what the page itself says it is for: « les courses (photo du ticket) ». */
13
+
14
+ const H = 560
15
+ const STILL = 5
16
+ /* 0 rest · 1 the receipt · 2 it reads · 3 milk and eggs · 4 lentils and penne · 5 the figures follow · 6 the panel closes · 7 rest */
17
+ const LENGTHS = [1200, 1500, 1300, 750, 750, 3200, 500, 900] as const
18
+
19
+ const ROW = 35
20
+ const ALL = [...FRIDGE, ...CUPBOARDS]
21
+ const value = (rows: StockRow[], after: boolean) => rows.reduce((s, r) => s + (after ? r.after : r.qty) * r.price, 0)
22
+
23
+ export function PantryScreen({ lang, colors, night, label }: { lang: Lang; colors: StageColors; night: boolean; label: string }) {
24
+ const { ref, step } = useStage(LENGTHS, STILL)
25
+ // Which rows have taken in the shopping: the fridge's at step 3, the cupboards' at step 4.
26
+ const stocked = (r: StockRow) => r.after !== r.qty && ((step >= 3 && step <= 6 && FRIDGE.includes(r)) || (step >= 4 && step <= 6))
27
+ const done = step >= 5 && step <= 6
28
+ const low = ALL.filter((r) => (r.low || r.out) && !stocked(r))
29
+ const tiles = [
30
+ { label: UI.value, value: eur(Math.round(value(ALL, done)), lang), hint: t(UI.items(ALL.length), lang) },
31
+ { label: UI.rebuy, value: String(low.length), hint: low.length ? low.map((r) => t(r.name, lang)).join(", ") : "—", red: low.length > 0 },
32
+ { label: UI.in30, value: done ? eur(13.5, lang) : eur(0, lang), hint: t(UI.in30Hint, lang) },
33
+ { label: UI.out30, value: eur(2, lang), hint: t(UI.out30Hint, lang) },
34
+ ]
35
+ const TW = (ROOM - 8 * 3) / 4
36
+
37
+ return (
38
+ <Stage stageRef={ref} colors={colors} night={night} height={H} label={label}>
39
+ <AppWindow {...WIN} h={H} address="foyer.spunto.net/app/#/stock">
40
+ <AppShell lang={lang} colors={colors} active={2} title={t(UI.pantry, lang)}>
41
+ {tiles.map((x, i) => (
42
+ <div key={i} style={{ position: "absolute", left: u(i * (TW + 8)), top: 0, width: u(TW), height: u(62), padding: `${u(8)} ${u(10)}`, borderRadius: u(8), background: APP.muted, boxShadow: `0 0 0 1px ${APP.border}` }}>
43
+ <div style={{ fontSize: u(8.4), color: MUTED }}>{t(x.label, lang)}</div>
44
+ <div style={{ marginTop: u(2), fontFamily: FONT.display, fontSize: u(16), color: x.red ? APP.red : undefined, transition: "color 0.3s ease" }}>{x.value}</div>
45
+ <div style={{ fontSize: u(7.8), color: MUTED, whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{x.hint}</div>
46
+ </div>
47
+ ))}
48
+
49
+ <div style={{ position: "absolute", left: 0, top: u(72), width: u(ROOM), bottom: u(-20), padding: `${u(12)} ${u(14)}`, borderRadius: u(10), background: APP.card, boxShadow: `0 0 0 1px ${APP.border}` }}>
50
+ <div style={{ fontFamily: FONT.display, fontSize: u(12) }}>{t(UI.kitchen, lang)}</div>
51
+ <div style={{ marginTop: u(3), maxWidth: u(440), fontSize: u(8.4), color: MUTED }}>{t(UI.kitchenSub, lang)}</div>
52
+ <div style={{ display: "flex", alignItems: "center", gap: u(6), height: u(22), marginTop: u(9), padding: `0 ${u(8)}`, borderRadius: u(5), boxShadow: `inset 0 0 0 1px ${APP.border}`, fontSize: u(9), color: MUTED }}>
53
+ <Glyph id="search" size={10} color={MUTED} />
54
+ {t(UI.search, lang)}
55
+ </div>
56
+ <div style={{ display: "flex", gap: u(5), marginTop: u(8) }}>
57
+ {UI.filters.map((f, i) => (
58
+ <span key={i} style={{ padding: `${u(2.5)} ${u(9)}`, borderRadius: u(20), fontSize: u(8.6), background: i ? "transparent" : APP.accent, color: i ? MUTED : APP.accentInk, boxShadow: `inset 0 0 0 1px ${i ? APP.border : hexAlpha(colors.tone, 0.35)}` }}>
59
+ {t(f, lang)}
60
+ </span>
61
+ ))}
62
+ </div>
63
+ <Shelf lang={lang} title={`${t(UI.fridge, lang)} · ${FRIDGE.length}`} rows={FRIDGE} stocked={stocked} />
64
+ <Shelf lang={lang} title={`${t(UI.cupboards, lang)} · ${CUPBOARDS.length}`} rows={CUPBOARDS} stocked={stocked} />
65
+ </div>
66
+ </AppShell>
67
+ </AppWindow>
68
+
69
+ <Float x={36} y={150} w={150} depth={150} show={step >= 1 && step <= 5} style={{ borderRadius: 0, boxShadow: "none", overflow: "visible" }}>
70
+ <Receipt />
71
+ </Float>
72
+
73
+ <Float x={30} y={392} w={214} depth={90} show={step >= 1 && step <= 5}>
74
+ <Thread lang={lang} colors={colors}>
75
+ <Bubble from="you" tone={colors.tone}>
76
+ <span style={{ display: "flex", alignItems: "center", gap: u(5) }}>
77
+ <Glyph id="camera" size={10} color="#ffffff" />
78
+ {t(THREAD.receipt, lang)}
79
+ </span>
80
+ </Bubble>
81
+ <div style={{ display: step >= 2 ? "flex" : "none" }}>
82
+ <Chip icon="camera" done={step >= 3}>
83
+ {t(THREAD.readReceipt, lang)}
84
+ </Chip>
85
+ </div>
86
+ <div style={{ display: done ? "flex" : "none", justifyContent: "center" }}>
87
+ <Pill kind="done" size={8.8}>
88
+ {t(THREAD.stocked, lang)}
89
+ </Pill>
90
+ </div>
91
+ </Thread>
92
+ </Float>
93
+ </Stage>
94
+ )
95
+ }
96
+
97
+ function Shelf({ lang, title, rows, stocked }: { lang: Lang; title: string; rows: StockRow[]; stocked: (r: StockRow) => boolean }) {
98
+ return (
99
+ <div style={{ marginTop: u(10) }}>
100
+ <div style={{ padding: `0 ${u(4)} ${u(4)}`, borderBottom: `1px solid ${APP.border}`, fontSize: u(8.2), letterSpacing: "0.06em", textTransform: "uppercase", color: MUTED }}>{title}</div>
101
+ {rows.map((r, i) => {
102
+ const on = stocked(r)
103
+ const qty = on ? r.after : r.qty
104
+ return (
105
+ <div key={i} style={{ display: "flex", alignItems: "center", gap: u(9), height: u(ROW), padding: `0 ${u(4)}` }}>
106
+ <Painting src={r.painting} w={28} h={28} radius={6} />
107
+ <div style={{ minWidth: 0, flex: 1 }}>
108
+ <div style={{ fontSize: u(9.6), fontWeight: 500 }}>{t(r.name, lang)}</div>
109
+ <div style={{ display: "flex", alignItems: "center", gap: u(5), fontSize: u(8), color: MUTED }}>
110
+ {t(r.unit, lang)}
111
+ {(r.low || r.out) && !on && <Pill kind="low" size={7.4}>{t(UI.rebuyBadge, lang)}</Pill>}
112
+ </div>
113
+ </div>
114
+ <span style={{ width: u(34), textAlign: "right", fontSize: u(9), fontWeight: 600, color: APP.green, opacity: on ? 1 : 0, transform: on ? "none" : `translateY(${u(4)})`, transition: "opacity 0.3s ease, transform 0.4s ease" }}>
115
+ +{num(r.after - r.qty, lang)}
116
+ </span>
117
+ <span style={{ display: "flex", alignItems: "center", gap: u(8), fontSize: u(9.6) }}>
118
+ <Glyph id="minus" size={10} color={MUTED} />
119
+ <span style={{ width: u(26), textAlign: "center", fontWeight: 600, fontVariantNumeric: "tabular-nums" }}>{num(qty, lang)}</span>
120
+ <Glyph id="plus" size={10} color={MUTED} />
121
+ </span>
122
+ <span style={{ width: u(44), textAlign: "right", fontSize: u(8.8), color: MUTED, fontVariantNumeric: "tabular-nums" }}>{eur(Math.round(qty * r.price * 100) / 100, lang)}</span>
123
+ </div>
124
+ )
125
+ })}
126
+ </div>
127
+ )
128
+ }
129
+
130
+ /** The till receipt, as it was photographed: a strip of thermal paper, its torn edge. */
131
+ function Receipt() {
132
+ return (
133
+ <div style={{ transform: "rotate(-3deg)", filter: `drop-shadow(0 ${u(14)} ${u(16)} rgba(0,0,0,0.4))` }}>
134
+ <div
135
+ style={{
136
+ padding: `${u(10)} ${u(10)} ${u(16)}`,
137
+ background: "#ffffff",
138
+ color: "#57534e",
139
+ fontFamily: FONT.mono,
140
+ fontSize: u(7.6),
141
+ lineHeight: 1.55,
142
+ clipPath: "polygon(0 0, 100% 0, 100% calc(100% - 6px), 92% 100%, 84% calc(100% - 6px), 76% 100%, 68% calc(100% - 6px), 60% 100%, 52% calc(100% - 6px), 44% 100%, 36% calc(100% - 6px), 28% 100%, 20% calc(100% - 6px), 12% 100%, 4% calc(100% - 6px), 0 100%)",
143
+ }}
144
+ >
145
+ <div style={{ marginBottom: u(6), textAlign: "center", fontWeight: 700, letterSpacing: "0.12em" }}>{RECEIPT.shop}</div>
146
+ {RECEIPT.lines.map(([a, b]) => (
147
+ <div key={a} style={{ display: "flex", justifyContent: "space-between", gap: u(6) }}>
148
+ <span style={{ whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis" }}>{a}</span>
149
+ <span>{b}</span>
150
+ </div>
151
+ ))}
152
+ <div style={{ display: "flex", justifyContent: "space-between", marginTop: u(6), paddingTop: u(3), borderTop: "1px dashed #a8a29e", fontWeight: 700 }}>
153
+ <span>TOTAL</span>
154
+ <span>{RECEIPT.total}</span>
155
+ </div>
156
+ </div>
157
+ </div>
158
+ )
159
+ }
@@ -0,0 +1,226 @@
1
+ "use client"
2
+
3
+ import type { CSSProperties, ReactNode } from "react"
4
+ import type { Words } from "../../../facts"
5
+ import { FONT, hexAlpha } from "../../../theme"
6
+ import { INK, MUTED, u, type StageColors } from "../stage"
7
+ import { APP, UI } from "./sample"
8
+
9
+ /* What the Foyer screens share: the app's shell (sidebar, page head), its paintings, its badges and icons.
10
+ Positions are the window's design pixels. */
11
+
12
+ export type Lang = "en" | "fr"
13
+ export const t = (x: Words, lang: Lang) => x[lang]
14
+
15
+ /** The app's window on the 920-wide board. */
16
+ export const WIN = { x: 24, y: 30, w: 872 }
17
+ export const SIDEBAR = 150
18
+ export const PAD = 18
19
+ export const ROOM = WIN.w - SIDEBAR - PAD * 2
20
+
21
+ /** The app's icons (lucide, as the app draws them: 24 × 24 strokes). */
22
+ const ICON = {
23
+ utensils: "M3 2v7c0 1.1.9 2 2 2h4a2 2 0 0 0 2-2V2M7 2v20M21 15V2a5 5 0 0 0-5 5v6c0 1.1.9 2 2 2h3zM21 15v7",
24
+ book: "M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2zM22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z",
25
+ fridge: "M5 6a4 4 0 0 1 4-4h6a4 4 0 0 1 4 4v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2zM5 10h14M15 7v6",
26
+ list: "M3 17l2 2l4-4M3 7l2 2l4-4M13 6h8M13 12h8M13 18h8",
27
+ bot: "M12 8V4H8M4 8h16v12H4zM2 14h2M20 14h2M15 13v2M9 13v2",
28
+ house: "M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8M3 10a2 2 0 0 1 .7-1.5l7-6a2 2 0 0 1 2.6 0l7 6A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",
29
+ sparkles: "M9.9 15.5A2 2 0 0 0 8.5 14.1L2.4 12.5a.5.5 0 0 1 0-1l6.1-1.6A2 2 0 0 0 9.9 8.5l1.6-6.1a.5.5 0 0 1 1 0l1.6 6.1a2 2 0 0 0 1.4 1.4l6.1 1.6a.5.5 0 0 1 0 1l-6.1 1.6a2 2 0 0 0-1.4 1.4l-1.6 6.1a.5.5 0 0 1-1 0z",
30
+ camera: "M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3zM12 10a3 3 0 1 0 0 6a3 3 0 0 0 0-6z",
31
+ leaf: "M11 20A7 7 0 0 1 9.8 6.1C15.5 5 17 4.5 19 2c1 2 2 4.2 2 8c0 5.5-4.8 10-10 10zM2 21c0-3 1.9-5.4 5.1-6",
32
+ clock: "M12 3a9 9 0 1 0 0 18a9 9 0 0 0 0-18zM12 7v5l3 2",
33
+ check: "M5 12.5l4.5 4.5L19 7.5",
34
+ chef: "M17 21a1 1 0 0 0 1-1v-5.4a1 1 0 0 1 .6-.9A4 4 0 0 0 17.1 6a5 5 0 0 0-10.2 0A4 4 0 0 0 5.4 13.7a1 1 0 0 1 .6.9V20a1 1 0 0 0 1 1zM6 17h12",
35
+ people: "M9 5a3.5 3.5 0 1 0 0 7a3.5 3.5 0 0 0 0-7zM3 20a6 6 0 0 1 12 0M16 5.4a3.5 3.5 0 0 1 0 6.3M18 14.6a6 6 0 0 1 3 5.4",
36
+ sun: "M12 8a4 4 0 1 0 0 8a4 4 0 0 0 0-8zM12 2v2M12 20v2M4.9 4.9l1.4 1.4M17.7 17.7l1.4 1.4M2 12h2M20 12h2M6.3 17.7l-1.4 1.4M19.1 4.9l-1.4 1.4",
37
+ moon: "M12 3a6 6 0 0 0 9 9a9 9 0 1 1-9-9z",
38
+ search: "M11 4a7 7 0 1 0 0 14a7 7 0 0 0 0-14zM20 20l-3.5-3.5",
39
+ plus: "M12 5v14M5 12h14",
40
+ minus: "M5 12h14",
41
+ chevron: "M6 9l6 6l6-6",
42
+ mic: "M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3zM19 10v2a7 7 0 0 1-14 0v-2M12 19v3",
43
+ paperclip: "M13.2 6.8l-6.4 6.4a2.5 2.5 0 0 0 3.5 3.5l7.1-7.1a4.5 4.5 0 0 0-6.4-6.4l-7.1 7.1a6.5 6.5 0 0 0 9.2 9.2l6.4-6.4",
44
+ } as const
45
+
46
+ export type FoyerIcon = keyof typeof ICON
47
+
48
+ export function Glyph({ id, size = 12, color = "currentColor", width = 1.8, style }: { id: FoyerIcon; size?: number; color?: string; width?: number; style?: CSSProperties }) {
49
+ return (
50
+ <svg viewBox="0 0 24 24" fill="none" stroke={color} strokeWidth={width} strokeLinecap="round" strokeLinejoin="round" style={{ display: "block", flexShrink: 0, width: u(size), height: u(size), ...style }}>
51
+ <path d={ICON[id]} />
52
+ </svg>
53
+ )
54
+ }
55
+
56
+ /** One of the app's paintings, on its cream, cropped like the app crops it (object-fit: cover). */
57
+ export function Painting({ src, w, h, radius = 8, style, children }: { src: string; w: number | string; h: number | string; radius?: number; style?: CSSProperties; children?: ReactNode }) {
58
+ return (
59
+ <span style={{ position: "relative", display: "block", flexShrink: 0, width: typeof w === "number" ? u(w) : w, height: typeof h === "number" ? u(h) : h, borderRadius: u(radius), overflow: "hidden", background: APP.illus, ...style }}>
60
+ <img src={src} alt="" loading="lazy" decoding="async" draggable={false} style={{ display: "block", width: "100%", height: "100%", objectFit: "cover" }} />
61
+ {children}
62
+ </span>
63
+ )
64
+ }
65
+
66
+ /** Foyer's mark: Spunto's `mark` variant on its tile, in the product's colours (app/src/components/logo.jsx:
67
+ `SpuntoLogo tone="product" variant="mark"` — the shapes of design-system/src/brand/logo.ts). */
68
+ export function FoyerMark({ size = 16, colors }: { size?: number; colors: StageColors }) {
69
+ return (
70
+ <svg viewBox="0 0 128 128" style={{ display: "block", flexShrink: 0, width: u(size), height: u(size) }}>
71
+ <rect width="128" height="128" rx="14" fill={colors.signal} />
72
+ <path d="M18 18h72v14H32v58H18zM110 110H38V96h58V38h14z" fill={colors.field} />
73
+ <circle cx="64" cy="64" r="18" fill={colors.field} />
74
+ </svg>
75
+ )
76
+ }
77
+
78
+ /** A rounded label: « De saison » (green, filled), « Officielle » / « À tester » (outlined), « à racheter » (amber). */
79
+ export function Pill({ kind, children, size = 8.4 }: { kind: "season" | "official" | "toTry" | "low" | "today" | "done"; children: ReactNode; size?: number }) {
80
+ const look: Record<typeof kind, CSSProperties> = {
81
+ season: { background: APP.green, color: "#ffffff" },
82
+ official: { background: "#ffffff", color: APP.green, boxShadow: `inset 0 0 0 1px ${hexAlpha(APP.green, 0.5)}` },
83
+ toTry: { background: "#ffffff", color: MUTED, boxShadow: `inset 0 0 0 1px ${APP.border}` },
84
+ low: { background: hexAlpha(APP.amber, 0.14), color: APP.amber },
85
+ today: { background: APP.accent, color: APP.accentInk },
86
+ done: { background: hexAlpha(APP.green, 0.13), color: APP.green },
87
+ }
88
+ return (
89
+ <span style={{ display: "inline-flex", alignItems: "center", gap: u(3), padding: `${u(1.5)} ${u(6)}`, borderRadius: u(20), fontSize: u(size), fontWeight: 550, whiteSpace: "nowrap", lineHeight: 1.3, ...look[kind] }}>
90
+ {kind === "season" && <Glyph id="leaf" size={size} color="#ffffff" width={2.2} />}
91
+ {kind === "done" && <Glyph id="check" size={size} color={APP.green} width={2.4} />}
92
+ {children}
93
+ </span>
94
+ )
95
+ }
96
+
97
+ /** A button as the app draws it: filled in the product's colour, or outlined. */
98
+ export function Btn({ icon, children, tone, outline, pressed, size = 10 }: { icon?: FoyerIcon; children: ReactNode; tone: string; outline?: boolean; pressed?: boolean; size?: number }) {
99
+ return (
100
+ <span
101
+ style={{
102
+ display: "inline-flex",
103
+ alignItems: "center",
104
+ gap: u(5),
105
+ height: u(size * 2.5),
106
+ padding: `0 ${u(size)}`,
107
+ borderRadius: u(5),
108
+ fontSize: u(size),
109
+ fontWeight: 550,
110
+ whiteSpace: "nowrap",
111
+ background: outline ? "#ffffff" : tone,
112
+ color: outline ? INK : "#ffffff",
113
+ boxShadow: outline ? `inset 0 0 0 1px ${APP.border}` : "none",
114
+ transform: pressed ? "scale(0.95)" : "none",
115
+ transition: "transform 0.15s ease",
116
+ }}
117
+ >
118
+ {icon && <Glyph id={icon} size={size * 1.15} color={outline ? INK : "#ffffff"} />}
119
+ {children}
120
+ </span>
121
+ )
122
+ }
123
+
124
+ /** The four people at the table: their initials, as the app draws faces without a photo. */
125
+ export function Faces({ size = 14 }: { size?: number }) {
126
+ const people: [string, string][] = [["C", "#f6c9c4"], ["S", "#c9dbef"], ["L", "#d4e5cf"], ["J", "#f5dcb3"]]
127
+ return (
128
+ <span style={{ display: "inline-flex" }}>
129
+ {people.map(([l, bg], i) => (
130
+ <span key={l} style={{ display: "grid", placeItems: "center", width: u(size), height: u(size), marginLeft: i ? u(-size * 0.3) : 0, borderRadius: "50%", background: bg, boxShadow: `0 0 0 ${u(1.5)} #ffffff`, fontSize: u(size * 0.5), fontWeight: 600, color: "#7a3b2e" }}>
131
+ {l}
132
+ </span>
133
+ ))}
134
+ </span>
135
+ )
136
+ }
137
+
138
+ const NAV_ICON: FoyerIcon[] = ["utensils", "book", "fridge", "list", "bot", "house"]
139
+
140
+ /** The sidebar and the head of the page. `active`: the page's index in the nav. */
141
+ export function AppShell({ lang, colors, active, title, children }: { lang: Lang; colors: StageColors; active: number; title: string; children: ReactNode }) {
142
+ return (
143
+ <div style={{ position: "absolute", inset: 0, background: APP.bg }}>
144
+ <div style={{ position: "absolute", left: 0, top: 0, bottom: 0, width: u(SIDEBAR), background: APP.sidebar, borderRight: `1px solid ${APP.border}` }}>
145
+ <div style={{ display: "flex", alignItems: "center", gap: u(7), margin: `${u(14)} ${u(12)} 0`, fontFamily: FONT.display, fontSize: u(13), whiteSpace: "nowrap" }}>
146
+ <FoyerMark size={18} colors={colors} />
147
+ Foyer
148
+ </div>
149
+ <div style={{ display: "flex", alignItems: "center", gap: u(6), height: u(26), margin: `${u(13)} ${u(9)} 0`, padding: `0 ${u(8)}`, border: `1px solid ${APP.border}`, borderRadius: u(5), background: APP.card, fontSize: u(10.4) }}>
150
+ <Glyph id="house" size={11} color={MUTED} />
151
+ <span style={{ flex: 1, textAlign: "center" }}>{UI.household}</span>
152
+ <Glyph id="chevron" size={10} color={MUTED} />
153
+ </div>
154
+ <div style={{ margin: `${u(12)} ${u(9)} 0`, display: "flex", flexDirection: "column", gap: u(2) }}>
155
+ {UI.nav.map((label, i) => (
156
+ <div key={i} style={{ display: "flex", alignItems: "center", gap: u(7), height: u(23), padding: `0 ${u(7)}`, borderRadius: u(5), background: i === active ? APP.accent : "transparent", fontSize: u(10.4), color: i === active ? APP.accentInk : MUTED, whiteSpace: "nowrap" }}>
157
+ <Glyph id={NAV_ICON[i]} size={11} color={i === active ? colors.tone : MUTED} />
158
+ {t(label, lang)}
159
+ </div>
160
+ ))}
161
+ </div>
162
+ </div>
163
+ <div style={{ position: "absolute", left: u(SIDEBAR + PAD), right: u(PAD), top: u(12), display: "flex", alignItems: "center" }}>
164
+ <span style={{ fontFamily: FONT.display, fontSize: u(19), letterSpacing: "-0.01em" }}>{title}</span>
165
+ <span style={{ marginLeft: "auto" }}>
166
+ <Btn icon="bot" tone={colors.tone} size={9}>
167
+ {t(UI.assistant, lang)}
168
+ </Btn>
169
+ </span>
170
+ </div>
171
+ <div style={{ position: "absolute", left: u(SIDEBAR + PAD), top: u(50), width: u(ROOM), bottom: 0 }}>{children}</div>
172
+ </div>
173
+ )
174
+ }
175
+
176
+ /** A card of the assistant's thread, floating over the page: the panel the « Assistant » button opens. */
177
+ export function Thread({ lang, colors, children }: { lang: Lang; colors: StageColors; children: ReactNode }) {
178
+ return (
179
+ <div style={{ background: APP.card }}>
180
+ <div style={{ display: "flex", alignItems: "center", gap: u(6), padding: `${u(8)} ${u(11)}`, borderBottom: `1px solid ${APP.border}`, fontSize: u(10), fontWeight: 600 }}>
181
+ <Glyph id="bot" size={12} color={colors.tone} />
182
+ {t(UI.assistant, lang)}
183
+ <span style={{ marginLeft: "auto", fontWeight: 450, color: MUTED, fontSize: u(9) }}>{t(UI.todayTab, lang)}</span>
184
+ </div>
185
+ <div style={{ display: "flex", flexDirection: "column", gap: u(7), padding: u(10), fontSize: u(10), lineHeight: 1.4 }}>{children}</div>
186
+ </div>
187
+ )
188
+ }
189
+
190
+ /** A line of the thread: what someone at home says (right, in the product's colour), or the assistant (left). */
191
+ export function Bubble({ from, tone, show = true, children }: { from: "you" | "agent"; tone: string; show?: boolean; children: ReactNode }) {
192
+ if (!show) return null
193
+ return (
194
+ <div
195
+ style={{
196
+ alignSelf: from === "you" ? "flex-end" : "flex-start",
197
+ maxWidth: "88%",
198
+ padding: `${u(6)} ${u(9)}`,
199
+ borderRadius: from === "you" ? `${u(11)} ${u(11)} ${u(3)} ${u(11)}` : `${u(11)} ${u(11)} ${u(11)} ${u(3)}`,
200
+ background: from === "you" ? tone : APP.muted,
201
+ color: from === "you" ? "#ffffff" : INK,
202
+ }}
203
+ >
204
+ {children}
205
+ </div>
206
+ )
207
+ }
208
+
209
+ /** What the assistant is doing: « Lit le stock », pulsing, then ticked. */
210
+ export function Chip({ icon, done, show = true, children }: { icon: FoyerIcon; done: boolean; show?: boolean; children: ReactNode }) {
211
+ if (!show) return null
212
+ return (
213
+ <span style={{ display: "inline-flex", alignItems: "center", gap: u(4), padding: `${u(2)} ${u(7)}`, borderRadius: u(20), fontSize: u(8.8), color: done ? APP.green : MUTED, boxShadow: `inset 0 0 0 1px ${done ? hexAlpha(APP.green, 0.4) : APP.border}`, transition: "color 0.3s ease" }}>
214
+ <Glyph id={done ? "check" : icon} size={9} color={done ? APP.green : MUTED} width={2.2} />
215
+ {children}
216
+ </span>
217
+ )
218
+ }
219
+
220
+ /** French numbers in French, English ones in English: 0,5 / 0.5. */
221
+ export const num = (n: number, lang: Lang) => n.toLocaleString(lang === "fr" ? "fr-FR" : "en-GB", { maximumFractionDigits: 2 })
222
+ /** An amount: whole euros bare, cents always two digits (13,50 €). */
223
+ export const eur = (n: number, lang: Lang) => {
224
+ const v = n.toLocaleString(lang === "fr" ? "fr-FR" : "en-GB", Number.isInteger(n) ? { maximumFractionDigits: 0 } : { minimumFractionDigits: 2, maximumFractionDigits: 2 })
225
+ return lang === "fr" ? `${v} €` : `€${v}`
226
+ }