<script lang="ts">
  import { page } from '$app/state';

  type Item = { href: string; label: string };

  // Users and Library are deferred until they have real routes.
  // Adding them as disabled items clutters the tab strip without serving the
  // operator — they'll be added back when each surface ships.
  const items: Item[] = [
    { href: '/admin',              label: 'Overview' },
    { href: '/admin/integrations', label: 'Integrations' },
    { href: '/admin/requests',     label: 'Requests' },
    { href: '/admin/quarantine',   label: 'Quarantine' }
  ];

  function isActive(href: string): boolean {
    if (href === '/admin') return page.url.pathname === '/admin';
    return page.url.pathname.startsWith(href);
  }
</script>

<nav aria-label="Admin sections" class="border-b border-border">
  <ul class="flex gap-2">
    {#each items as item (item.href)}
      <li>
        <a
          href={item.href}
          aria-current={isActive(item.href) ? 'page' : undefined}
          class="block border-b-2 px-3 py-2 text-sm transition-colors {isActive(item.href)
            ? 'border-accent text-text-primary'
            : 'border-transparent text-text-secondary hover:text-text-primary'}"
        >
          {item.label}
        </a>
      </li>
    {/each}
  </ul>
</nav>
