update: simplify tab selection logic, run lint.

This commit is contained in:
Darshan committed 2025-05-08 09:25:17 +05:30
1 parent d92ae473ac
commit aafa0915cf
3 files changed
+22 -22

No files matched your search

@@ -49,14 +49,14 @@
<svelte:fragment slot="title">Reset email template?</svelte:fragment>
<Layout.Stack>
<p class="text">
Are you sure you want to reset the email template?
<b>Default values will be set in all inputs.</b>
</p>
<p class="text">
Are you sure you want to reset the email template?
<b>Default values will be set in all inputs.</b>
</p>
{#if error}
<Alert.Inline status="warning">{error}</Alert.Inline>
{/if}
{#if error}
<Alert.Inline status="warning">{error}</Alert.Inline>
{/if}
</Layout.Stack>
<svelte:fragment slot="footer">
@@ -51,11 +51,7 @@
}
</script>
<Confirm
onSubmit={handleDelete}
title={`Delete ${label} key`}
bind:open={showDelete}
bind:error>
<Confirm onSubmit={handleDelete} title={`Delete ${label} key`} bind:open={showDelete} bind:error>
<p>
Are you sure you want to delete <b>{keyIds.length}</b>
{label} key{keyIds.length > 1 ? 's' : ''}?
@@ -52,6 +52,10 @@
return usage.load(dates.start, dates.end, dates.period);
}
function isTabSelected(key: string) {
return page.url.pathname === `${path}/${key}`;
}
$: $registerCommands([
{
label: 'Add platform',
@@ -221,20 +225,20 @@
<Tabs>
<Tab
noscroll
event="platforms"
href={`${path}/platforms`}
selected={page.url.pathname === `${path}/platforms`}
event="platforms">Platforms</Tab>
selected={isTabSelected('platforms')}>Platforms</Tab>
<Tab
noscroll
event="keys"
href={`${path}/keys`}
selected={page.url.pathname === `${path}/keys`}
event="keys">API keys</Tab>
<Tab
noscroll
href={`${path}/dev-keys`}
selected={page.url.pathname === `${path}/dev-keys`}
event="keys">Dev keys</Tab>
</Tabs>
selected={isTabSelected('keys')}>API keys</Tab>
<Tab
noscroll
event="keys"
href={`${path}/dev-keys`}
selected={isTabSelected('dev-keys')}>Dev keys</Tab>
</Tabs>
{#if $action}
<svelte:component this={$action} />
{/if}