mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
feat: remember overview last tab
This commit is contained in:
1 parent
612d73161a
commit
b0a2ec8dfb
3 files changed
+15
-4
No files matched your search
@@ -25,7 +25,7 @@
|
||||
import { Container, type UsagePeriods } from '$lib/layout';
|
||||
import { page } from '$app/stores';
|
||||
import { onboarding, project } from '../store';
|
||||
import { usage } from './store';
|
||||
import { selectedTab, usage } from './store';
|
||||
import { onMount } from 'svelte';
|
||||
import { afterNavigate } from '$app/navigation';
|
||||
import { Heading } from '$lib/components';
|
||||
@@ -203,7 +203,8 @@
|
||||
<a
|
||||
class="tabs-button"
|
||||
href={`${path}/platforms`}
|
||||
class:is-selected={$page.url.pathname === `${path}/platforms`}>
|
||||
class:is-selected={$page.url.pathname === `${path}/platforms`}
|
||||
on:click={() => ($selectedTab = 'platforms')}>
|
||||
<span class="text">Platforms</span>
|
||||
</a>
|
||||
</li>
|
||||
@@ -211,7 +212,8 @@
|
||||
<a
|
||||
class="tabs-button"
|
||||
href={`${path}/keys`}
|
||||
class:is-selected={$page.url.pathname === `${path}/keys`}>
|
||||
class:is-selected={$page.url.pathname === `${path}/keys`}
|
||||
on:click={() => ($selectedTab = 'keys')}>
|
||||
<span class="text">API Keys</span>
|
||||
</a>
|
||||
</li>
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
import { base } from '$app/paths';
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import { get } from 'svelte/store';
|
||||
import type { PageLoad } from './$types';
|
||||
import { selectedTab } from './store';
|
||||
|
||||
export const load: PageLoad = async ({ params }) => {
|
||||
throw redirect(302, `${base}/console/project-${params.project}/overview/platforms`);
|
||||
if (get(selectedTab) === 'keys') {
|
||||
throw redirect(302, `${base}/console/project-${params.project}/overview/keys`);
|
||||
} else {
|
||||
throw redirect(302, `${base}/console/project-${params.project}/overview/platforms`);
|
||||
}
|
||||
};
|
||||
@@ -1,6 +1,7 @@
|
||||
import { sdkForConsole } from '$lib/stores/sdk';
|
||||
import { cachedStore } from '$lib/helpers/cache';
|
||||
import type { Models } from '@aw-labs/appwrite-console';
|
||||
import { writable, type Writable } from 'svelte/store';
|
||||
|
||||
export const usage = cachedStore<
|
||||
Models.UsageProject,
|
||||
@@ -15,3 +16,5 @@ export const usage = cachedStore<
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
export const selectedTab: Writable<'platforms' | 'keys'> = writable('platforms');
|
||||
Reference in new issue
Block a user