Version 8.8.0

All pages

Routing

The URL always shows the view the user is on, so every screen can be bookmarked, shared, reloaded, and walked with Back/Forward.

Where it lives

Routing is a UI concern. packages/ui/src/ui/router.ts defines the serializable RouteRef union, the routeToHash / parseHash pair, and the useHashRoute hook. Workspace maps a RouteRef to a rendered screen.

The hook is useHashRouter in routerCore.ts, which takes any app's routes and its pair of functions; the Studio keeps its own routes with the same core. This page covers Solid Memo's.

The Studio shares Solid Memo's page. Its routes are the hashes under #/studio (STUDIO_PATH, told apart by isStudioHash), none of them Solid Memo's. The page (apps/web/src/App.tsx) shows Solid Memo's Workspace or the Studio's by the hash, so a link between them is a plain hash link. studioHref links to the instance's Home in the Studio (#/studio?instance=…) from the masthead, as "Studio", and from each deck's actions menu and the deck page, as "Open in Studio". Solid Memo can't import the Studio's router, so studioHref spells the route out, and a Studio test checks that the two agree.

In the Studio, the sidebar's sections, decks and drafts, the tabs of a deck or a draft, and the palette's entries that go somewhere are links to its routes (studio.md). Following one pushes a history entry, and none adds a route or a parameter of its own. The route alone sets the chrome around a screen: the sidebar's marked section, deck or draft, the tabs and the current one, and the aside's course outline, deck, library copy's upgrade or card. Hiding the sidebar, the aside, the dock or a table's columns changes no URL (studio.md). F8 goes to a problem's field as a link does.

A card's route, #/studio/card, carries the card workbench's query too, so the deck's cards stay listed beside it. That is q, lang, state, has, sort, order, page and size, with in for the workbench's field, since the card's field is the field it opens at. Home's route, #/studio, carries its tab's view (show: due, courses, copies or attention) and the deck at its cursor (deck), and a draft's cards, #/studio/draft-cards, their sort (sort, order=desc). All are optional: without them, a card lists the deck's cards as the workbench does by default, and Home shows every deck (studio.md). Opening a card from the list pushes a history entry. These replace it: moving to the card beside it (j and k, Previous and Next), putting the list at the page of a card opened from elsewhere, and a change of Home's view or deck or of the drafts' sort.

While the card's edits aren't saved, a guard undoes a hashchange (Back, Forward, a typed hash) before the router hears of it, by going as many entries the other way, and asks the user first (studio.md). For that, the router numbers the entries it sees: position in each entry's state, read by historyPosition and shownPosition in routerCore.ts. Each entry after another, pushed by the router or made by the browser, gets one more; a replace keeps the number. Undoing a move pushes no entry, so the history after it is kept.

Hash routing, not pathname routing

The route is kept in location.hash:

Route scheme

Instances and decks are Solid resources, identified by full URLs carried URL-encoded in hash query parameters. Resolution and fallbacks says where a route with an unknown deck, card, chapter or value goes instead.

