[stannesi] separate hosted landing and viewer routes#45
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7210e667fe
ℹ️ 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".
| const currentPath = `${window.location.pathname}${window.location.hash}`; | ||
|
|
||
| if (currentPath !== nextPath) { | ||
| window.history.pushState(null, "", nextPath); |
There was a problem hiding this comment.
Add a static fallback for the viewer route
When deployed by .github/workflows/viewer-demo-pages.yml to GitHub Pages, this pushes /prd/viewer/ into history. The Vite build uploaded by that workflow only emits index.html, assets, and examples, with no viewer/index.html or 404.html fallback, so refreshing or sharing a deep link to /prd/viewer/ is served by Pages as a 404 before React can route it. Use hash routing or include a static fallback/rewrite for the viewer route.
Useful? React with 👍 / 👎.
| {items.map((item) => ( | ||
| <li key={`${item.kind}-${item.id}`}> | ||
| <a | ||
| href={`#${item.id}`} |
There was a problem hiding this comment.
Only link outline items to rendered anchors
For supported packages that produce root document, comic panel, storyboard frame, or generated heading outline items, many of these href targets are never rendered as matching DOM IDs: the structured document article has no id, visual panel/frame rows only use React key, and headings without authored IDs get synthetic outline IDs that are not applied to the rendered heading. In those cases clicking the new outline entries just changes the URL hash without scrolling or selecting anything, so either render matching IDs or avoid anchor links for non-anchorable items.
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.