perbaikan name page

This commit is contained in:
Aji Setiaji
2025-07-09 23:09:49 +07:00
parent cf7afefbd4
commit bdcffc401e
2 changed files with 12 additions and 3 deletions

View File

@@ -1,6 +1,6 @@
<script lang="ts"> <script lang="ts">
import { goto } from "$app/navigation"; import { goto } from "$app/navigation";
import { onMount } from "svelte"; import { onMount, createEventDispatcher } from "svelte";
import { supabase } from "$lib/supabaseClient"; import { supabase } from "$lib/supabaseClient";
let user: any = null; let user: any = null;
@@ -50,6 +50,9 @@
| "vm" | "vm"
| "it"; | "it";
export let pageName = "";
const dispatch = createEventDispatcher();
// Semua menu // Semua menu
const fullMenu: MenuItem[] = [ const fullMenu: MenuItem[] = [
{ {
@@ -155,15 +158,19 @@
if (item.sub) { if (item.sub) {
goto(item.url); goto(item.url);
activeUrl = item.url; activeUrl = item.url;
dispatch('changePage', item.name);
openMenus[item.name] = !openMenus[item.name]; openMenus[item.name] = !openMenus[item.name];
} else { } else {
activeUrl = item.url; activeUrl = item.url;
pageName = item.name;
dispatch('changePage', item.name);
goto(item.url); goto(item.url);
} }
} }
function handleSubClick(sub: SubMenuItem) { function handleSubClick(sub: SubMenuItem) {
activeUrl = sub.url; activeUrl = sub.url;
dispatch('changePage', sub.name);
goto(sub.url); goto(sub.url);
} }

View File

@@ -53,10 +53,12 @@
localStorage.clear(); localStorage.clear();
goto("/login"); goto("/login");
} }
let pageName = "Dashboard";
</script> </script>
<div class="flex h-screen"> <div class="flex h-screen">
<Sidebar /> <Sidebar {pageName} on:changePage={(e) => pageName = e.detail} />
<!-- Main Content --> <!-- Main Content -->
<div class="flex-1 flex flex-col bg-gray-100 overflow-hidden"> <div class="flex-1 flex flex-col bg-gray-100 overflow-hidden">
@@ -64,7 +66,7 @@
<div <div
class="flex items-center justify-between bg-white shadow px-6 py-3 border-b" class="flex items-center justify-between bg-white shadow px-6 py-3 border-b"
> >
<div class="text-lg font-semibold text-gray-700">Dashboard</div> <div class="text-lg font-semibold text-gray-700">{pageName}</div>
<div class="flex items-center gap-6"> <div class="flex items-center gap-6">
<!-- Notifications --> <!-- Notifications -->