diff --git a/apps/desktop/src/components/StackTabs.svelte b/apps/desktop/src/components/StackTabs.svelte new file mode 100644 index 0000000000..2eab02ef50 --- /dev/null +++ b/apps/desktop/src/components/StackTabs.svelte @@ -0,0 +1,54 @@ + + + + +
+ {#each tabs as tab, i (tab.name)} + {@const first = i === 0} + {@const last = i === tabs.length - 1} +
+ {tab.name} +
+ {/each} + +
+ + diff --git a/apps/desktop/src/components/StackView.svelte b/apps/desktop/src/components/StackView.svelte new file mode 100644 index 0000000000..a9c01ab49f --- /dev/null +++ b/apps/desktop/src/components/StackView.svelte @@ -0,0 +1,21 @@ + + + diff --git a/apps/desktop/src/lib/tabs/mapping.ts b/apps/desktop/src/lib/tabs/mapping.ts new file mode 100644 index 0000000000..c8b78ae711 --- /dev/null +++ b/apps/desktop/src/lib/tabs/mapping.ts @@ -0,0 +1,15 @@ +import type { Stack } from '$lib/stacks/stack'; +import type { Tab } from './tab'; + +export function stacksToTabs(stacks: Stack[] | undefined): Tab[] { + if (!stacks) { + return []; + } + return stacks.map((stack) => { + return { + id: stack.id, + name: stack.branchNames[0] || 'new branch', + anchors: stack.branchNames.slice(1) + }; + }); +} diff --git a/apps/desktop/src/lib/tabs/tab.ts b/apps/desktop/src/lib/tabs/tab.ts new file mode 100644 index 0000000000..46cf8c7a15 --- /dev/null +++ b/apps/desktop/src/lib/tabs/tab.ts @@ -0,0 +1,5 @@ +export type Tab = { + id: string; + name: string; + anchors: string[]; +}; diff --git a/apps/desktop/src/routes/+layout.svelte b/apps/desktop/src/routes/+layout.svelte index 38350cb191..0fe9519e36 100644 --- a/apps/desktop/src/routes/+layout.svelte +++ b/apps/desktop/src/routes/+layout.svelte @@ -65,6 +65,7 @@ import { goto } from '$app/navigation'; import { beforeNavigate, afterNavigate } from '$app/navigation'; import { env } from '$env/dynamic/public'; + import { StackService } from '$lib/stacks/stackService.svelte'; const { data, children }: { data: LayoutData; children: Snippet } = $props(); @@ -73,6 +74,7 @@ const appState = new AppState(); const desktopState = new DesktopRedux(data.tauri); + const stackService = new StackService(desktopState); const feedService = new FeedService(data.cloud, appState.appDispatch); const organizationService = new OrganizationService(data.cloud, appState.appDispatch); const cloudUserService = new CloudUserService(data.cloud, appState.appDispatch); @@ -119,6 +121,7 @@ setContext(StackingLineManagerFactory, data.stackingLineManagerFactory); setContext(AppSettings, data.appSettings); setContext(GitHubAuthenticationService, data.githubAuthenticationService); + setContext(StackService, stackService); setNameNormalizationServiceContext(new IpcNameNormalizationService(invoke)); diff --git a/apps/desktop/src/routes/[projectId]/workspace/[[branchId]]/+page.svelte b/apps/desktop/src/routes/[projectId]/workspace/[[stackId]]/+page.svelte similarity index 64% rename from apps/desktop/src/routes/[projectId]/workspace/[[branchId]]/+page.svelte rename to apps/desktop/src/routes/[projectId]/workspace/[[stackId]]/+page.svelte index c54d62e035..252f4231fb 100644 --- a/apps/desktop/src/routes/[projectId]/workspace/[[branchId]]/+page.svelte +++ b/apps/desktop/src/routes/[projectId]/workspace/[[stackId]]/+page.svelte @@ -1,13 +1,15 @@ -
Workspace Page
+