Update breadcrumbs to use base path and new page store

Replace hardcoded `/console` paths with `${base}` prefix and migrate
from `$app/stores` to `$app/state` for page access.
This commit is contained in:
Torsten Dittmann
2025-05-28 16:13:29 +02:00
parent dd5bf02a0d
commit 5f31ab4a88
+14 -14
View File
@@ -14,7 +14,7 @@
import { base } from '$app/paths';
import { newOrgModal } from '$lib/stores/organization';
import { Click, trackEvent } from '$lib/actions/analytics';
import { page } from '$app/stores';
import { page } from '$app/state';
type Project = {
name: string;
@@ -65,7 +65,7 @@
export let organizations: Organization[] = [];
$: selectedOrg = organizations.find((organization) => organization.isSelected);
$: selectedProject = $page.data.project;
$: selectedProject = page.data.project;
let organisationBottomSheetOpen = false;
let projectsBottomSheetOpen = false;
@@ -82,7 +82,7 @@
title: 'Switch Organization',
items: organizations.map((organization) => ({
name: organization.name,
href: `/console/organization-${organization?.$id}`
href: `${base}/organization-${organization?.$id}`
}))
},
bottom: {
@@ -103,7 +103,7 @@
items: [
{
name: 'Organization overview',
href: `/console/organization-${selectedOrg?.$id}`
href: `${base}/organization-${selectedOrg?.$id}`
}
]
},
@@ -141,12 +141,12 @@
if (index < 4) {
return {
name: project.name,
href: `/console/project-${project.region}-${project.$id}/overview`
href: `${base}/project-${project.region}-${project.$id}/overview`
};
} else if (index === 4) {
return {
name: 'All projects',
href: `/console/organization-${selectedOrg?.$id}`
href: `${base}/organization-${selectedOrg?.$id}`
};
}
return null;
@@ -158,7 +158,7 @@
{
name: 'Create project',
trailingIcon: IconPlus,
href: `/console/organization-${selectedOrg?.$id}?create-project`
href: `${base}/organization-${selectedOrg?.$id}?create-project`
}
]
},
@@ -169,7 +169,7 @@
{
name: 'Create project',
trailingIcon: IconPlus,
href: `/console/organization-${selectedOrg?.$id}?create-project`
href: `${base}/organization-${selectedOrg?.$id}?create-project`
}
]
}
@@ -221,7 +221,7 @@
{#if selectedOrg}
<div use:melt={$itemOrganizations}>
<ActionMenu.Root>
<ActionMenu.Item.Anchor href={`/console/organization-${selectedOrg?.$id}`}
<ActionMenu.Item.Anchor href={`${base}/organization-${selectedOrg?.$id}`}
>Organization overview</ActionMenu.Item.Anchor
></ActionMenu.Root>
</div>
@@ -241,7 +241,7 @@
<div use:melt={$itemOrganizations}>
<ActionMenu.Root>
<ActionMenu.Item.Anchor
href={`/console/organization-${organization?.$id}`}
href={`${base}/organization-${organization?.$id}`}
>{organization.name}</ActionMenu.Item.Anchor>
</ActionMenu.Root>
</div>
@@ -272,7 +272,7 @@
<div use:melt={$itemOrganizations}>
<ActionMenu.Root>
<ActionMenu.Item.Anchor
href={`/console/organization-${organization?.$id}`}
href={`${base}/organization-${organization?.$id}`}
>{organization.name}</ActionMenu.Item.Anchor
></ActionMenu.Root>
</div>
@@ -318,7 +318,7 @@
<div use:melt={$itemProjects}>
<ActionMenu.Root>
<ActionMenu.Item.Anchor
href={`/console/project-${project.region}-${project.$id}`}>
href={`${base}/project-${project.region}-${project.$id}`}>
{project.name}
</ActionMenu.Item.Anchor>
</ActionMenu.Root>
@@ -327,7 +327,7 @@
<div use:melt={$itemProjects}>
<ActionMenu.Root>
<ActionMenu.Item.Anchor
href={`/console/organization-${selectedOrg.$id}`}>
href={`${base}/organization-${selectedOrg.$id}`}>
All projects
</ActionMenu.Item.Anchor>
</ActionMenu.Root>
@@ -340,7 +340,7 @@
<ActionMenu.Root>
<ActionMenu.Item.Anchor
leadingIcon={IconPlusSm}
href={`/console/organization-${selectedOrg?.$id}?create-project`}>
href={`${base}/organization-${selectedOrg?.$id}?create-project`}>
Create project
</ActionMenu.Item.Anchor></ActionMenu.Root>
</div>