visualize_dataset / src /utils /tabUrl.ts
mishig's picture
mishig HF Staff
Sync from huggingface/lerobot-dataset-visualizer via hub-sync
54dfbb6 verified
Raw History Blame Contribute Delete
553 Bytes
/**
* The query string with `tab` set to the open tab, so the address bar always names the view on
* screen and a copied link opens it. The default tab is left out to keep episode links short. Other
* parameters (`t`, `__theme`) are kept as they are.
*/
export function searchWithTab(
search: string,
tab: string,
defaultTab: string,
): string {
const params = new URLSearchParams(search);
if (tab === defaultTab) params.delete("tab");
else params.set("tab", tab);
const query = params.toString();
return query ? `?${query}` : "";
}