diff --git a/packages/ui/README.md b/packages/ui/README.md index f53c8e5..931d8e6 100644 --- a/packages/ui/README.md +++ b/packages/ui/README.md @@ -24,6 +24,7 @@ if a `node:*` import creeps back onto that path. |---|---| | `src/app.css` | The design system: tokens and primitives, ported from the comp. Deliberately global — components carry structure, this file carries appearance. | | `src/lib/space.ts` | The `Space` type a view is drawn from, and lookups over it. Knows nothing about where records came from. | +| `src/lib/space-navigation.ts` | The navigation boundary for spaces: URL changes may open a fold, while successful picker choices replace the URL with that fold's neutral route. | | `src/lib/session.svelte.ts` | Which space this tab is looking at: opening one, the visibility-aware poll loop, the remembered space list. The only module that touches the network for reads. | | `src/lib/auth.svelte.ts`, `write.ts` | The OAuth session, and `runCli()` over a `RepoWriter` built on it. The only two modules that write. | | `src/lib/store.ts`, `src/lib/idb.ts` | `RecordStore` and `SyncStateStore` over an in-memory mirror hydrated from IndexedDB. Synchronous reads, background writes, one database per space. | diff --git a/packages/ui/src/lib/components/SpacePicker.svelte b/packages/ui/src/lib/components/SpacePicker.svelte index 44ff4b3..425ed9b 100644 --- a/packages/ui/src/lib/components/SpacePicker.svelte +++ b/packages/ui/src/lib/components/SpacePicker.svelte @@ -19,10 +19,12 @@ // // "Opened before" is what remains: spaces this browser profile has read without being a member of, and // so has no join for. It is a per-profile convenience rather than anything the network knows. + import { goto } from '$app/navigation' import { account, rememberedIdentities, signIn, signOut } from '$lib/auth.svelte.js' import { unknownActor } from '$lib/directory.js' import { discoverOwned, forgetOwned, owned } from '$lib/owned.svelte.js' import { forget, leave, openFixture, openSpace, session } from '$lib/session.svelte.js' + import { selectSpace } from '$lib/space-navigation.js' import Disc from './Disc.svelte' import Glyph from './Glyph.svelte' import NewSpace from './NewSpace.svelte' @@ -76,8 +78,13 @@ function submitUri(event: SubmitEvent): void { event.preventDefault() - if (uri.trim()) void openSpace(uri) + if (uri.trim()) void chooseSpace(uri.trim()) } + + // A successful picker choice updates the fold and its shareable URL as one interaction. A failed + // open leaves the old space and overlay in place, with `session.error` available for a retry. + const chooseSpace = (spaceUri: string): Promise => + selectSpace(spaceUri, openSpace, goto, session)
@@ -181,7 +188,7 @@