fix: active nav highlight and redirect to home after login
Some checks failed
Deploy / Deploy Production (push) Has been skipped
Deploy / Cleanup Preview (push) Has been skipped
Deploy / Deploy Preview (push) Failing after 1s
CI / UI / Build (pull_request) Successful in 14s
CI / Scraper / Test (pull_request) Successful in 16s
CI / Scraper / Lint (pull_request) Successful in 19s
CI / Scraper / Build (pull_request) Successful in 15s

This commit is contained in:
Admin
2026-03-06 16:41:20 +05:00
parent a5c603e7a6
commit c0d33720e9
2 changed files with 12 additions and 6 deletions

View File

@@ -203,10 +203,16 @@
libnovel
</a>
{#if data.user}
<a href="/books" class="text-zinc-400 hover:text-zinc-100 text-sm transition-colors">
<a
href="/books"
class="text-sm transition-colors {page.url.pathname.startsWith('/books') ? 'text-zinc-100 font-medium' : 'text-zinc-400 hover:text-zinc-100'}"
>
Library
</a>
<a href="/browse" class="text-zinc-400 hover:text-zinc-100 text-sm transition-colors">
<a
href="/browse"
class="text-sm transition-colors {page.url.pathname.startsWith('/browse') ? 'text-zinc-100 font-medium' : 'text-zinc-400 hover:text-zinc-100'}"
>
Discover
</a>
<div class="ml-auto flex items-center gap-4">

View File

@@ -8,9 +8,9 @@ const AUTH_COOKIE = 'libnovel_auth';
const ONE_YEAR = 60 * 60 * 24 * 365;
export const load: PageServerLoad = async ({ locals }) => {
// Already logged in — send to library
// Already logged in — send to home
if (locals.user) {
redirect(302, '/books');
redirect(302, '/');
}
return {};
};
@@ -51,7 +51,7 @@ export const actions: Actions = {
maxAge: ONE_YEAR
});
redirect(302, '/books');
redirect(302, '/');
},
register: async ({ request, cookies, locals }) => {
@@ -110,6 +110,6 @@ export const actions: Actions = {
maxAge: ONE_YEAR
});
redirect(302, '/books');
redirect(302, '/');
}
};