[stannesi] separate hosted landing and viewer routes#46
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 88eb06fec5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| basePath: string | ||
| ): string { | ||
| const normalizedBase = normalizeViewerBasePath(basePath); | ||
| return route === "viewer" ? `${normalizedBase}viewer/` : normalizedBase; |
There was a problem hiding this comment.
Serve the viewer route in the static build
In the GitHub Pages context I checked, .github/workflows/viewer-demo-pages.yml builds and uploads only the Vite dist directory with PRD_VIEWER_BASE_PATH=/prd/; a production build produces index.html and assets only, with no viewer/index.html or 404.html SPA fallback. Returning /prd/viewer/ here works after an in-app pushState, but a direct visit or refresh on the advertised /prd/viewer/ route asks Pages for a nonexistent file and 404s, so the hosted viewer route is not actually stable outside client-side navigation.
Useful? React with 👍 / 👎.
|
|
||
| if (node.type === "heading") { | ||
| items.push({ | ||
| id: node.id ?? `heading-${items.length + 1}`, |
There was a problem hiding this comment.
Avoid outline links to missing targets
Headings are allowed to omit id in the current content schema/types, and renderHeading(..., node.id) leaves those headings without a DOM id; generating heading-N here makes the new outline render a clickable #heading-N link that cannot scroll anywhere for valid packages with un-id'd headings. Either skip unaddressable headings or ensure the same generated id is applied when rendering the heading.
Useful? React with 👍 / 👎.
Summary
/landing and/viewer/workspace routes inside the same Vite deployment./prd/base-path support.general-document,comic, andstoryboardcontent instead of static/fake dashboard navigation.Scope
Validation
PATH="/opt/homebrew/bin:$PATH" node_modules/.bin/tsc -b apps/prd-viewer-web/tsconfig.json --pretty falsePATH="/opt/homebrew/bin:$PATH" pnpm exec vitest run apps/prd-viewer-web/src/viewerRoutes.test.ts apps/prd-viewer-web/src/viewerDocumentOutline.test.ts apps/prd-viewer-web/src/viewerDemoContent.test.ts apps/prd-viewer-web/src/viewerArchiveFiles.test.ts scripts/prepare-viewer-demo-assets.test.ts apps/prd-viewer-web/src/viewerRenderMode.test.ts apps/prd-viewer-web/src/viewerRenderMode.integration.test.tsPATH="/opt/homebrew/bin:$PATH" pnpm viewer:demo:buildPATH="/opt/homebrew/bin:$PATH" pnpm docs:check -- --include-root-docsgit diff --checkPATH="/opt/homebrew/bin:$PATH" pnpm typecheckPATH="/opt/homebrew/bin:$PATH" pnpm foundation:gateBrowser verification
/desktop landing verified in dark mode./viewer/desktop workspace verified separately from landing.document-basic,comic-basic, andstoryboard-basic.Note
mainand contains only the route-split revision.