Skip to content

Commit 6ff2cab

Browse files
t3dotggclaude
andcommitted
fix(web): clearer hierarchy and spacing on the boot error screen
One left-aligned column: title, muted hint, the command in a single block with an icon copy button, then a filled Reload button. Colors follow the light, dark, and selected boot themes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 45f8d7a commit 6ff2cab

2 files changed

Lines changed: 112 additions & 31 deletions

File tree

‎apps/web/index.html‎

Lines changed: 82 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -440,41 +440,106 @@
440440
}
441441

442442
#boot-error {
443-
display: grid;
444-
justify-items: center;
445-
gap: 16px;
446-
max-width: 600px;
447-
padding: 24px;
448-
text-align: center;
443+
--boot-error-fg: #262626;
444+
--boot-error-bg: #ffffff;
445+
display: flex;
446+
flex-direction: column;
447+
align-items: flex-start;
448+
width: min(400px, calc(100% - 48px));
449+
font-size: 13px;
450+
line-height: 20px;
449451
}
450452

451-
#boot-error p {
453+
html.dark #boot-error {
454+
--boot-error-fg: #f5f5f5;
455+
--boot-error-bg: #0a0a0a;
456+
}
457+
458+
html[data-theme-selected="true"] #boot-error {
459+
--boot-error-fg: var(--boot-foreground);
460+
--boot-error-bg: var(--boot-background);
461+
}
462+
463+
#boot-error h1 {
452464
margin: 0;
465+
font-size: 15px;
466+
font-weight: 600;
467+
line-height: 22px;
468+
}
469+
470+
#boot-error p {
471+
margin: 4px 0 0;
472+
opacity: 0.6;
473+
overflow-wrap: anywhere;
474+
text-wrap: pretty;
475+
}
476+
477+
#boot-error code {
478+
font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
479+
font-size: 12px;
453480
overflow-wrap: anywhere;
454481
}
455482

456483
#boot-error button {
457-
padding: 8px 16px;
458-
border: 1px solid currentColor;
459-
border-radius: 4px;
460-
background: transparent;
461-
color: inherit;
484+
border: 0;
462485
font: inherit;
463486
cursor: pointer;
464487
}
465488

489+
#boot-error button:focus-visible {
490+
outline: 2px solid var(--boot-error-fg);
491+
outline-offset: 2px;
492+
}
493+
466494
#boot-error-command {
467495
display: flex;
468496
align-items: center;
469-
gap: 12px;
470-
max-width: 100%;
497+
gap: 8px;
498+
box-sizing: border-box;
499+
width: 100%;
500+
margin-top: 16px;
501+
padding: 6px 6px 6px 12px;
502+
border: 1px solid color-mix(in srgb, currentColor 12%, transparent);
503+
border-radius: 8px;
504+
background: color-mix(in srgb, currentColor 4%, transparent);
471505
}
472506

473-
#boot-error code {
474-
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
475-
overflow-wrap: anywhere;
507+
#boot-error-command code {
508+
flex: 1;
509+
min-width: 0;
476510
user-select: all;
477511
}
512+
513+
#boot-error-copy {
514+
display: grid;
515+
flex: none;
516+
place-items: center;
517+
width: 28px;
518+
height: 28px;
519+
border-radius: 6px;
520+
background: transparent;
521+
color: inherit;
522+
opacity: 0.6;
523+
}
524+
525+
#boot-error-copy:hover {
526+
opacity: 1;
527+
background: color-mix(in srgb, currentColor 8%, transparent);
528+
}
529+
530+
#boot-error-reload {
531+
height: 32px;
532+
margin-top: 24px;
533+
padding: 0 14px;
534+
border-radius: 6px;
535+
background: var(--boot-error-fg);
536+
color: var(--boot-error-bg);
537+
font-weight: 500;
538+
}
539+
540+
#boot-error-reload:hover {
541+
opacity: 0.9;
542+
}
478543
</style>
479544
<title>T3 Code (Beta)</title>
480545
</head>

‎apps/web/src/lib/bootError.ts‎

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ export async function resolveTriageCommand(bridge: DesktopBridge | undefined) {
2626
return FALLBACK_TRIAGE_COMMAND;
2727
}
2828

29+
const icon = (paths: string) =>
30+
`<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${paths}</svg>`;
31+
const COPY_ICON = icon(
32+
'<rect width="14" height="14" x="8" y="8" rx="2"/><path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"/>',
33+
);
34+
const CHECK_ICON = icon('<path d="M20 6 9 17l-5-5"/>');
35+
2936
export function showBootError(error: unknown) {
3037
console.error("T3 Code failed to start.", error);
3138
const bootShell = document.getElementById("boot-shell");
@@ -35,24 +42,20 @@ export function showBootError(error: unknown) {
3542
content.id = "boot-error";
3643
content.setAttribute("role", "alert");
3744

38-
const message = document.createElement("p");
39-
message.textContent = "T3 Code could not load.";
40-
content.append(message);
45+
const title = document.createElement("h1");
46+
title.textContent = "T3 Code could not load";
47+
content.append(title);
4148

4249
if (import.meta.env.DEV && error instanceof Error) {
4350
const detail = document.createElement("p");
44-
detail.textContent = error.message;
51+
detail.append(Object.assign(document.createElement("code"), { textContent: error.message }));
4552
content.append(detail);
4653
}
4754

48-
const reload = document.createElement("button");
49-
reload.type = "button";
50-
reload.textContent = "Reload";
51-
reload.addEventListener("click", () => window.location.reload());
52-
content.append(reload);
53-
5455
const hint = document.createElement("p");
55-
hint.textContent = "If Reload does not fix the problem, run this command in a terminal:";
56+
hint.textContent =
57+
"Try reloading. If the problem continues, run this in a terminal to find the cause.";
58+
5659
const command = document.createElement("code");
5760
command.textContent = FALLBACK_TRIAGE_COMMAND;
5861
const commandRow = document.createElement("div");
@@ -61,17 +64,30 @@ export function showBootError(error: unknown) {
6164
// The clipboard API exists only in secure contexts, such as HTTPS and the desktop app.
6265
if (window.isSecureContext) {
6366
const copy = document.createElement("button");
67+
copy.id = "boot-error-copy";
6468
copy.type = "button";
65-
copy.textContent = "Copy";
69+
copy.title = "Copy command";
70+
copy.setAttribute("aria-label", "Copy command");
71+
copy.innerHTML = COPY_ICON;
6672
copy.addEventListener("click", () => {
6773
navigator.clipboard.writeText(command.textContent ?? "").then(
68-
() => (copy.textContent = "Copied"),
74+
() => {
75+
copy.innerHTML = CHECK_ICON;
76+
copy.setAttribute("aria-label", "Copied");
77+
},
6978
(copyError) => console.warn("Could not copy the triage command.", copyError),
7079
);
7180
});
7281
commandRow.append(copy);
7382
}
74-
content.append(hint, commandRow);
83+
84+
const reload = document.createElement("button");
85+
reload.id = "boot-error-reload";
86+
reload.type = "button";
87+
reload.textContent = "Reload";
88+
reload.addEventListener("click", () => window.location.reload());
89+
90+
content.append(hint, commandRow, reload);
7591
bootShell.replaceChildren(content);
7692

7793
void resolveTriageCommand(window.desktopBridge).then((value) => (command.textContent = value));

0 commit comments

Comments
 (0)