import type { NetworkSlicesSliceDefsSliceView } from "../client.ts"; export interface SliceParams { handle: string; sliceId: string; } export function extractSliceParams( params?: URLPatternResult, ): SliceParams | null { const handle = params?.pathname.groups.handle; const sliceId = params?.pathname.groups.rkey; if (!handle || !sliceId) { return null; } return { handle, sliceId }; } export function buildSliceUrl( handle: string, sliceId: string, path?: string, ): string { const basePath = `/profile/${handle}/slice/${sliceId}`; return path ? `${basePath}/${path}` : basePath; } // Helper to build slice URLs from slice view export function buildSliceUrlFromView( slice: NetworkSlicesSliceDefsSliceView, sliceId: string, path?: string, ): string { const handle = slice.creator?.handle || "unknown"; return buildSliceUrl(handle, sliceId, path); }