mirror of
https://github.com/polaroi8d/cactoide.git
synced 2026-03-22 14:15:28 +00:00
feat: add an option to remove the landing page
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { page } from '$app/stores';
|
||||
import { goto } from '$app/navigation';
|
||||
import { t } from '$lib/i18n/i18n.js';
|
||||
import { PUBLIC_LANDING_INFO } from '$env/static/public';
|
||||
|
||||
// Check if current page is active
|
||||
const isActive = (path: string): boolean => {
|
||||
@@ -24,12 +25,14 @@
|
||||
|
||||
<!-- Navigation -->
|
||||
<div class="md:flex md:items-center md:space-x-8">
|
||||
<button
|
||||
on:click={() => goto('/')}
|
||||
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
{t('navigation.home')}
|
||||
</button>
|
||||
{#if PUBLIC_LANDING_INFO !== 'false'}
|
||||
<button
|
||||
on:click={() => goto('/')}
|
||||
class={isActive('/') ? 'text-violet-400' : 'cursor-pointer'}
|
||||
>
|
||||
{t('navigation.home')}
|
||||
</button>
|
||||
{/if}
|
||||
|
||||
<button
|
||||
on:click={() => goto('/discover')}
|
||||
|
||||
11
src/routes/+page.server.ts
Normal file
11
src/routes/+page.server.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { redirect } from '@sveltejs/kit';
|
||||
import type { PageServerLoad } from './$types';
|
||||
import { PUBLIC_LANDING_INFO } from '$env/static/public';
|
||||
|
||||
export const load: PageServerLoad = async () => {
|
||||
if (PUBLIC_LANDING_INFO === 'false') {
|
||||
throw redirect(302, '/discover');
|
||||
}
|
||||
|
||||
return {};
|
||||
};
|
||||
Reference in New Issue
Block a user