Repository navigation
Let the editor build a site of several pages - #427
Merged
Merged
Conversation
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Finishes #412. The exporter could write a site of several pages since #426; now someone can make one.
A page bar sits above the sections list. Plus adds a page and opens it ready to be named, clicking the open page renames it, clicking another opens it, and the cross deletes one after a confirm. The home page cannot be deleted and keeps index.html whatever it is renamed to, because that is the file every host looks for. Addresses stay unique on their own: a second page called About becomes about-2, and a page named 404 or frames steps around the file the export already writes.
The rules live in
editorPages.tsas pure functions over a generic section type, so the editor's stricter shape and the exporter's both use them without casting, and they are tested without rendering anything.Pages persist where the rest of the work does: the saved document carries them, and the project file does too. The file format goes to version 2, and a version 1 file still opens as a single home page.
Verified on a production build by driving the editor in Chrome: added a page, renamed it to Contact, gave it its own heading, switched back and confirmed Home still had its own, exported, and the ZIP held index.html and contact.html. Opened that ZIP from a folder with no server: the nav lists both pages and clicking Contact lands on contact.html with the heading typed into it. Reopened the editor cold and both pages came back from IndexedDB. At 390 wide the bar wraps with nothing off screen and no sideways scroll. Page tabs measure 6.91:1 active and 6.35:1 inactive. No console errors anywhere in that run.
One existing test pinned the exact line that destructures the export response, which now also takes
pages. It asserts the same intent against the shape instead: the client takes the audio extension from the server rather than guessing it twice.tsc and eslint clean, vitest 666 of 666.