diff --git a/frontend/src/lib/components/home/ItemsList.svelte b/frontend/src/lib/components/home/ItemsList.svelte index 1092d288e7..40c1492142 100644 --- a/frontend/src/lib/components/home/ItemsList.svelte +++ b/frontend/src/lib/components/home/ItemsList.svelte @@ -18,6 +18,7 @@ import { Code2, LayoutDashboard } from 'lucide-svelte' export let filter = '' + export let subtab: 'flow' | 'script' | 'app' = 'script' import AppRow from '$lib/components/common/table/AppRow.svelte' import FlowRow from '$lib/components/common/table/FlowRow.svelte' @@ -290,6 +291,9 @@ { + if (itemKind != 'all') { + subtab = itemKind + } setQuery($page.url, 'kind', itemKind) }} class="h-10" diff --git a/frontend/src/lib/navigation.ts b/frontend/src/lib/navigation.ts index 1f716c6a61..a80e8e8b12 100644 --- a/frontend/src/lib/navigation.ts +++ b/frontend/src/lib/navigation.ts @@ -1,10 +1,20 @@ import { goto } from '$app/navigation' -export async function setQuery(url: URL, key: string, value: string | undefined): Promise { - if (value != undefined) { +export async function setQuery( + url: URL, + key: string, + value: string | undefined, + currentHash: string | undefined = undefined +): Promise { + if (value !== undefined) { url.searchParams.set(key, value) } else { url.searchParams.delete(key) } - await goto(`?${url.searchParams.toString()}`) + + await goto( + currentHash + ? `?${url.searchParams.toString()}${currentHash}` + : `?${url.searchParams.toString()}` + ) } diff --git a/frontend/src/routes/(root)/(logged)/+page.svelte b/frontend/src/routes/(root)/(logged)/+page.svelte index 61423b5d2c..ff6640fa1d 100644 --- a/frontend/src/routes/(root)/(logged)/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/+page.svelte @@ -21,6 +21,8 @@ import { writable } from 'svelte/store' import type { EditorBreakpoint } from '$lib/components/apps/types' import { HOME_SHOW_HUB, HOME_SHOW_CREATE_FLOW, HOME_SHOW_CREATE_APP } from '$lib/consts' + import { setQuery } from '$lib/navigation' + import { page } from '$app/stores' type Tab = 'hub' | 'workspace' @@ -29,7 +31,7 @@ ? (window.location.hash?.replace('#', '') as Tab) : 'workspace' - let subtab: 'flows' | 'scripts' | 'apps' = 'apps' + let subtab: 'flow' | 'script' | 'app' = 'app' let filter: string = '' @@ -224,46 +226,47 @@
{#if tab == 'hub'} - - + { + setQuery($page.url, 'kind', subtab, window.location.hash) + }} + > +
Scripts
- +
Flows
- +
Apps
- {#if subtab == 'scripts'} - viewCode(e.detail)} - > - {:else if subtab == 'flows'} - viewFlow(e.detail)} - > - {:else if subtab == 'apps'} - viewApp(e.detail)} - > + color="light" + > + Go to Hub + + + {:else if subtab == 'flow'} + viewFlow(e.detail)}> + + + {:else if subtab == 'app'} + viewApp(e.detail)}> + + {/if} {/if}
@@ -272,5 +275,5 @@
{#if tab == 'workspace'} - + {/if}