sidebar.twig 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <aside class="hidden w-56 border-r border-slate-200 bg-white px-3 py-6 text-sm dark:border-slate-800 dark:bg-slate-950 md:block">
  2. <nav class="flex flex-col gap-1">
  3. {% set links = [
  4. { href: '/app/dashboard', label: 'Dashboard', section: 'dashboard' },
  5. { href: '/app/ips', label: 'IPs', section: 'ips' },
  6. { href: '/app/subnets', label: 'Subnets', section: 'subnets' },
  7. { href: '/app/manual-blocks', label: 'Manual blocks', section: 'manual-blocks' },
  8. { href: '/app/allowlist', label: 'Allowlist', section: 'allowlist' },
  9. { href: '/app/policies', label: 'Policies', section: 'policies' },
  10. { href: '/app/reporters', label: 'Reporters', section: 'reporters' },
  11. { href: '/app/consumers', label: 'Consumers', section: 'consumers' },
  12. { href: '/app/tokens', label: 'Tokens', section: 'tokens' },
  13. { href: '/app/categories', label: 'Categories', section: 'categories' },
  14. { href: '/app/users', label: 'Users', section: 'users', admin_only: true },
  15. { href: '/app/audit', label: 'Audit', section: 'audit' },
  16. { href: '/app/settings', label: 'Settings', section: 'settings' },
  17. { href: '/app/me', label: 'My identity', section: 'me' },
  18. ] %}
  19. {% for link in links %}
  20. {% if link.admin_only is defined and link.admin_only and (current_user is null or current_user.role != 'admin') %}
  21. {# hide admin-only links from non-admins #}
  22. {% elseif link.upcoming is defined %}
  23. <span class="flex items-center justify-between rounded-md px-3 py-1.5 text-slate-400 dark:text-slate-600">
  24. <span>{{ link.label }}</span>
  25. <span class="font-mono text-[0.6rem] uppercase tracking-wider">{{ link.upcoming }}</span>
  26. </span>
  27. {% else %}
  28. {% set is_active = (active_section is defined and active_section == link.section) %}
  29. <a href="{{ link.href }}"
  30. class="rounded-md px-3 py-1.5 {% if is_active %}bg-indigo-50 text-indigo-700 dark:bg-indigo-950 dark:text-indigo-300{% else %}text-slate-700 hover:bg-slate-100 dark:text-slate-200 dark:hover:bg-slate-800{% endif %}"
  31. {% if is_active %}aria-current="page"{% endif %}>
  32. {{ link.label }}
  33. </a>
  34. {% endif %}
  35. {% endfor %}
  36. </nav>
  37. </aside>