Fix: reactivity of collections header

This commit is contained in:
ernstmul
2025-05-01 13:21:05 +02:00
parent 4f1a61fb10
commit 2a7fa7c8a4
@@ -8,46 +8,58 @@
import { collection } from './store';
import { isTabletViewport } from '$lib/stores/viewport';
$: projectId = page.params.project;
$: databaseId = page.params.database;
$: collectionId = page.params.collection;
$: path = `${base}/project-${projectId}/databases/database-${databaseId}/collection-${collectionId}`;
$: tabs = [
{
href: path,
title: 'Documents',
event: 'documents',
hasChildren: true
},
{
href: `${path}/attributes`,
title: 'Attributes',
event: 'attributes'
},
{
href: `${path}/indexes`,
title: 'Indexes',
event: 'indexes'
},
{
href: `${path}/activity`,
title: 'Activity',
event: 'activity',
hasChildren: true
},
{
href: `${path}/usage`,
title: 'Usage',
event: 'usage',
hasChildren: true
},
{
href: `${path}/settings`,
title: 'Settings',
event: 'settings',
disabled: !$canWriteCollections
}
].filter((tab) => !tab.disabled);
let projectId = $derived.by(() => {
return page.params.project;
});
let databaseId = $derived.by(() => {
return page.params.database;
});
let collectionId = $derived.by(() => {
return page.params.collection;
});
let path = $derived.by(() => {
return `${base}/project-${projectId}/databases/database-${databaseId}/collection-${collectionId}`;
});
let tabs = $derived.by(() => {
return [
{
href: path,
title: 'Documents',
event: 'documents',
hasChildren: true
},
{
href: `${path}/attributes`,
title: 'Attributes',
event: 'attributes'
},
{
href: `${path}/indexes`,
title: 'Indexes',
event: 'indexes'
},
{
href: `${path}/activity`,
title: 'Activity',
event: 'activity',
hasChildren: true
},
{
href: `${path}/usage`,
title: 'Usage',
event: 'usage',
hasChildren: true
},
{
href: `${path}/settings`,
title: 'Settings',
event: 'settings',
disabled: !$canWriteCollections
}
].filter((tab) => !tab.disabled);
});
</script>
<div style:margin-top={$isTabletViewport ? '48px' : 0}>