mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-25 16:51:50 +00:00
Add global Ctrl+K command palette for navigation and search.
Provides quick access to sidebar destinations, org switching, server-filtered entity lookup, and common actions from anywhere in the authenticated layout.
This commit is contained in:
35
src/lib/hydrateNavHref.ts
Normal file
35
src/lib/hydrateNavHref.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
export type NavHrefParams = {
|
||||
orgId?: string;
|
||||
niceId?: string;
|
||||
resourceId?: string;
|
||||
userId?: string;
|
||||
apiKeyId?: string;
|
||||
clientId?: string;
|
||||
};
|
||||
|
||||
export function hydrateNavHref(
|
||||
val: string | undefined,
|
||||
params: NavHrefParams
|
||||
): string | undefined {
|
||||
if (!val) return undefined;
|
||||
return val
|
||||
.replace("{orgId}", params.orgId ?? "")
|
||||
.replace("{niceId}", params.niceId ?? "")
|
||||
.replace("{resourceId}", params.resourceId ?? "")
|
||||
.replace("{userId}", params.userId ?? "")
|
||||
.replace("{apiKeyId}", params.apiKeyId ?? "")
|
||||
.replace("{clientId}", params.clientId ?? "");
|
||||
}
|
||||
|
||||
export function navHrefParamsFromRoute(
|
||||
params: Record<string, string | string[] | undefined>
|
||||
): NavHrefParams {
|
||||
return {
|
||||
orgId: params.orgId as string | undefined,
|
||||
niceId: params.niceId as string | undefined,
|
||||
resourceId: params.resourceId as string | undefined,
|
||||
userId: params.userId as string | undefined,
|
||||
apiKeyId: params.apiKeyId as string | undefined,
|
||||
clientId: params.clientId as string | undefined
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user