HashScreen
#/storagesstorage picker
#/instancesinstance picker
#/new-instance?storage=…&source=…instance creator
#/decks?instance=…deck list (home), under today's study and the courses to go on with
#/new-deck?instance=…deck creator
#/library?instance=…deck library: ready-made decks to import into the instance
#/library-deck?instance=…&deck=…one library deck's page: description, topics, keywords in the reader's language, release, authors, license, dates and sources; an import button for that deck alone; and "Copy link", for its #/try link. deck is the deck's series (…/decks/index.ttl#name) or a release's URL
#/library-browse?instance=…&deck=…[&page=n]a library deck's cards, read-only, paged like the Browser (paging replaces the history entry)
#/library-card?instance=…&deck=…&card=…one card of a library deck, read-only: both sides as in study, and a link to the deck's page. Opened from a row of #/library-browse. card is the card's fragment id in its release (sweden for …/v1.ttl#sweden)
#/library-preview?instance=…&deck=…[&chapter=…]a try of a library deck before import: its cards at random, one at a time, revealed as in study, nothing graded or recorded. A course's lists its chapters, and with chapter (a chapter's fragment id) plays that chapter's steps, theory then questions. Opened by Preview in the library and on the deck's page; "Back to library" returns to the library
#/import-url?instance=…[&url=…]a deck or course added from a link to its release, published anywhere. The pasted link goes into url (pushes, so Back returns to the link before); the release there is read, checked and shown, to import or start. Opened from the deck list and the library; its breadcrumb is under the library
#/deck?instance=…&deck=…deck detail
#/deck-preferences?instance=…&deck=…[&section=languages]a deck's own preferences: its name, daily limits, the language its cards are shown in first (for a course, its course language, which its own text follows too), and the languages of its text. section=languages opens it at the Languages section, its heading focused (data-arrival for useScreenFocus); an unknown section, at its start. The deck page's notice of text that doesn't say its language links there
#/browse?instance=…&deck=…[&languages=unstated][&page=n]Browser — the one place a deck and its cards are edited. page (1-based) is omitted for the first page. languages=unstated lists only the cards with a side that doesn't say its language; an unknown value lists all. Paging and a change of filter replace the history entry, so Back leaves the Browser, and a change of filter starts at the first page. Opening a card pushes, so Back from a card returns to the same filter and page.
#/new-card?instance=…&deck=…card creator (opened from, and returning to, the Browser)
#/card?instance=…&deck=…&card=…one card's page: the card, its editor (wrong options included, studio.md), remove; opened from a Browser row
#/study?instance=…&deck=…study session: the deck's due and new prompts for today, interleaved
#/cram?instance=…&deck=…a cram of the deck's leeches, as often as the learner likes, nothing graded or recorded: no due date, statistic or leech changes. Linked as "Cram the leeches" under the deck's hardest cards when one is a leech. Trail: Decks › deck › Cram; "End session" returns to the deck's page
#/cram?instance=…every deck's leeches crammed together, as the deck's are, naming the shown card's deck. Linked as "Cram the leeches" under the leeches across the decks, on the statistics' memory tab. Trail: Decks › Statistics › Cram; the Statistics crumb and "End session" both open the memory tab
#/course?instance=…&deck=…the course that deck is the learner's copy of, from the library or a link: its chapters, each locked, open or done, with its steps done; a button to go on where the learner left off; a link to its preferences (#/deck-preferences), where the course language is chosen; and the offer of a newer release, as on the deck's page. Once every chapter is done, it links back to the deck list. After a passed final review it cheers the completed chapter, kept in Workspace's memory, not the URL, until the next route: a reload, Back to it or a later visit cheers nothing
#/course-chapter?instance=…&deck=…&chapter=…one chapter of the course (chapter is its subject in the release), a step at a time: the theory, then its questions without it. The step is the first not done in the learner's progress, not in the URL
#/course-review?instance=…&deck=…&chapter=…a chapter's final review, which completes it, opening on a word before the review with a link back to the course. Once the chapter is completed, it pushes the course, unless the learner has left meanwhile. It falls back as course-chapter does, and to course-chapter (replaces) while the chapter has steps not done
#/preferences?instance=…preferences
#/palette?instance=…[&palette=…]the palette editor: palette is one of the user's own palettes, its subject in the instance's palettes.ttl; absent or unknown, a new palette. Saving and Cancel go back to the preferences. Trail: Decks › Preferences › Palette; like the preferences, it stays reachable whatever the data
#/statistics?instance=…[&range=30d|12m|all][&view=activity|memory|cards]the instance's statistics: range picks the answers (the last 30 days, 12 months or all; absent, 90 days) and view the tab (absent, the overview). A change of either replaces the history entry. Linked from the masthead and the today strip above the deck list
#/deck-statistics?instance=…&deck=…[&range=…][&view=…]one deck's statistics: the same tabs over its answers alone, with its own activity calendar and no figures by deck. Trail: Decks › deck › Statistics. Linked as "More statistics" from the deck's page
#/validate?instance=…developer tool: the instance's documents checked against the shapes (validation.md); shows how to turn developer mode on when it's off
#/try?deck=…a link to a library deck that names no instance, for anyone to open. deck as for #/library-deck
#/try?url=…a link to a release from a link that names no instance, for anyone to open. url as for #/import-url, which must be an http(s) address of a document with no fragment; with deck too, the link is to the library deck

