Hide Usage tab on self-hosted project settings page

The usage tab requires an API only available on cloud.
This commit is contained in:
Steven Nguyen authored and Torsten Dittmann committed 2024-02-13 12:00:57 +00:00
1 parent 25c7a5ae67
commit 97ba01d2a8
2 files changed
+11 -6

No files matched your search

+1 -1
View File
@@ -36,7 +36,7 @@ export function getQuery(url: URL): string | undefined {
return url.searchParams.get('query') ?? undefined;
}
type TabElement = { href: string; title: string; hasChildren?: boolean };
export type TabElement = { href: string; title: string; event: string; hasChildren?: boolean };
export function isTabSelected(
tab: TabElement,
@@ -2,11 +2,13 @@
import { page } from '$app/stores';
import { Tab, Tabs } from '$lib/components';
import { isTabSelected } from '$lib/helpers/load';
import type { TabElement } from '$lib/helpers/load';
import { Cover, CoverTitle } from '$lib/layout';
import { isCloud } from '$lib/system';
const projectId = $page.params.project;
const path = `/console/project-${projectId}/settings`;
const tabs = [
const tabs: TabElement[] = [
{
href: path,
title: 'Overview',
@@ -31,14 +33,17 @@
href: `${path}/smtp`,
title: 'SMTP',
event: 'smtp'
},
{
}
];
if (isCloud) {
tabs.push({
href: `${path}/usage`,
title: 'Usage',
event: 'usage',
hasChildren: true
}
];
});
}
</script>
<Cover>