New sidebar and folder view (#263)

This commit is contained in:
Gregory Schier
2025-10-15 13:46:57 -07:00
committed by GitHub
parent 19c1efc73e
commit 267cd079ad
80 changed files with 2974 additions and 1450 deletions

View File

@@ -1,3 +1,5 @@
import type { Folder, GrpcRequest, WebsocketRequest, Workspace } from '@yaakapp-internal/models';
import type { HttpRequest } from '@yaakapp-internal/sync';
import { router } from './router.js';
/**
@@ -10,11 +12,28 @@ export function setWorkspaceSearchParams(
cookie_jar_id: string | null;
environment_id: string | null;
request_id: string | null;
folder_id: string | null;
}>,
) {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(router as any).navigate({
// eslint-disable-next-line @typescript-eslint/no-explicit-any
search: (prev: any) => ({ ...prev, ...search }),
search: (prev: any) => {
console.log('Navigating to', { prev, search });
return { ...prev, ...search };
},
});
}
export function navigateToRequestOrFolderOrWorkspace(
id: string,
model: (Workspace | Folder | HttpRequest | GrpcRequest | WebsocketRequest)['model'],
) {
if (model === 'workspace') {
setWorkspaceSearchParams({ request_id: null, folder_id: null });
} else if (model === 'folder') {
setWorkspaceSearchParams({ request_id: null, folder_id: id });
} else {
setWorkspaceSearchParams({ request_id: id, folder_id: null });
}
}