feat(FN-3406): add shell context hook plumbing for dashboard

Adds a new `useShellContext` hook with tests to the dashboard, integrated into `App.tsx` and `Header.tsx` to provide shell context plumbing throughout the UI.

Fusion-Task-Id: FN-3406
This commit is contained in:
Fusion
2026-05-07 22:00:41 -07:00
committed by gsxdsm
parent 954ae1078d
commit a6c4ee2b8c
23 changed files with 785 additions and 23 deletions

View File

@@ -25,7 +25,7 @@
*/
const STORAGE_KEY = "fn.authToken";
const URL_PARAM = "token";
export const URL_TOKEN_PARAM = "token";
/** Query param name used when we can't set an Authorization header (EventSource, WebSocket). */
export const QUERY_TOKEN_PARAM = "fn_token";
@@ -76,13 +76,13 @@ function captureTokenFromUrl(): string | undefined {
try {
const url = new URL(window.location.href);
const token = url.searchParams.get(URL_PARAM);
const token = url.searchParams.get(URL_TOKEN_PARAM);
if (!token) {
return undefined;
}
writeStoredToken(token);
url.searchParams.delete(URL_PARAM);
url.searchParams.delete(URL_TOKEN_PARAM);
const cleaned = url.pathname + (url.search ? url.search : "") + url.hash;
window.history.replaceState(window.history.state, "", cleaned);
return token;