diff --git a/e2e/tests/demo.spec.ts b/e2e/tests/demo.spec.ts index 910ee0b..d569670 100644 --- a/e2e/tests/demo.spec.ts +++ b/e2e/tests/demo.spec.ts @@ -10,7 +10,7 @@ import { test, expect, type Page } from "@playwright/test"; -const BANNER_TEXT = "This is a demo environment, any changes you make here are local, and will not be saved."; +const BANNER_TEXT = "You’re exploring a demo. Changes stay in this tab and are lost when you reload."; async function enterDemo(page: Page) { await page.goto("/demo"); diff --git a/e2e/tests/limited-permissions.spec.ts b/e2e/tests/limited-permissions.spec.ts index c0a290e..b7a0381 100644 --- a/e2e/tests/limited-permissions.spec.ts +++ b/e2e/tests/limited-permissions.spec.ts @@ -245,13 +245,13 @@ test("owner grants the limited user VIEW access on the doc", async () => { await expect(dialog).toBeVisible({ timeout: 5000 }); // Sanity: no shares yet - the empty-state copy is visible. - await expect(dialog.getByText("No users have been granted discrete access yet.")).toBeVisible(); + await expect(dialog.getByText("Not shared with anyone yet.")).toBeVisible(); // Default permission for an addable limited member is already "View" - just // click the per-row "Grant access" button. await dialog.getByTitle("Grant access").click(); - // After grant, the user moves into the "Members with access" section. The + // After grant, the user moves into the "Shared with" section. The // "Revoke access" button only renders for existing shares, so its presence // is the unambiguous post-grant signal (the user's name is visible in both // sections). diff --git a/packages/frontend/src/App.tsx b/packages/frontend/src/App.tsx index ec56982..92293c2 100644 --- a/packages/frontend/src/App.tsx +++ b/packages/frontend/src/App.tsx @@ -32,6 +32,7 @@ import { TestAudioPage } from "./pages/TestAudioPage"; import { AnimationsTestPage } from "./pages/tests/AnimationsTestPage"; import { HomeVariantsPage } from "./pages/tests/home/HomeVariantsPage"; import { Toaster } from "@/components/ui/sonner"; +import { ErrorBoundary } from "@/components/ErrorBoundary"; // `/@` profile links. React Router 6 can't match a literal `@` prefix // on a param, so the route is the generic single segment `/:atHandle`: only @@ -65,7 +66,7 @@ export function App() { } }, [location.pathname]); return ( - <> + } /> } /> @@ -115,6 +116,6 @@ export function App() { )} - + ); } diff --git a/packages/frontend/src/components/CodeBlock.tsx b/packages/frontend/src/components/CodeBlock.tsx index 0d8bc29..e757a2a 100644 --- a/packages/frontend/src/components/CodeBlock.tsx +++ b/packages/frontend/src/components/CodeBlock.tsx @@ -1,23 +1,10 @@ import { useState, useEffect, useCallback, type ReactNode } from "react"; import { Check, Copy } from "lucide-react"; -import { getHighlighter, highlighterReady } from "@/lib/shiki"; +import { highlightCode, highlighterReady } from "@/lib/shiki"; import { Button } from "@/components/ui/button"; import { DiceRoll } from "@/components/DiceRoll"; import { MermaidDiagram } from "@/components/MermaidDiagram"; -const THEME = "vitesse-dark"; - -function highlight(code: string, lang: string): string | null { - const h = getHighlighter(); - if (!h) return null; - try { - return h.codeToHtml(code, { lang, theme: THEME }); - } catch { - // Unknown language - fall back to plain text - return h.codeToHtml(code, { lang: "text", theme: THEME }); - } -} - interface CodeBlockProps { lang: string; code: string; @@ -38,15 +25,15 @@ export function CodeBlock({ lang, code, className }: CodeBlockProps) { return ; } -/** Highlighted fenced code block using Shiki (vitesse-dark theme on the card surface). */ +/** Highlighted fenced code block using Shiki (vitesse light/dark on the card surface). */ function ShikiCodeBlock({ lang, code, className }: CodeBlockProps) { - const [html, setHtml] = useState(() => highlight(code, lang)); + const [html, setHtml] = useState(() => highlightCode(code, lang)); const [copied, setCopied] = useState(false); useEffect(() => { // If highlighter wasn't ready on first render, wait for it then re-render. if (html !== null) return; - highlighterReady.then(() => setHtml(highlight(code, lang))); + highlighterReady.then(() => setHtml(highlightCode(code, lang))); }, [code, lang]); // eslint-disable-line react-hooks/exhaustive-deps const copy = useCallback(() => { diff --git a/packages/frontend/src/components/DiceRoll.tsx b/packages/frontend/src/components/DiceRoll.tsx index eda3414..c8c8c5b 100644 --- a/packages/frontend/src/components/DiceRoll.tsx +++ b/packages/frontend/src/components/DiceRoll.tsx @@ -336,6 +336,15 @@ export function DiceRoll({ notation }: DiceRollProps) { const [open, setOpen] = useState(false); const touchTimerRef = useRef | null>(null); const blockOpenRef = useRef(false); + // A roll swaps (and re-keys) the chip, which drops keyboard focus on the + // floor - put it back on the new chip so Enter/Space can keep re-rolling. + const rollBtnRef = useRef(null); + const refocusRef = useRef(false); + useEffect(() => { + if (!refocusRef.current) return; + refocusRef.current = false; + rollBtnRef.current?.focus({ preventScroll: true }); + }, [rollKey]); const { showInkCritSparkles } = useRendererCtx(); const clearTouchTimer = useCallback(() => { @@ -352,6 +361,8 @@ export function DiceRoll({ notation }: DiceRollProps) { e.preventDefault(); e.stopPropagation(); clearTouchTimer(); + // detail 0 = keyboard activation (mouse clicks report the click count). + refocusRef.current = e.detail === 0; setResult(tryRoll(notation) ?? "invalid"); setRollKey((k) => k + 1); setOpen(false); @@ -385,7 +396,7 @@ export function DiceRoll({ notation }: DiceRollProps) { if (result === "invalid") { return ( dice: {notation} @@ -396,6 +407,7 @@ export function DiceRoll({ notation }: DiceRollProps) { if (result === null) { return ( + + + {error.message && ( +
+ Error details +
+              {error.message}
+            
+
+ )} + + + ); +} diff --git a/packages/frontend/src/components/ExportPdfDialog.tsx b/packages/frontend/src/components/ExportPdfDialog.tsx index 01cf372..a85367a 100644 --- a/packages/frontend/src/components/ExportPdfDialog.tsx +++ b/packages/frontend/src/components/ExportPdfDialog.tsx @@ -21,9 +21,13 @@ interface Props { documentName?: string; open?: boolean; onOpenChange?: (open: boolean) => void; + /** The page shows an AI summary block - otherwise its toggle is a dead control and is hidden. */ + hasAiSummary?: boolean; + /** The page shows the "Last updated" line - otherwise its toggle is hidden. */ + hasLastUpdated?: boolean; } -export function ExportPdfDialog({ trigger, documentName, open: controlledOpen, onOpenChange }: Props) { +export function ExportPdfDialog({ trigger, documentName, open: controlledOpen, onOpenChange, hasAiSummary = true, hasLastUpdated = true }: Props) { const [uncontrolledOpen, setUncontrolledOpen] = useState(false); const open = controlledOpen ?? uncontrolledOpen; const setOpen = (next: boolean) => { @@ -51,20 +55,14 @@ export function ExportPdfDialog({ trigger, documentName, open: controlledOpen, o Export as PDF - Opens your browser's print dialog. Choose Save as PDF as the destination to download a file with selectable text and working links. + Opens your browser's print dialog. Choose Save as PDF as the destination for a file with selectable text and working links. Margins and scale are set there too.
-
-

Layout

-

Paper size and colour theme for the PDF.

-
+

Layout

-
- -

A4 is the default.

-
+ )}
- {canEdit && (selectedCount > 0 || !createInHeader) && ( + )} + {canEdit && !createInHeader && (
- {selectedCount > 0 && ( - - )} - {!createInHeader && createSplitButton} + {createSplitButton}
)}
@@ -1751,6 +1796,9 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable
) : !inSearch && folders.length === 0 && docs.length === 0 && files.length === 0 ? (
@@ -1758,9 +1806,29 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable

This folder is empty

{canEdit - ? "Create a document, add a folder, or drop files here to upload." + ? isDesktop + ? "Start with a document, or drop files anywhere on this page to upload them." + : "Start with a document, or upload files from your device." : "Nothing has been added here yet."}

+ {/* The next step, right where the eye already is. Labels differ + from the top bar's "New document" so role lookups stay unique; + below md the full-width create button already sits just above, + so only Upload (otherwise behind its chevron) is repeated. */} + {canEdit && ( +
+ {createInHeader && ( + + )} + +
+ )}
) : renderTable()} @@ -1803,18 +1871,22 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable {/* Rename dialog */} { if (!open) setRenameTarget(null); }}> - + - Rename + Rename {renameTarget?.type === "folder" ? "folder" : renameTarget?.type === "file" ? "file" : "document"}
setRenameName(e.target.value)} - autoFocus required />
@@ -1832,7 +1904,7 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable {/* Move-to-folder dialog - keyboard/single-pointer alternative to drag */} { if (!open) setMoveTarget(null); }}> - + Move "{moveTarget?.name}" Choose a destination folder. @@ -1847,23 +1919,27 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable {destinations.map(({ folder: f, label }) => ( ))} {destinations.length === 0 && currentFolderId !== null && ( @@ -1890,7 +1966,7 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable Cancel Move to recycle bin @@ -1939,7 +2015,7 @@ export function FileManager({ projectId, projectName, folderId, myRole, aiEnable Cancel diff --git a/packages/frontend/src/components/HistoryBanner.tsx b/packages/frontend/src/components/HistoryBanner.tsx index 20519ef..244d982 100644 --- a/packages/frontend/src/components/HistoryBanner.tsx +++ b/packages/frontend/src/components/HistoryBanner.tsx @@ -1,9 +1,14 @@ import { useState } from "react"; +import { History } from "lucide-react"; +import { Button } from "@/components/ui/button"; import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle, } from "@/components/ui/alert-dialog"; +// Ghost buttons tinted to the banner instead of the neutral accent hover. +const BANNER_GHOST = "text-amber-900 hover:bg-amber-200/60 hover:text-amber-950 dark:text-amber-200 dark:hover:bg-amber-900/50 dark:hover:text-amber-100"; + function formatDate(iso: string): string { return new Date(iso).toLocaleDateString(undefined, { year: "numeric", month: "long", day: "numeric" }); } @@ -27,34 +32,32 @@ export function HistoryBanner({ editorName, createdAt, title, onBack, onRevert, return ( <> -
- - Historical version saved by {editorName} on {formatDate(createdAt)}. - {title && <> Titled “{title}” at the time.} - -
+ {/* One sentence that says where you are, then real buttons in a + clear order: look (View changes), leave (Back to live), act + (Revert - the only filled one). Underlined text links read as + prose and wrapped off the edge on phones. */} +
+
+
+
{onToggleDiff && ( - + )} + {onRevert && ( - + )} -
diff --git a/packages/frontend/src/components/HistorySheet.tsx b/packages/frontend/src/components/HistorySheet.tsx index 134f9eb..262e037 100644 --- a/packages/frontend/src/components/HistorySheet.tsx +++ b/packages/frontend/src/components/HistorySheet.tsx @@ -1,5 +1,5 @@ import { Fragment } from "react"; -import { ChevronRight, Type } from "lucide-react"; +import { ChevronRight, History, Type } from "lucide-react"; import { Badge } from "@/components/ui/badge"; import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@/components/ui/sheet"; import { Skeleton } from "@/components/ui/skeleton"; @@ -174,7 +174,15 @@ export function HistorySheet({ open, onOpenChange, revisions, selectedId, loadin
) : revisions.length === 0 ? ( -

No history yet. Revisions are created each time the document is saved, and kept for 90 days.

+ // Teach what will appear here (the 90-day rule is already in the + // header) instead of a run-on sentence in the corner. +
+
) : (
{onSelectCurrent && ( diff --git a/packages/frontend/src/components/RecycleBin.tsx b/packages/frontend/src/components/RecycleBin.tsx index 71dc834..46fe0e9 100644 --- a/packages/frontend/src/components/RecycleBin.tsx +++ b/packages/frontend/src/components/RecycleBin.tsx @@ -155,6 +155,7 @@ export function RecycleBin({ projectId }: { projectId: string }) { const contents = trashContentsLabel(entry); const daysLeft = daysUntilPurge(entry.deleted_at, retentionDays); const busy = busyId === entry.id; + const countdown = daysLeft === 0 ? "Deleting soon" : `${daysLeft}d left`; const meta = [ entry.folder_path ? `from ${entry.folder_path}` : null, contents || null, @@ -167,11 +168,14 @@ export function RecycleBin({ projectId }: { projectId: string }) {
{entry.name}
+ {/* Phones drop the countdown column, so it leads the + meta line instead - it's the one thing that expires. */} + {countdown} · {meta}
- {daysLeft === 0 ? "Deleting soon" : `${daysLeft}d left`} + {countdown}