Resolution and fallbacks

The hash carries identifiers only; Workspace resolves them to domain objects before rendering:

From the hash to a screen
The location hash is parsed into a route of URLs, whose instance and deck are queried before the screen renders.
The diagram's source
flowchart LR
    accTitle: From the hash to a screen
    accDescr: The location hash is parsed into a route of URLs, whose instance and deck are queried before the screen renders.
    hash["location.hash"] -->|parseHash| ref["RouteRef (URLs)"]
    ref -->|instances query| instance["Instance"]
    ref -->|decks query| deck["Deck"]
    instance --> screen["screen component"]
    deck --> screen

Every other route but a link to a release names an instance, which only its owner can open (a guest's, under guest.solid-memo.invalid, exists in their browser alone). A library deck's page copies a link that names none, #/try?deck=… (tryHref), for anyone to open:

Following a link to a library deck
Without a session, the link starts a guest's study first; then, once the library is read, it goes on to the deck's page in the learner's instance, or the one they choose, or to the library when the deck is not in it or the library cannot be read.
The diagram's source
flowchart TD
    accTitle: Following a link to a library deck
    accDescr: Without a session, the link starts a guest's study first; then, once the library is read, it goes on to the deck's page in the learner's instance, or the one they choose, or to the library when the deck is not in it or the library cannot be read.
    link["#/try?deck=…"] --> session{"a session?"}
    session -->|no| guest["a guest's study starts, or the one in this browser goes on"]
    session -->|yes| count
    guest --> count{"instances"}
    count -->|none| storages["#/storages: make one"]
    count -->|one| known
    count -->|several| picker["the instance picker: which to open it in"] --> known
    known{"in the library?"} -->|yes| deck["#/library-deck in that instance"]
    known -->|no| library["#/library in that instance, saying so"]
    known -->|the library unread| unread["#/library in that instance, with its error"]

A release published outside the library, such as one the Studio publishes in its creator's pod, has a link for anyone too: #/try?url=… (tryReleaseHref), which Copy link copies on its page from a link (deck-library.md). It goes as a link to a library deck goes, with no library to read:

Following a link to a release
Without a session, the link starts a guest's study first; then it goes on to adding the release in the learner's instance, or the one they choose, or to the storage picker when there is none.
The diagram's source
flowchart TD
    accTitle: Following a link to a release
    accDescr: Without a session, the link starts a guest's study first; then it goes on to adding the release in the learner's instance, or the one they choose, or to the storage picker when there is none.
    link["#/try?url=…"] --> session{"a session?"}
    session -->|no| guest["a guest's study starts, or the one in this browser goes on"]
    session -->|yes| count
    guest --> count{"instances"}
    count -->|none| storages["#/storages: make one"]
    count -->|one| add["#/import-url?url=… in that instance"]
    count -->|several| picker["the instance picker: which to open it in"] --> add

breadcrumbsFor(route, names) in packages/ui/src/ui/Breadcrumbs.tsx derives a trail from the current route alone — Decks › deck › Browser › card — which Workspace renders above every screen. Each crumb, the current page included (aria-current="page"), is a plain <a href="#/…"> link built with routeToHash. Back/Forward, new-tab and keyboard use work without extra code.

The trail is the way back up: screens have no "Back to …" buttons, except where going back is one of a screen's choices: a course's final review before it starts, and a finished course. Those are plain links too. Top-level screens (deck list, instance picker) show a single crumb, so "Decks" is on hand everywhere inside an instance. The trail of a final review leaves out a chapter with no step, as that chapter's address only comes back to the review.