All files / web/src/components AdminNav.tsx

0% Statements 0/192
0% Branches 0/1
0% Functions 0/1
0% Lines 0/192

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193                                                                                                                                                                                                                                                                                                                                                                                                 
'use client'

import Link from 'next/link'
import { usePathname } from 'next/navigation'
import { css } from '../../styled-system/css'

interface AdminNavItem {
  href: string
  label: string
  description: string
}

const adminNavItems: AdminNavItem[] = [
  {
    href: '/admin',
    label: 'Dashboard',
    description: 'System overview',
  },
  {
    href: '/admin/tasks',
    label: 'Tasks',
    description: 'Background jobs',
  },
  {
    href: '/admin/bkt-settings',
    label: 'BKT',
    description: 'Skill classification',
  },
  {
    href: '/admin/practice-config',
    label: 'Practice',
    description: 'Term scaling',
  },
  {
    href: '/flowchart/admin',
    label: 'Flowcharts',
    description: 'Curriculum',
  },
  {
    href: '/admin/constant-images',
    label: 'Images',
    description: 'Constant illustrations',
  },
  {
    href: '/admin/blog-images',
    label: 'Blog',
    description: 'Post hero images',
  },
  {
    href: '/admin/homepage-previews',
    label: 'Homepage',
    description: 'Preview images',
  },
  {
    href: '/admin/page-spots',
    label: 'Spots',
    description: 'Page content spots',
  },
  {
    href: '/admin/audio',
    label: 'Audio',
    description: 'TTS clips',
  },
  {
    href: '/admin/tts-lab',
    label: 'TTS Lab',
    description: 'Reliability tests',
  },
  {
    href: '/admin/characters',
    label: 'Characters',
    description: 'Prompt system',
  },
  {
    href: '/admin/feature-flags',
    label: 'Flags',
    description: 'Feature flags',
  },
  {
    href: '/admin/pricing',
    label: 'Pricing',
    description: 'Stripe prices',
  },
  {
    href: '/admin/subscriptions',
    label: 'Tiers',
    description: 'User subscriptions',
  },
  {
    href: '/admin/notifications',
    label: 'Notifications',
    description: 'Channel config',
  },
  {
    href: '/admin/songs',
    label: 'Songs',
    description: 'Session songs',
  },
  {
    href: '/admin/postcards',
    label: 'Postcards',
    description: 'Generation pipeline',
  },
  {
    href: '/admin/ai-usage',
    label: 'AI Usage',
    description: 'Cost tracking',
  },
  {
    href: '/vision-training',
    label: 'Vision',
    description: 'ML training',
  },
]

/**
 * Secondary navigation bar for admin pages.
 * Shows tabs for switching between admin tools.
 */
export function AdminNav() {
  const pathname = usePathname()

  // Determine which nav item is active
  const isActive = (href: string) => {
    if (href === '/admin') {
      return pathname === '/admin'
    }
    return pathname.startsWith(href)
  }

  return (
    <nav
      className={css({
        backgroundColor: '#161b22',
        borderBottom: '1px solid #30363d',
        padding: '0 24px',
      })}
    >
      <div
        className={css({
          maxWidth: '1200px',
          margin: '0 auto',
          display: 'flex',
          gap: '4px',
          overflowX: 'auto',
          scrollbarWidth: 'none',
          '&::-webkit-scrollbar': { display: 'none' },
        })}
      >
        {adminNavItems.map((item) => (
          <Link
            key={item.href}
            href={item.href}
            className={css({
              display: 'flex',
              flexDirection: 'column',
              padding: '12px 16px',
              textDecoration: 'none',
              borderBottom: '2px solid',
              borderColor: isActive(item.href) ? '#58a6ff' : 'transparent',
              backgroundColor: isActive(item.href) ? '#1c2128' : 'transparent',
              transition: 'all 0.15s',
              whiteSpace: 'nowrap',
              '&:hover': {
                backgroundColor: '#1c2128',
              },
            })}
          >
            <span
              className={css({
                fontSize: '13px',
                fontWeight: '600',
                color: isActive(item.href) ? '#f0f6fc' : '#c9d1d9',
              })}
            >
              {item.label}
            </span>
            <span
              className={css({
                fontSize: '11px',
                color: '#8b949e',
                marginTop: '2px',
              })}
            >
              {item.description}
            </span>
          </Link>
        ))}
      </div>
    </nav>
  )
}