@spunto/brand-kit 0.8.0 → 0.9.0
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.
- package/package.json +1 -1
- package/src/home/editions/desktop.json +386 -0
- package/src/home/editions.ts +1 -1
- package/src/home/home.tsx +3 -1
- package/src/home/showcase/catalog.ts +35 -3
- package/src/home/showcase/desktop/desk.tsx +195 -0
- package/src/home/showcase/desktop/drive.tsx +71 -0
- package/src/home/showcase/desktop/handoff.tsx +94 -0
- package/src/home/showcase/desktop/launcher.tsx +161 -0
- package/src/home/showcase/desktop/parts.tsx +388 -0
- package/src/home/showcase/desktop/sample.ts +157 -0
- package/src/home/showcase/desktop/wall.tsx +85 -0
- package/src/home/showcase/stage.tsx +17 -5
- package/src/home/showcase/view.tsx +8 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import type { CSSProperties, ReactNode } from "react"
|
|
4
|
+
import { FONT, hexAlpha } from "../../../theme"
|
|
5
|
+
import { u } from "../stage"
|
|
6
|
+
import { DESK, UI, WALLPAPER } from "./sample"
|
|
7
|
+
|
|
8
|
+
/* A desktop's screen, as the image dresses it (desktop/branding): the wallpaper and its signature, the
|
|
9
|
+
windows of the « Spunto » xfwm4 theme, the browser, the taskbar with the lease's state.
|
|
10
|
+
|
|
11
|
+
It is drawn once, on a screen of 480 × 270 design pixels — a 16:9 screen like the captures', its
|
|
12
|
+
interface larger than life so that it reads — and scaled to the width it is given: the same drawing
|
|
13
|
+
is a thumbnail on the wall of desktops and the whole window when the desktop is open. */
|
|
14
|
+
|
|
15
|
+
export const SCREEN = { w: 480, h: 270 }
|
|
16
|
+
/** The taskbar's height: windows live above it. */
|
|
17
|
+
export const BAR = 15
|
|
18
|
+
|
|
19
|
+
export type Held = { kind: "agent" | "human"; holder: string; minutes: number } | null
|
|
20
|
+
|
|
21
|
+
export type TaskWindow = { icon: "browser" | "terminal" | "launcher"; title: string; active?: boolean }
|
|
22
|
+
|
|
23
|
+
/** The Spunto mark (desktop/branding/spunto.svg): on the desktop in the image's colours, on a tile where it is an icon. */
|
|
24
|
+
export function SpuntoMark({ size, tile, ink = DESK.signal, alt = DESK.lavender, style }: { size: number; tile?: string; ink?: string; alt?: string; style?: CSSProperties }) {
|
|
25
|
+
return (
|
|
26
|
+
<svg viewBox="0 0 128 128" style={{ display: "block", flexShrink: 0, width: u(size), height: u(size), ...style }}>
|
|
27
|
+
{tile && <rect width="128" height="128" rx="14" fill={tile} />}
|
|
28
|
+
<path d="M31 31h52v10H41v42H31zM97 97H45V87h42V45h10z" fill={ink} />
|
|
29
|
+
<circle cx="64" cy="64" r="13" fill={ink} />
|
|
30
|
+
{[45, 59, 73].map((n) => (
|
|
31
|
+
<g key={n}>
|
|
32
|
+
<rect x={n} y="17" width="10" height="10" fill={alt} />
|
|
33
|
+
<rect x="17" y={n} width="10" height="10" fill={alt} />
|
|
34
|
+
<circle cx="106" cy={n + 5} r="5" fill={ink} />
|
|
35
|
+
</g>
|
|
36
|
+
))}
|
|
37
|
+
<rect x="31" y="101" width="10" height="10" fill={alt} />
|
|
38
|
+
<circle cx="50" cy="106" r="5" fill={ink} />
|
|
39
|
+
<rect x="59" y="101" width="10" height="10" fill={alt} />
|
|
40
|
+
<circle cx="78" cy="106" r="5" fill={ink} />
|
|
41
|
+
</svg>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** The taskbar's launchers, drawn small: the browser's ring, a terminal, a folder. */
|
|
46
|
+
export function Glyph({ id, size }: { id: "browser" | "terminal" | "files" | "launcher"; size: number }) {
|
|
47
|
+
const box: CSSProperties = { display: "block", flexShrink: 0, width: u(size), height: u(size) }
|
|
48
|
+
if (id === "launcher") return <SpuntoMark size={size} tile={DESK.field} />
|
|
49
|
+
if (id === "browser")
|
|
50
|
+
return (
|
|
51
|
+
<svg viewBox="0 0 16 16" style={box}>
|
|
52
|
+
<circle cx="8" cy="8" r="7.2" fill="#4c8bf5" />
|
|
53
|
+
<circle cx="8" cy="8" r="3.6" fill="#e8f0fe" />
|
|
54
|
+
<circle cx="8" cy="8" r="2.4" fill="#2f6fe0" />
|
|
55
|
+
</svg>
|
|
56
|
+
)
|
|
57
|
+
if (id === "terminal")
|
|
58
|
+
return (
|
|
59
|
+
<svg viewBox="0 0 16 16" style={box}>
|
|
60
|
+
<rect x="1" y="2" width="14" height="12" rx="1.6" fill="#0e0a1b" stroke={DESK.muted} strokeWidth="0.9" />
|
|
61
|
+
<path d="M4 6l2.4 2L4 10M8 10.4h3.6" fill="none" stroke={DESK.text} strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round" />
|
|
62
|
+
</svg>
|
|
63
|
+
)
|
|
64
|
+
return (
|
|
65
|
+
<svg viewBox="0 0 16 16" style={box}>
|
|
66
|
+
<path d="M1.5 4.2c0-.7.5-1.2 1.2-1.2h3.4l1.4 1.6h5.8c.7 0 1.2.5 1.2 1.2v6.4c0 .7-.5 1.2-1.2 1.2H2.7c-.7 0-1.2-.5-1.2-1.2z" fill="#5c9cf0" />
|
|
67
|
+
<rect x="1.5" y="6.2" width="13" height="7.2" rx="1.2" fill="#8dbcf7" />
|
|
68
|
+
</svg>
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/** What the taskbar says of the lease (desktop/branding/panel-status): who holds the desktop and for how long, or that it is free. */
|
|
73
|
+
export function LeaseState({ name, held, size = 5 }: { name: string; held: Held; size?: number }) {
|
|
74
|
+
return (
|
|
75
|
+
<span style={{ display: "flex", alignItems: "center", gap: u(size * 0.7), fontSize: u(size), color: DESK.text, whiteSpace: "nowrap" }}>
|
|
76
|
+
<span style={{ width: u(size * 0.8), height: u(size * 0.8), borderRadius: "50%", background: held ? DESK.signal : DESK.free, transition: "background 0.4s ease" }} />
|
|
77
|
+
{held ? `${name} · ${held.kind === "human" ? "👤" : "🤖"} ${held.holder} · ${held.minutes} min` : `${name} · ${UI.taskbarFree}`}
|
|
78
|
+
</span>
|
|
79
|
+
)
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export function Taskbar({ name, held, windows = [], clock = "13/11 10:42" }: { name: string; held: Held; windows?: TaskWindow[]; clock?: string }) {
|
|
83
|
+
const rule = <span style={{ width: 1, height: u(8), background: "rgba(255,255,255,0.22)" }} />
|
|
84
|
+
return (
|
|
85
|
+
<div style={{ position: "absolute", left: 0, right: 0, bottom: 0, height: u(BAR), zIndex: 6, display: "flex", alignItems: "center", gap: u(5), padding: `0 ${u(5)}`, background: "#150f27", borderTop: `1px solid ${DESK.line}`, color: DESK.text }}>
|
|
86
|
+
<SpuntoMark size={8.5} tile={DESK.field} />
|
|
87
|
+
{rule}
|
|
88
|
+
<Glyph id="browser" size={7.5} />
|
|
89
|
+
<Glyph id="terminal" size={7.5} />
|
|
90
|
+
<Glyph id="files" size={7.5} />
|
|
91
|
+
{rule}
|
|
92
|
+
{windows.map((w, i) => (
|
|
93
|
+
<span key={i} style={{ display: "flex", alignItems: "center", gap: u(3.5), width: u(62), height: u(11), padding: `0 ${u(4)}`, borderRadius: u(2), background: w.active ? DESK.primary : "transparent", fontSize: u(5), overflow: "hidden", whiteSpace: "nowrap" }}>
|
|
94
|
+
<Glyph id={w.icon} size={6.5} />
|
|
95
|
+
<span style={{ overflow: "hidden", textOverflow: "ellipsis" }}>{w.title}</span>
|
|
96
|
+
</span>
|
|
97
|
+
))}
|
|
98
|
+
<span style={{ marginLeft: "auto" }} />
|
|
99
|
+
<LeaseState name={name} held={held} />
|
|
100
|
+
<svg viewBox="0 0 16 16" style={{ display: "block", width: u(8), height: u(8), marginLeft: u(4) }}>
|
|
101
|
+
<path d="M2 6h2.6L8 3v10L4.6 10H2z" fill={DESK.text} />
|
|
102
|
+
<path d="M10.4 5.4a3.6 3.6 0 0 1 0 5.2M12.4 3.6a6.2 6.2 0 0 1 0 8.8" fill="none" stroke={DESK.text} strokeWidth="1.1" strokeLinecap="round" />
|
|
103
|
+
</svg>
|
|
104
|
+
<span style={{ marginLeft: u(4), fontSize: u(5), fontVariantNumeric: "tabular-nums" }}>{clock}</span>
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
/** The whole screen at `w` design pixels wide. Its children are placed on the 480 × 270 screen. */
|
|
110
|
+
export function Desk({ w, name, held, windows, clock, children, style }: { w: number; name: string; held: Held; windows?: TaskWindow[]; clock?: string; children?: ReactNode; style?: CSSProperties }) {
|
|
111
|
+
return (
|
|
112
|
+
<div style={{ position: "relative", width: u(w), height: u((w * SCREEN.h) / SCREEN.w), overflow: "hidden", background: DESK.deep, ...style }}>
|
|
113
|
+
<div style={{ position: "absolute", left: 0, top: 0, width: u(SCREEN.w), height: u(SCREEN.h), transform: `scale(${w / SCREEN.w})`, transformOrigin: "0 0", fontFamily: FONT.sans, color: DESK.text }}>
|
|
114
|
+
<div style={{ position: "absolute", inset: 0, background: `radial-gradient(85% 85% at 72% 38%, ${DESK.glow} 0%, ${DESK.field} 55%, ${DESK.deep} 100%)` }} />
|
|
115
|
+
<div style={{ position: "absolute", inset: 0, backgroundImage: `radial-gradient(circle, rgba(255,255,255,0.075) 0, rgba(255,255,255,0.075) ${u(0.45)}, transparent ${u(0.6)})`, backgroundSize: `${u(14)} ${u(14)}` }} />
|
|
116
|
+
<div style={{ position: "absolute", left: u(250), top: u(10), width: u(190), height: u(190), background: `radial-gradient(circle, ${hexAlpha(DESK.signal, 0.16)}, transparent 68%)` }} />
|
|
117
|
+
<SpuntoMark size={125} style={{ position: "absolute", left: u(282), top: u(42), opacity: 0.92 }} />
|
|
118
|
+
<div style={{ position: "absolute", left: u(30), top: u(203), fontFamily: FONT.display, fontSize: u(21), lineHeight: 1, letterSpacing: "-0.01em", whiteSpace: "nowrap" }}>
|
|
119
|
+
Spunto <span style={{ color: DESK.signal }}>Desktop</span>
|
|
120
|
+
</div>
|
|
121
|
+
<div style={{ position: "absolute", left: u(30), top: u(231), fontSize: u(6), color: DESK.muted, letterSpacing: "0.01em", whiteSpace: "nowrap" }}>{WALLPAPER.tagline}</div>
|
|
122
|
+
{children}
|
|
123
|
+
<Taskbar name={name} held={held} windows={windows} clock={clock} />
|
|
124
|
+
</div>
|
|
125
|
+
</div>
|
|
126
|
+
)
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
const popped = (show: boolean): CSSProperties => ({
|
|
130
|
+
opacity: show ? 1 : 0,
|
|
131
|
+
transform: show ? "none" : `translateY(${u(5)}) scale(0.97)`,
|
|
132
|
+
transition: "opacity 0.3s ease, transform 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2)",
|
|
133
|
+
})
|
|
134
|
+
|
|
135
|
+
const frame = (x: number, y: number, w: number, h: number, show: boolean, z = 2): CSSProperties => ({
|
|
136
|
+
position: "absolute",
|
|
137
|
+
left: u(x),
|
|
138
|
+
top: u(y),
|
|
139
|
+
width: u(w),
|
|
140
|
+
height: u(h),
|
|
141
|
+
zIndex: z,
|
|
142
|
+
borderRadius: u(3.5),
|
|
143
|
+
overflow: "hidden",
|
|
144
|
+
boxShadow: `0 ${u(10)} ${u(26)} ${u(-6)} rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1)`,
|
|
145
|
+
...popped(show),
|
|
146
|
+
})
|
|
147
|
+
|
|
148
|
+
function Controls() {
|
|
149
|
+
return (
|
|
150
|
+
<svg viewBox="0 0 44 10" style={{ display: "block", flexShrink: 0, width: u(26), height: u(6) }} fill="none" stroke={DESK.text} strokeWidth="1.3" strokeLinecap="round">
|
|
151
|
+
<path d="M2 8h6M19 2.5h6v6h-6zM36 2l6 6M42 2l-6 6" />
|
|
152
|
+
</svg>
|
|
153
|
+
)
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/** A window of the desktop's « Spunto » theme: flat title bar, the title in the middle. */
|
|
157
|
+
export function DeskWindow({ x, y, w, h, title, show = true, z, children }: { x: number; y: number; w: number; h: number; title: string; show?: boolean; z?: number; children?: ReactNode }) {
|
|
158
|
+
return (
|
|
159
|
+
<div style={{ ...frame(x, y, w, h, show, z), background: DESK.deep }}>
|
|
160
|
+
<div style={{ position: "relative", height: u(12), display: "flex", alignItems: "center", padding: `0 ${u(6)}`, background: DESK.panel }}>
|
|
161
|
+
<svg viewBox="0 0 10 10" style={{ display: "block", width: u(5), height: u(5) }} stroke={DESK.text} strokeWidth="1.5">
|
|
162
|
+
<path d="M1 2.5h8M1 5h8M1 7.5h8" />
|
|
163
|
+
</svg>
|
|
164
|
+
<span style={{ position: "absolute", left: 0, right: 0, textAlign: "center", fontSize: u(5.2), fontWeight: 600, color: DESK.text }}>{title}</span>
|
|
165
|
+
<span style={{ marginLeft: "auto" }} />
|
|
166
|
+
<Controls />
|
|
167
|
+
</div>
|
|
168
|
+
<div style={{ position: "relative", height: `calc(100% - ${u(12)})`, overflow: "hidden" }}>{children}</div>
|
|
169
|
+
</div>
|
|
170
|
+
)
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/** The desktop's browser: its own tab strip, the address, and the page under it. */
|
|
174
|
+
export function DeskBrowser({ x, y, w, h, tab, address, show = true, children }: { x: number; y: number; w: number; h: number; tab: string; address: string; show?: boolean; children?: ReactNode }) {
|
|
175
|
+
return (
|
|
176
|
+
<div style={{ ...frame(x, y, w, h, show), background: "#ffffff" }}>
|
|
177
|
+
<div style={{ height: u(13), display: "flex", alignItems: "flex-end", padding: `0 ${u(6)}`, background: "#1f1f23" }}>
|
|
178
|
+
<span style={{ display: "flex", alignItems: "center", gap: u(4), width: u(96), height: u(10.5), padding: `0 ${u(5)}`, borderRadius: `${u(3)} ${u(3)} 0 0`, background: "#35353b", fontSize: u(5), color: "#e8e8ec", whiteSpace: "nowrap", overflow: "hidden" }}>
|
|
179
|
+
<span style={{ width: u(5), height: u(5), borderRadius: u(1.2), background: "#8ab4f8", flexShrink: 0 }} />
|
|
180
|
+
<span style={{ overflow: "hidden", textOverflow: "ellipsis" }}>{tab}</span>
|
|
181
|
+
</span>
|
|
182
|
+
<span style={{ marginLeft: "auto", alignSelf: "center", opacity: 0.7 }}>
|
|
183
|
+
<Controls />
|
|
184
|
+
</span>
|
|
185
|
+
</div>
|
|
186
|
+
<div style={{ height: u(13), display: "flex", alignItems: "center", gap: u(5), padding: `0 ${u(6)}`, background: "#35353b" }}>
|
|
187
|
+
<svg viewBox="0 0 30 10" style={{ display: "block", flexShrink: 0, width: u(18), height: u(6) }} fill="none" stroke="#b9b9c0" strokeWidth="1.2" strokeLinecap="round" strokeLinejoin="round">
|
|
188
|
+
<path d="M5 2L2 5l3 3M2 5h6M17 2l3 3l-3 3M20 5h-6" />
|
|
189
|
+
</svg>
|
|
190
|
+
<span style={{ flex: 1, height: u(9), display: "flex", alignItems: "center", padding: `0 ${u(6)}`, borderRadius: u(5), background: "#1f1f23", fontSize: u(5.2), color: "#e8e8ec" }}>{address}</span>
|
|
191
|
+
</div>
|
|
192
|
+
<div style={{ position: "relative", height: `calc(100% - ${u(26)})`, overflow: "hidden", color: "#1c1b22" }}>{children}</div>
|
|
193
|
+
</div>
|
|
194
|
+
)
|
|
195
|
+
}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { FONT } from "../../../theme"
|
|
4
|
+
import { AppWindow, CodeCard, Float, Stage, u, useStage, type StageColors } from "../stage"
|
|
5
|
+
import { Desk, type TaskWindow } from "./desk"
|
|
6
|
+
import { DESK_WIN, InvoicesPage, SiteBrowser, type Lang } from "./parts"
|
|
7
|
+
import { CAPTION, DESK, LEASES, SITE } from "./sample"
|
|
8
|
+
|
|
9
|
+
/* A leased desktop, watched from the wall while the agent drives it: a tab opens on a site the member
|
|
10
|
+
signed in to, a button is clicked by what it says, the file comes down, the screen is captured.
|
|
11
|
+
|
|
12
|
+
The requests are the documentation's routes (server/docs.ts § Piloter le poste), under the lease's
|
|
13
|
+
address; none of their answers is made up. A click is an input event of the browser, not the
|
|
14
|
+
desktop's pointer: the button is ringed, nothing travels to it. */
|
|
15
|
+
|
|
16
|
+
const H = 530
|
|
17
|
+
const STILL = 6
|
|
18
|
+
/* 0 the desktop, just leased · 1 a tab opens · 2 the click is asked · 3 it lands · 4 the file comes down · 5 the downloads · 6 the screenshot · 7 fade · 8 rewind */
|
|
19
|
+
const LENGTHS = [900, 1700, 1200, 380, 1300, 1500, 3600, 450, 120] as const
|
|
20
|
+
|
|
21
|
+
const BROWSER = { x: 14, y: 8, w: 284, h: 188 }
|
|
22
|
+
|
|
23
|
+
export function DriveScreen({ lang, colors, night, label }: { lang: Lang; colors: StageColors; night: boolean; label: string }) {
|
|
24
|
+
const { ref, step } = useStage(LENGTHS, STILL)
|
|
25
|
+
const open = step >= 1 && step <= 6
|
|
26
|
+
const held = { kind: "agent" as const, holder: LEASES.agent.holder[lang], minutes: 58 }
|
|
27
|
+
const windows: TaskWindow[] = open ? [{ icon: "browser", title: SITE.tab[lang], active: true }] : []
|
|
28
|
+
const comment = CAPTION.drive[lang]
|
|
29
|
+
const page = <InvoicesPage lang={lang} aim={step === 2} pressed={step === 3} downloaded={step >= 4 && step <= 6} />
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<Stage stageRef={ref} colors={colors} night={night} height={H} label={label}>
|
|
33
|
+
<AppWindow {...DESK_WIN} h={H} address="desktop.spunto.net/d/…">
|
|
34
|
+
<Desk w={DESK_WIN.w} name="poste-2" held={held} windows={windows}>
|
|
35
|
+
<SiteBrowser {...BROWSER} lang={lang} show={open}>
|
|
36
|
+
{page}
|
|
37
|
+
</SiteBrowser>
|
|
38
|
+
</Desk>
|
|
39
|
+
</AppWindow>
|
|
40
|
+
|
|
41
|
+
<Float x={566} y={58} w={340} depth={120} show={open}>
|
|
42
|
+
<CodeCard
|
|
43
|
+
title={CAPTION.agent[lang]}
|
|
44
|
+
meta="…/api/v1/leases/$ID"
|
|
45
|
+
signal={colors.signal}
|
|
46
|
+
lines={[
|
|
47
|
+
{ text: comment[0], dim: true },
|
|
48
|
+
{ text: "POST …/ops/browser/tabs", hot: step === 1 },
|
|
49
|
+
{ text: ` {"url": "${SITE.url}"}` },
|
|
50
|
+
{ text: comment[1], dim: true, hidden: step < 2 },
|
|
51
|
+
{ text: "POST …/ops/browser/tabs/$TAB/click", hot: step >= 2 && step <= 4, hidden: step < 2 },
|
|
52
|
+
{ text: ` {"text": "${SITE.export[lang]}"}`, hidden: step < 2 },
|
|
53
|
+
{ text: comment[2], dim: true, hidden: step < 5 },
|
|
54
|
+
{ text: "GET …/ops/downloads", hot: step === 5, hidden: step < 5 },
|
|
55
|
+
{ text: comment[3], dim: true, hidden: step < 6 },
|
|
56
|
+
{ text: "GET …/ops/desktop/screenshot?width=900", hot: step === 6, hidden: step < 6 },
|
|
57
|
+
]}
|
|
58
|
+
/>
|
|
59
|
+
</Float>
|
|
60
|
+
|
|
61
|
+
<Float x={660} y={292} w={216} depth={200} show={step === 6} style={{ background: DESK.panel }}>
|
|
62
|
+
<div style={{ padding: `${u(6)} ${u(10)}`, fontFamily: FONT.mono, fontSize: u(9), color: DESK.muted }}>{CAPTION.screenshot[lang]}</div>
|
|
63
|
+
<Desk w={216} name="poste-2" held={held} windows={windows}>
|
|
64
|
+
<SiteBrowser {...BROWSER} lang={lang}>
|
|
65
|
+
<InvoicesPage lang={lang} downloaded />
|
|
66
|
+
</SiteBrowser>
|
|
67
|
+
</Desk>
|
|
68
|
+
</Float>
|
|
69
|
+
</Stage>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { FONT } from "../../../theme"
|
|
4
|
+
import { AppWindow, CodeCard, Cursor, Float, MUTED, Stage, u, useStage, type StageColors } from "../stage"
|
|
5
|
+
import { Desk } from "./desk"
|
|
6
|
+
import { AppShell, CARDS_TOP, DeskNotice, DesktopCard, HandoffAlert, heldBy, InvoicesPage, leaseOf, ROOM, SiteBrowser, TwoFactorPage, WIN, type Lang } from "./parts"
|
|
7
|
+
import { CAPTION, DESKTOPS, HANDOFF, SITE, UI } from "./sample"
|
|
8
|
+
|
|
9
|
+
/* The hand-off: the agent meets a code sent by SMS and asks for a human. The desktop's card turns red on
|
|
10
|
+
the wall, the member opens the desktop, types the code, gives the hand back — the agent carries on.
|
|
11
|
+
|
|
12
|
+
What is shown is what `POST /api/v1/leases/{id}/handoff` does (server/leases.ts): a notification on
|
|
13
|
+
the desktop's screen, the alert and its two buttons on the wall (web/src/app/Desktops.tsx), the red
|
|
14
|
+
count in the sidebar (Shell.tsx) — and `handoff` back to null once the hand is returned. */
|
|
15
|
+
|
|
16
|
+
const H = 600
|
|
17
|
+
const STILL = 2
|
|
18
|
+
/* 0 the agent is stuck · 1 it hands over · 2 the wall says so · 3 to « Ouvrir le poste » · 4 click · 5–7 the desktop, the code typed ·
|
|
19
|
+
8 signed in · 9 to « C'est fait, rendre la main » · 10 click · 11 the agent carries on · 12 fade · 13 rewind */
|
|
20
|
+
const LENGTHS = [1000, 1500, 1900, 850, 420, 800, 450, 750, 1100, 850, 420, 3400, 450, 120] as const
|
|
21
|
+
|
|
22
|
+
const GAP = 14
|
|
23
|
+
const CARD = (ROOM - GAP) / 2
|
|
24
|
+
const AT = { x: CARD + GAP, y: CARDS_TOP }
|
|
25
|
+
/* Where the alert's two buttons are, on the page. */
|
|
26
|
+
const BUTTONS = { y: AT.y + 37 + CARD * 0.75 + 60, open: AT.x + 62, back: AT.x + 186 }
|
|
27
|
+
|
|
28
|
+
export function HandoffScreen({ lang, colors, night, label }: { lang: Lang; colors: StageColors; night: boolean; label: string }) {
|
|
29
|
+
const { ref, step } = useStage(LENGTHS, STILL)
|
|
30
|
+
const lease = leaseOf("agent", lang, "il y a 3 min", "57 min")
|
|
31
|
+
const waiting = step >= 2 && step <= 10
|
|
32
|
+
const typed = step < 5 ? 0 : step === 5 ? 2 : step === 6 ? 4 : 6
|
|
33
|
+
const through = step >= 8 && step <= 12
|
|
34
|
+
const message = HANDOFF[lang]
|
|
35
|
+
|
|
36
|
+
const desk = (w: number) => (
|
|
37
|
+
<Desk w={w} name="poste-2" held={heldBy(lease, 57)} windows={[{ icon: "browser", title: through ? SITE.tab[lang] : SITE.twoFactor[lang], active: true }]}>
|
|
38
|
+
<SiteBrowser x={40} y={10} w={400} h={234} lang={lang} tab={through ? undefined : SITE.twoFactor[lang]} path={through ? undefined : "/login"}>
|
|
39
|
+
{through ? <InvoicesPage lang={lang} /> : <TwoFactorPage lang={lang} typed={typed} />}
|
|
40
|
+
</SiteBrowser>
|
|
41
|
+
<DeskNotice title={UI.handsOver(lease.holder)} body={message} show={waiting && step < 8} />
|
|
42
|
+
</Desk>
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
const pointer = step <= 2 || step >= 12 ? { x: 250, y: 300 } : step <= 8 ? { x: BUTTONS.open, y: BUTTONS.y } : { x: BUTTONS.back, y: BUTTONS.y }
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<Stage stageRef={ref} colors={colors} night={night} height={H} label={label}>
|
|
49
|
+
<AppWindow {...WIN} h={H} address="desktop.spunto.net">
|
|
50
|
+
<AppShell colors={colors} count={DESKTOPS.length} handoffs={waiting ? 1 : 0}>
|
|
51
|
+
<DesktopCard x={0} y={AT.y} w={CARD} name="poste-1" tag="conversation" size="small" status="paused" lease={null} tone={colors.tone} screen={null} />
|
|
52
|
+
<DesktopCard
|
|
53
|
+
{...AT}
|
|
54
|
+
w={CARD}
|
|
55
|
+
name="poste-2"
|
|
56
|
+
tag="auto"
|
|
57
|
+
size="small"
|
|
58
|
+
status="running"
|
|
59
|
+
lease={lease}
|
|
60
|
+
tone={colors.tone}
|
|
61
|
+
screen={desk(CARD)}
|
|
62
|
+
ringed={waiting}
|
|
63
|
+
alert={<HandoffAlert holder={lease.holder} message={message} tone={colors.tone} pressed={step === 4 ? "open" : step === 10 ? "back" : undefined} show={waiting} />}
|
|
64
|
+
/>
|
|
65
|
+
<Cursor {...pointer} down={step === 4 || step === 10} hidden={step <= 2 || (step >= 5 && step <= 8) || step >= 11} ms={800} />
|
|
66
|
+
</AppShell>
|
|
67
|
+
</AppWindow>
|
|
68
|
+
|
|
69
|
+
<Float x={36} y={122} w={470} depth={70} show={step >= 5 && step <= 8} style={{ background: "#eef1ef" }}>
|
|
70
|
+
<div style={{ display: "flex", alignItems: "center", height: u(25), padding: `0 ${u(10)}`, fontSize: u(9.6), fontWeight: 600, color: MUTED }}>
|
|
71
|
+
{CAPTION.opened[lang]}
|
|
72
|
+
<span style={{ marginLeft: "auto", padding: `${u(2)} ${u(10)}`, borderRadius: u(4), background: "#ffffff", fontFamily: FONT.mono, fontWeight: 400, fontSize: u(8.6) }}>desktop.spunto.net/d/…</span>
|
|
73
|
+
</div>
|
|
74
|
+
{desk(470)}
|
|
75
|
+
</Float>
|
|
76
|
+
|
|
77
|
+
<Float x={14} y={452} w={330} depth={130} show={step >= 1 && step <= 11}>
|
|
78
|
+
<CodeCard
|
|
79
|
+
title={CAPTION.agent[lang]}
|
|
80
|
+
meta="…/api/v1/leases/$ID"
|
|
81
|
+
signal={colors.signal}
|
|
82
|
+
lines={[
|
|
83
|
+
{ text: CAPTION.handoff[lang][0], dim: true },
|
|
84
|
+
{ text: "POST …/handoff", hot: step === 1 || step === 2 },
|
|
85
|
+
{ text: ` {"message": "${message}"}` },
|
|
86
|
+
{ text: CAPTION.handoff[lang][1], dim: true, hidden: step < 2 },
|
|
87
|
+
{ text: "GET …", hidden: step < 2 },
|
|
88
|
+
{ text: ' { …, "handoff": null }', hot: true, hidden: step < 11 },
|
|
89
|
+
]}
|
|
90
|
+
/>
|
|
91
|
+
</Float>
|
|
92
|
+
</Stage>
|
|
93
|
+
)
|
|
94
|
+
}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { FONT, hexAlpha } from "../../../theme"
|
|
4
|
+
import { AppWindow, Float, Icon, Stage, u, useStage, type StageColors } from "../stage"
|
|
5
|
+
import { Desk, DeskWindow, SpuntoMark, type TaskWindow } from "./desk"
|
|
6
|
+
import { DESK_WIN, type Lang } from "./parts"
|
|
7
|
+
import { CAPTION, DESK, LAUNCHER, LEASES, TERMINAL } from "./sample"
|
|
8
|
+
|
|
9
|
+
/* A desktop a member took: a real Linux desktop, and its launcher. Super + Espace opens it, what is typed
|
|
10
|
+
filters its tiles, Enter runs the one that is left — a terminal, on the desktop.
|
|
11
|
+
|
|
12
|
+
The launcher is the image's own page (desktop/branding/launcher/index.html: its tiles, its filter on a
|
|
13
|
+
tile's name and description, the first one left selected); the terminal is the capture's
|
|
14
|
+
(docs/branding/fenetres.png). */
|
|
15
|
+
|
|
16
|
+
const H = 530
|
|
17
|
+
const STILL = 1
|
|
18
|
+
/* 0 the desktop · 1 Super + Espace: the launcher · 2–3 « term » is typed · 4 Enter · 5 a terminal · 6 a command · 7 its answer · 8 fade · 9 rewind */
|
|
19
|
+
const LENGTHS = [1000, 1700, 550, 1100, 500, 800, 900, 3400, 450, 120] as const
|
|
20
|
+
|
|
21
|
+
const NAME = "poste-1"
|
|
22
|
+
const TILES = [...LAUNCHER.apps, ...LAUNCHER.spunto]
|
|
23
|
+
|
|
24
|
+
function Key({ children, lit }: { children: string; lit?: boolean }) {
|
|
25
|
+
return (
|
|
26
|
+
<span style={{ padding: `${u(0.8)} ${u(2.6)}`, borderRadius: u(1.8), border: `1px solid ${lit ? hexAlpha(DESK.signal, 0.6) : DESK.line}`, background: lit ? hexAlpha(DESK.signal, 0.14) : "rgba(255,255,255,0.04)", fontFamily: FONT.mono, fontSize: u(4.6), color: lit ? DESK.signal : DESK.muted }}>
|
|
27
|
+
{children}
|
|
28
|
+
</span>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function Tile({ tile, selected }: { tile: (typeof TILES)[number]; selected: boolean }) {
|
|
33
|
+
const accent = "accent" in tile && tile.accent
|
|
34
|
+
return (
|
|
35
|
+
<span
|
|
36
|
+
style={{
|
|
37
|
+
display: "flex",
|
|
38
|
+
flexDirection: "column",
|
|
39
|
+
gap: u(4),
|
|
40
|
+
padding: u(5.6),
|
|
41
|
+
borderRadius: u(4),
|
|
42
|
+
border: `1px solid ${selected ? "rgba(253,205,92,0.45)" : DESK.line}`,
|
|
43
|
+
background: selected ? "rgba(102,70,183,0.35)" : "rgba(255,255,255,0.04)",
|
|
44
|
+
}}
|
|
45
|
+
>
|
|
46
|
+
<span style={{ display: "flex", alignItems: "center", justifyContent: "center", width: u(14), height: u(14), borderRadius: u(3.3), background: accent ? DESK.signal : "rgba(255,255,255,0.08)", color: accent ? DESK.deep : "inherit", fontSize: u(7.5), lineHeight: 1 }}>{tile.ico}</span>
|
|
47
|
+
<b style={{ fontWeight: 600, fontSize: u(5.6), lineHeight: 1.3 }}>{tile.name}</b>
|
|
48
|
+
<small style={{ fontSize: u(4.7), lineHeight: 1.35, color: DESK.muted }}>{tile.desc}</small>
|
|
49
|
+
</span>
|
|
50
|
+
)
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The launcher's page: the tiles whose name or description holds what was typed, the first of them selected. */
|
|
54
|
+
function LauncherPage({ query, holder }: { query: string; holder: string }) {
|
|
55
|
+
const kept = TILES.filter((t) => `${t.name} ${t.desc}`.toLowerCase().includes(query))
|
|
56
|
+
const section = (label: string) => <span style={{ fontFamily: FONT.mono, fontSize: u(4.4), letterSpacing: "0.08em", textTransform: "uppercase", color: DESK.muted }}>{label}</span>
|
|
57
|
+
const grid = (tiles: typeof TILES, columns: number) => (
|
|
58
|
+
<span style={{ display: "grid", gridTemplateColumns: `repeat(${columns}, 1fr)`, gap: u(4) }}>
|
|
59
|
+
{tiles
|
|
60
|
+
.filter((t) => kept.includes(t))
|
|
61
|
+
.map((t) => (
|
|
62
|
+
<Tile key={t.id} tile={t} selected={t === kept[0]} />
|
|
63
|
+
))}
|
|
64
|
+
</span>
|
|
65
|
+
)
|
|
66
|
+
return (
|
|
67
|
+
<div style={{ display: "flex", flexDirection: "column", gap: u(5.6), height: "100%", padding: `${u(9)} ${u(10)} ${u(6.5)}`, background: `radial-gradient(120% 90% at 85% 0%, ${DESK.glow} 0%, ${DESK.field} 45%, ${DESK.deep} 100%)`, color: DESK.text }}>
|
|
68
|
+
<span style={{ display: "flex", alignItems: "center", gap: u(5) }}>
|
|
69
|
+
<SpuntoMark size={15} tile={DESK.field} style={{ borderRadius: u(2.5) }} />
|
|
70
|
+
<span style={{ fontFamily: FONT.display, fontSize: u(9.2), letterSpacing: "-0.01em" }}>
|
|
71
|
+
Spunto <span style={{ color: DESK.signal }}>Desktop</span>
|
|
72
|
+
</span>
|
|
73
|
+
<span style={{ marginLeft: "auto", display: "flex", alignItems: "center", gap: u(3.3), padding: `${u(2.5)} ${u(5)}`, borderRadius: u(10), border: `1px solid ${DESK.line}`, background: "rgba(255,255,255,0.06)", fontSize: u(5), fontWeight: 500 }}>
|
|
74
|
+
<span style={{ width: u(3.3), height: u(3.3), borderRadius: "50%", background: DESK.signal, boxShadow: `0 0 ${u(4)} ${DESK.signal}` }} />
|
|
75
|
+
{LAUNCHER.reservedBy(NAME, holder)}
|
|
76
|
+
</span>
|
|
77
|
+
</span>
|
|
78
|
+
<span style={{ display: "flex", alignItems: "center", gap: u(4), height: u(20), padding: `0 ${u(6)}`, borderRadius: u(4), border: `1px solid ${DESK.signal}`, boxShadow: `0 0 0 ${u(1.3)} rgba(253,205,92,0.15)`, background: "rgba(0,0,0,0.25)", fontSize: u(6.6) }}>
|
|
79
|
+
<Icon id="search" size={7.5} color={DESK.muted} width={2} />
|
|
80
|
+
{query ? (
|
|
81
|
+
<span>
|
|
82
|
+
{query}
|
|
83
|
+
<span style={{ display: "inline-block", width: 1, height: u(8), marginLeft: u(0.6), verticalAlign: "middle", background: DESK.text }} />
|
|
84
|
+
</span>
|
|
85
|
+
) : (
|
|
86
|
+
<span style={{ color: DESK.muted }}>{LAUNCHER.placeholder}</span>
|
|
87
|
+
)}
|
|
88
|
+
<span style={{ marginLeft: "auto" }} />
|
|
89
|
+
<Key>{LAUNCHER.escape}</Key>
|
|
90
|
+
</span>
|
|
91
|
+
{section(LAUNCHER.sections[0])}
|
|
92
|
+
{grid(LAUNCHER.apps, 5)}
|
|
93
|
+
{section(LAUNCHER.sections[1])}
|
|
94
|
+
{grid(LAUNCHER.spunto, 4)}
|
|
95
|
+
<span style={{ marginTop: "auto", display: "flex", gap: u(6.6), fontSize: u(4.8), color: DESK.muted }}>
|
|
96
|
+
{LAUNCHER.keys.map((k) => (
|
|
97
|
+
<span key={k.label} style={{ display: "flex", alignItems: "center", gap: u(2.5) }}>
|
|
98
|
+
{k.keys.map((key) => (
|
|
99
|
+
<Key key={key}>{key}</Key>
|
|
100
|
+
))}
|
|
101
|
+
{k.label}
|
|
102
|
+
</span>
|
|
103
|
+
))}
|
|
104
|
+
</span>
|
|
105
|
+
</div>
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
export function LauncherScreen({ lang, colors, night, label }: { lang: Lang; colors: StageColors; night: boolean; label: string }) {
|
|
110
|
+
const { ref, step } = useStage(LENGTHS, STILL)
|
|
111
|
+
const holder = LEASES.human.holder[lang]
|
|
112
|
+
const launcher = step >= 1 && step <= 3
|
|
113
|
+
const terminal = step >= 5 && step <= 7
|
|
114
|
+
const query = step === 2 ? LAUNCHER.query.slice(0, 2) : step === 3 || step === 4 ? LAUNCHER.query : ""
|
|
115
|
+
const windows: TaskWindow[] = launcher ? [{ icon: "launcher", title: LAUNCHER.title, active: true }] : terminal ? [{ icon: "terminal", title: TERMINAL.title, active: true }] : []
|
|
116
|
+
const pressed = step === 1 ? LAUNCHER.keys[0].keys : step === 2 ? LAUNCHER.query.slice(0, 2).split("") : step === 3 ? LAUNCHER.query.split("") : ["↵"]
|
|
117
|
+
const prompt = <span style={{ color: DESK.free }}>{TERMINAL.prompt}</span>
|
|
118
|
+
const caret = <span style={{ display: "inline-block", width: u(3.4), height: u(7), marginLeft: u(1.5), verticalAlign: "text-bottom", background: DESK.text }} />
|
|
119
|
+
|
|
120
|
+
return (
|
|
121
|
+
<Stage stageRef={ref} colors={colors} night={night} height={H} label={label}>
|
|
122
|
+
<AppWindow {...DESK_WIN} h={H} address="desktop.spunto.net/d/…">
|
|
123
|
+
<Desk w={DESK_WIN.w} name={NAME} held={{ kind: "human", holder, minutes: 95 }} windows={windows}>
|
|
124
|
+
<DeskWindow x={70} y={6} w={340} h={244} title={LAUNCHER.title} show={launcher} z={3}>
|
|
125
|
+
<LauncherPage query={query} holder={holder} />
|
|
126
|
+
</DeskWindow>
|
|
127
|
+
<DeskWindow x={112} y={22} w={300} h={170} title={TERMINAL.title} show={terminal}>
|
|
128
|
+
<div style={{ height: "100%", padding: `${u(7)} ${u(8)}`, background: "#120d21", fontFamily: FONT.mono, fontSize: u(6.3), lineHeight: 1.55, color: DESK.text, whiteSpace: "pre" }}>
|
|
129
|
+
<div>
|
|
130
|
+
{prompt} {step >= 6 && TERMINAL.command(NAME)}
|
|
131
|
+
{step < 7 && caret}
|
|
132
|
+
</div>
|
|
133
|
+
{step >= 7 && (
|
|
134
|
+
<>
|
|
135
|
+
{TERMINAL.output(NAME).map((line) => (
|
|
136
|
+
<div key={line}>{line}</div>
|
|
137
|
+
))}
|
|
138
|
+
<div>
|
|
139
|
+
{prompt}
|
|
140
|
+
{caret}
|
|
141
|
+
</div>
|
|
142
|
+
</>
|
|
143
|
+
)}
|
|
144
|
+
</div>
|
|
145
|
+
</DeskWindow>
|
|
146
|
+
</Desk>
|
|
147
|
+
</AppWindow>
|
|
148
|
+
|
|
149
|
+
<Float x={688} y={428} w={216} depth={170} show={step >= 1 && step <= 4} style={{ background: "#150f27" }}>
|
|
150
|
+
<div style={{ padding: `${u(7)} ${u(12)}`, borderBottom: `1px solid ${DESK.line}`, fontSize: u(9.6), fontWeight: 600, color: DESK.muted }}>{CAPTION.keyboard[lang]}</div>
|
|
151
|
+
<div style={{ display: "flex", alignItems: "center", gap: u(5), height: u(40), padding: `0 ${u(12)}` }}>
|
|
152
|
+
{pressed.map((key, i) => (
|
|
153
|
+
<span key={i} style={{ minWidth: u(22), padding: `${u(3.5)} ${u(7)}`, borderRadius: u(4), border: `1px solid ${hexAlpha(DESK.signal, 0.55)}`, background: hexAlpha(DESK.signal, 0.14), fontFamily: FONT.mono, fontSize: u(10.5), textAlign: "center", color: DESK.signal }}>
|
|
154
|
+
{key}
|
|
155
|
+
</span>
|
|
156
|
+
))}
|
|
157
|
+
</div>
|
|
158
|
+
</Float>
|
|
159
|
+
</Stage>
|
|
160
|
+
)
|
|
161
|
+
}
|