Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
return usage.load(dates.start, dates.end, dates.period);
}

function isTabSelected(key: string) {
return page.url.pathname.endsWith(`/${key}`);
function isTabSelected(key: string, pathname: string) {
return pathname.split('/').includes(key);
}

$: $registerCommands([
Expand Down Expand Up @@ -227,17 +227,17 @@
noscroll
event="platforms"
href={`${path}/platforms`}
selected={isTabSelected('platforms')}>Platforms</Tab>
selected={isTabSelected('platforms', page.url.pathname)}>Platforms</Tab>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the reactivity issue was the problem. is there a cleaner approach?

<Tab
noscroll
event="api-keys"
href={`${path}/api-keys`}
selected={isTabSelected('api-keys')}>API keys</Tab>
selected={isTabSelected('api-keys', page.url.pathname)}>API keys</Tab>
<Tab
noscroll
event="dev-keys"
href={`${path}/dev-keys`}
selected={isTabSelected('dev-keys')}>Dev keys</Tab>
selected={isTabSelected('dev-keys', page.url.pathname)}>Dev keys</Tab>
</Tabs>
{#if $action}
<svelte:component this={$action} />
Expand Down
Loading