give the soulseek workspace a url
The section is /soulseek/:section — nav entries are NavLinks, the view panel reads the same
URL instead of being told, and the dashboard's tiles and recent searches are real links (a
recent search now opens that search, not the search screen's front page).
The peer went in `?user=<name>` rather than the /soulseek/users/:name the audit sketched: a
second path segment would need a nested route just to keep the nav highlight, and `?search=`
had already set the convention there. That deletes the `soulseek:user` channel and with it a
`{username, nonce}` request the Users panel consumed-once and cleared — the nonce existed so
asking for the same peer twice counted twice. A link is idempotent, so there is nothing to
consume and nothing to disambiguate.
`soulseek:refresh` stays: it is a signal, which is what channels are for.
This commit is contained in:
@@ -59,6 +59,7 @@ export function App() {
|
||||
<Route path="/contacts" element={<Dashboard.ContactsScreen />} />
|
||||
<Route path="/music" element={<Dashboard.MusicScreen />} />
|
||||
<Route path="/soulseek" element={<Dashboard.SoulseekScreen />} />
|
||||
<Route path="/soulseek/:section" element={<Dashboard.SoulseekScreen />} />
|
||||
<Route path="/headscale" element={<Dashboard.HeadscaleScreen />} />
|
||||
<Route path="/headscale/:section" element={<Dashboard.HeadscaleScreen />} />
|
||||
<Route path="/photos" element={<Dashboard.PhotosScreen />} />
|
||||
|
||||
@@ -1,17 +1,22 @@
|
||||
import { Navigate, useParams } from 'react-router';
|
||||
import type { LayoutNode } from 'officerdev';
|
||||
import { WorkspaceView } from 'officerdev';
|
||||
import { WorkspaceView, DEFAULT_SOULSEEK_SECTION, soulseekSectionPath, isSoulseekSection } from 'officerdev';
|
||||
import { useDashboardState } from 'state/useDashboardState';
|
||||
import { defaultLayout } from './defaultLayout';
|
||||
|
||||
// /soulseek uses the Workspace/Panel system (like /chat and /music): a section nav (soulseek-nav) on
|
||||
// the left and a section view (soulseek-view) on the right, coordinating via the 'soulseek:section'
|
||||
// channel. Both talk to slskd through the /api/slskd auth proxy.
|
||||
// /soulseek uses the Workspace/Panel system (like /photos): a section nav (soulseek-nav) on the left and
|
||||
// a section view (soulseek-view) on the right, both reading `:section` from the URL. Deeper selection —
|
||||
// which search, which peer — is the query string. Both talk to slskd through the /api/slskd auth proxy.
|
||||
|
||||
export const SoulseekScreen = () => {
|
||||
const { section } = useParams();
|
||||
// v2: nav + view (replaced the earlier search + transfers split) — new key so the old persisted
|
||||
// layout doesn't resurrect as two mismatched panels.
|
||||
const workspace = useDashboardState<LayoutNode>('screens/soulseek-v2', defaultLayout);
|
||||
|
||||
// After the hooks — it returns early.
|
||||
if (!isSoulseekSection(section)) return <Navigate to={soulseekSectionPath(DEFAULT_SOULSEEK_SECTION)} replace />;
|
||||
|
||||
return (
|
||||
<div className="h-full w-full pt-2">
|
||||
<WorkspaceView
|
||||
|
||||
Reference in New Issue
Block a user