From f69ce33dd0328021cb3b30c860e91fa2aa5431d1 Mon Sep 17 00:00:00 2001 From: SinachPat Date: Tue, 13 Oct 2026 22:27:34 +0100 Subject: [PATCH] feat(web): marketing theme toggle, site search palette, and phone dev access - Theme toggle in the nav: follows the device until chosen, remembers the choice, sets data-theme before first paint (no flash). - Site search: Cmd/Ctrl+K command palette on every marketing page, opened by the shortcut, a nav Search button, or the Docs search field. Searches pages, docs topics and articles that have a page. - Docs topics move to content.ts so the page and the search index share one source. - next.config: allowedDevOrigins for private network ranges so a phone on the same Wi-Fi hydrates the dev site. Dev only. - Sun and moon icons added by hand (not Figma exports); noted in the icons README. Co-Authored-By: Claude Sonnet 5.5 --- CHANGELOG.md | 2 + .../marketing/CommandPalette.test.tsx | 198 ++++++++++++++++++ web/__tests__/marketing/Nav.test.tsx | 52 ++++- web/__tests__/marketing/search.test.ts | 88 ++++++++ web/__tests__/marketing/theme.test.ts | 59 ++++++ web/app/(marketing)/docs/page.tsx | 16 +- web/app/(marketing)/layout.tsx | 12 +- web/next.config.ts | 3 + web/public/icons/README.md | 2 + web/public/icons/moon.svg | 5 + web/public/icons/sun.svg | 5 + web/src/marketing/CommandPalette.tsx | 140 +++++++++++++ web/src/marketing/Nav.tsx | 7 + web/src/marketing/ThemeToggle.tsx | 35 ++++ web/src/marketing/content.ts | 12 ++ web/src/marketing/pages/DocsSearch.tsx | 15 ++ web/src/marketing/search.ts | 67 ++++++ web/src/marketing/theme.ts | 37 ++++ web/src/product/SearchField.tsx | 24 ++- web/src/styles/marketing.css | 54 +++++ web/src/ui/Icon.tsx | 2 +- 21 files changed, 818 insertions(+), 17 deletions(-) create mode 100644 web/__tests__/marketing/CommandPalette.test.tsx create mode 100644 web/__tests__/marketing/search.test.ts create mode 100644 web/__tests__/marketing/theme.test.ts create mode 100644 web/public/icons/moon.svg create mode 100644 web/public/icons/sun.svg create mode 100644 web/src/marketing/CommandPalette.tsx create mode 100644 web/src/marketing/ThemeToggle.tsx create mode 100644 web/src/marketing/pages/DocsSearch.tsx create mode 100644 web/src/marketing/search.ts create mode 100644 web/src/marketing/theme.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 430bb02..d598898 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The project is pre-1.0. Versions below `1.0.0` are internal milestones, not publ ### Added +- Web: working site search on the marketing site. Cmd+K (Ctrl+K on Windows and Linux), a Search button in the navigation and the Docs search field open a command palette over every page. It searches the pages, docs topics and any docs article that has a page, with arrow keys and Enter to choose and Escape to close. Docs topics now live in `content.ts` so the page and the search share one source. +- Web: light/dark theme toggle in the marketing navigation. It follows the device until the visitor chooses, remembers the choice in `localStorage`, and sets the theme before first paint so there is no flash. Sun and moon icons added to `public/icons` (hand-drawn, not Figma exports). - Web: the five other marketing pages (Product, How it works, Trust, Pricing, Docs), a marketing e2e check (`pnpm --filter @wursor/e2e test:marketing`), and product components for setup, activity and search. Web: Next.js app with design tokens (light and dark, AA contrast), the marketing Home page (desktop and phone), and a product component library built at design size (conversation, workspace, board, compare and approval) that the marketing mockups use and the app will reuse (ADR 0023). ADRs 0018 to 0022 (0022: hosting on DigitalOcean): Next.js web app (partly supersedes ADR 0011), sign-in by code, link and passkeys, Cloud provisioning on WeOwn Cloud, and keeping the "never sees a diff" rule wording. PRD, IMPLEMENTATION and AGENTS.md updated to match. - `docs/prd-assets/headless-architecture.png`, the architecture diagram used in the PRD. - Design reference: Figma file "Wursor - Experiment" (Design system, Product Design, Marketing site and Brand Guideline pages). diff --git a/web/__tests__/marketing/CommandPalette.test.tsx b/web/__tests__/marketing/CommandPalette.test.tsx new file mode 100644 index 0000000..347f54f --- /dev/null +++ b/web/__tests__/marketing/CommandPalette.test.tsx @@ -0,0 +1,198 @@ +import { render, screen, within } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; +import { CommandPaletteProvider } from '../../src/marketing/CommandPalette.tsx'; +import { DocsSearch } from '../../src/marketing/pages/DocsSearch.tsx'; +import { Nav } from '../../src/marketing/Nav.tsx'; + +function setup() { + return render( + +