frontend update

This commit is contained in:
2025-11-07 19:34:18 +03:00
parent 6a2c07076d
commit 137a9cbf27
3 changed files with 190 additions and 1 deletions

View File

@@ -2,6 +2,32 @@
import '../app.css';
import { onMount } from 'svelte';
import { page } from '$app/stores';
import Navbar from '$lib/components/Navbar.svelte';
import { browser } from '$app/environment';
let isAuthenticated = false;
let isLoginPage = false;
// Authentication state'ini kontrol et
function checkAuth() {
if (browser) {
const user = localStorage.getItem('user');
isAuthenticated = !!user;
isLoginPage = $page.url.pathname === '/';
}
}
// Page değiştiğinde ve component mount olduğında kontrol et
onMount(() => {
checkAuth();
});
$: {
checkAuth();
}
// Navbar'ı gösterme kararı
$: shouldShowNavbar = isAuthenticated && !isLoginPage;
</script>
<svelte:head>
@@ -9,7 +35,11 @@
<meta name="description" content="Akaryakıt İstasyonu Yönetim Sistemi" />
</svelte:head>
<main>
{#if shouldShowNavbar}
<Navbar />
{/if}
<main class:navbar-visible={shouldShowNavbar}>
<slot />
</main>
@@ -17,5 +47,23 @@
main {
min-height: 100vh;
width: 100%;
padding-top: 0;
}
main.navbar-visible {
min-height: calc(100vh - 70px);
padding-top: 0;
}
@media (max-width: 768px) {
main.navbar-visible {
min-height: calc(100vh - 60px);
}
}
@media (max-width: 480px) {
main.navbar-visible {
min-height: calc(100vh - 70px);
}
}
</style>