2026-03-03 11:27:07 -06:00
|
|
|
<script>
|
2026-03-04 12:00:36 -06:00
|
|
|
import { LayoutDashboard, Heart, Hexagon, CalendarDays, Upload, Users, Settings, LogOut, Ticket } from 'lucide-svelte'
|
2026-03-03 16:51:54 -06:00
|
|
|
|
2026-03-03 19:55:35 -06:00
|
|
|
let { session, active, onLogout, navigate, open = false } = $props()
|
2026-03-03 11:27:07 -06:00
|
|
|
|
|
|
|
|
const role = $derived(session?.user?.role ?? '')
|
|
|
|
|
|
2026-03-03 16:51:54 -06:00
|
|
|
const iconProps = { size: 18, strokeWidth: 1.75 }
|
|
|
|
|
|
2026-03-03 11:27:07 -06:00
|
|
|
const links = $derived.by(() => {
|
2026-03-04 12:00:36 -06:00
|
|
|
if (role === 'colead') return [
|
2026-03-03 19:55:35 -06:00
|
|
|
{ href: '/', label: 'Schedule', icon: CalendarDays },
|
|
|
|
|
{ href: '/volunteers', label: 'Volunteers', icon: Heart },
|
|
|
|
|
{ href: '/departments', label: 'Departments', icon: Hexagon },
|
2026-03-03 11:27:07 -06:00
|
|
|
]
|
2026-03-04 12:00:36 -06:00
|
|
|
if (role === 'staffing') return [
|
2026-03-03 19:55:35 -06:00
|
|
|
{ href: '/', label: 'Dashboard', icon: LayoutDashboard },
|
|
|
|
|
{ href: '/schedule', label: 'Schedule', icon: CalendarDays },
|
|
|
|
|
{ href: '/volunteers', label: 'Volunteers', icon: Heart },
|
|
|
|
|
{ href: '/departments', label: 'Departments', icon: Hexagon },
|
2026-03-03 11:27:07 -06:00
|
|
|
]
|
|
|
|
|
return [
|
2026-03-03 19:55:35 -06:00
|
|
|
{ href: '/', label: 'Dashboard', icon: LayoutDashboard },
|
2026-03-04 10:53:42 -06:00
|
|
|
{ href: '/participants', label: 'Participants', icon: Ticket },
|
2026-03-03 19:55:35 -06:00
|
|
|
{ href: '/volunteers', label: 'Volunteers', icon: Heart },
|
|
|
|
|
{ href: '/departments', label: 'Departments', icon: Hexagon },
|
|
|
|
|
{ href: '/schedule', label: 'Schedule', icon: CalendarDays },
|
|
|
|
|
{ href: '/import', label: 'Import', icon: Upload },
|
|
|
|
|
{ href: '/users', label: 'Users', icon: Users },
|
|
|
|
|
{ href: '/settings', label: 'Settings', icon: Settings },
|
2026-03-03 11:27:07 -06:00
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
function isActive(href) {
|
2026-03-03 19:55:35 -06:00
|
|
|
if (href === '/') return active === '/' || active === ''
|
|
|
|
|
return active.startsWith(href)
|
2026-03-03 11:27:07 -06:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
2026-03-03 16:09:43 -06:00
|
|
|
<nav class="sidebar" class:open>
|
2026-03-03 11:27:07 -06:00
|
|
|
<div class="sidebar-brand">Turn<span>pike</span></div>
|
|
|
|
|
{#each links as link}
|
2026-03-03 19:55:35 -06:00
|
|
|
<a href={link.href} class="nav-link" class:active={isActive(link.href)}
|
|
|
|
|
onclick={(e) => { e.preventDefault(); navigate(link.href) }}>
|
2026-03-03 16:51:54 -06:00
|
|
|
<link.icon {...iconProps} />
|
2026-03-03 11:27:07 -06:00
|
|
|
{link.label}
|
|
|
|
|
</a>
|
|
|
|
|
{/each}
|
|
|
|
|
<div style="flex:1"></div>
|
|
|
|
|
<button class="nav-link btn-ghost" style="border:none;cursor:pointer;width:100%;text-align:left" onclick={onLogout}>
|
2026-03-03 16:51:54 -06:00
|
|
|
<LogOut {...iconProps} /> Sign out
|
2026-03-03 11:27:07 -06:00
|
|
|
</button>
|
|
|
|
|
</nav>
|