feat: 添加设置页面布局和导航功能,重构页面结构

This commit is contained in:
Vixalie
2026-03-30 21:56:01 +08:00
parent 947ea31fe0
commit ea7b2e8ec2
5 changed files with 36 additions and 8 deletions

View File

@@ -0,0 +1,24 @@
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import { currentActivate } from '$lib/stores/navigate';
let { children, data }: { data: { activePath: string } } = $props();
afterNavigate(() => {
currentActivate.set('settings');
});
</script>
<main class="px-4 py-4 size-full flex flex-row items-stretch gap-0 overflow-hidden">
<nav class="max-w-[12em] grow flex flex-col items-stretch gap-2">
<a
href="/settings/proxy"
class={[
'inline-block px-4 py-2 rounded-md hover:bg-cyan-700',
data.activePath === '/settings/proxy' && 'bg-cyan-900',
]}>Proxy</a>
</nav>
<div class="divider divider-horizontal mx-2"></div>
<div class="grow">
{@render children?.()}
</div>
</main>

View File

@@ -0,0 +1,6 @@
import type { LayoutLoad } from './$types';
export const load = (async ({ url }) => {
const path = url.pathname;
return { activePath: path };
}) satisfies LayoutLoad;

View File

@@ -1,8 +0,0 @@
<script lang="ts">
import { afterNavigate } from '$app/navigation';
import { currentActivate } from '$lib/stores/navigate';
afterNavigate(() => {
currentActivate.set('settings');
});
</script>

View File

@@ -0,0 +1,6 @@
import { redirect } from "@sveltejs/kit";
import type { PageLoad } from "./$types";
export const load: PageLoad = async () => {
throw redirect(307, "/settings/proxy");
};

View File