This repository has been archived on 2026-02-15. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
BreakPilot Dev 19855efacc
Some checks failed
Tests / Go Tests (push) Has been cancelled
Tests / Python Tests (push) Has been cancelled
Tests / Integration Tests (push) Has been cancelled
Tests / Go Lint (push) Has been cancelled
Tests / Python Lint (push) Has been cancelled
Tests / Security Scan (push) Has been cancelled
Tests / All Checks Passed (push) Has been cancelled
Security Scanning / Secret Scanning (push) Has been cancelled
Security Scanning / Dependency Vulnerability Scan (push) Has been cancelled
Security Scanning / Go Security Scan (push) Has been cancelled
Security Scanning / Python Security Scan (push) Has been cancelled
Security Scanning / Node.js Security Scan (push) Has been cancelled
Security Scanning / Docker Image Security (push) Has been cancelled
Security Scanning / Security Summary (push) Has been cancelled
CI/CD Pipeline / Go Tests (push) Has been cancelled
CI/CD Pipeline / Python Tests (push) Has been cancelled
CI/CD Pipeline / Website Tests (push) Has been cancelled
CI/CD Pipeline / Linting (push) Has been cancelled
CI/CD Pipeline / Security Scan (push) Has been cancelled
CI/CD Pipeline / Docker Build & Push (push) Has been cancelled
CI/CD Pipeline / Integration Tests (push) Has been cancelled
CI/CD Pipeline / Deploy to Staging (push) Has been cancelled
CI/CD Pipeline / Deploy to Production (push) Has been cancelled
CI/CD Pipeline / CI Summary (push) Has been cancelled
ci/woodpecker/manual/build-ci-image Pipeline was successful
ci/woodpecker/manual/main Pipeline failed
feat: BreakPilot PWA - Full codebase (clean push without large binaries)
All services: admin-v2, studio-v2, website, ai-compliance-sdk,
consent-service, klausur-service, voice-service, and infrastructure.
Large PDFs and compiled binaries excluded via .gitignore.
2026-02-11 13:25:58 +01:00

122 lines
3.7 KiB
TypeScript

'use client'
import { useRef, useEffect } from 'react'
import {
ShieldAlert,
FileText,
Building2,
Bot,
BookOpen,
Database,
} from 'lucide-react'
import type {
CatalogModule,
CatalogOverviewStats,
} from '@/lib/sdk/catalog-manager/types'
import { CATALOG_MODULE_LABELS } from '@/lib/sdk/catalog-manager/types'
interface CatalogModuleTabsProps {
activeModule: CatalogModule | 'all'
onModuleChange: (module: CatalogModule | 'all') => void
stats: CatalogOverviewStats
}
const MODULE_ICON_MAP: Record<CatalogModule, React.ComponentType<{ className?: string }>> = {
dsfa: ShieldAlert,
vvt: FileText,
vendor: Building2,
ai_act: Bot,
reference: BookOpen,
}
interface TabDefinition {
key: CatalogModule | 'all'
label: string
icon: React.ComponentType<{ className?: string }>
}
export default function CatalogModuleTabs({
activeModule,
onModuleChange,
stats,
}: CatalogModuleTabsProps) {
const scrollRef = useRef<HTMLDivElement>(null)
const activeTabRef = useRef<HTMLButtonElement>(null)
// Scroll active tab into view on mount and when active changes
useEffect(() => {
if (activeTabRef.current && scrollRef.current) {
const container = scrollRef.current
const tab = activeTabRef.current
const containerRect = container.getBoundingClientRect()
const tabRect = tab.getBoundingClientRect()
if (tabRect.left < containerRect.left || tabRect.right > containerRect.right) {
tab.scrollIntoView({ behavior: 'smooth', block: 'nearest', inline: 'center' })
}
}
}, [activeModule])
const tabs: TabDefinition[] = [
{ key: 'all', label: 'Alle', icon: Database },
...Object.entries(CATALOG_MODULE_LABELS).map(([key, label]) => ({
key: key as CatalogModule,
label,
icon: MODULE_ICON_MAP[key as CatalogModule],
})),
]
const getCount = (key: CatalogModule | 'all'): number => {
if (key === 'all') {
return stats.totalEntries
}
return stats.byModule?.[key]?.entries ?? 0
}
return (
<div className="bg-white dark:bg-gray-800 rounded-lg shadow">
<div
ref={scrollRef}
className="flex overflow-x-auto scrollbar-hide border-b border-gray-200 dark:border-gray-700"
style={{ scrollbarWidth: 'none', msOverflowStyle: 'none' }}
>
{tabs.map(tab => {
const isActive = activeModule === tab.key
const Icon = tab.icon
const count = getCount(tab.key)
return (
<button
key={tab.key}
ref={isActive ? activeTabRef : undefined}
onClick={() => onModuleChange(tab.key)}
className={`relative flex items-center gap-2 px-4 py-3 text-sm font-medium whitespace-nowrap transition-colors shrink-0 ${
isActive
? 'text-violet-700 dark:text-violet-400 font-semibold'
: 'text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-200'
}`}
>
<Icon className="h-4 w-4 shrink-0" />
<span>{tab.label}</span>
<span
className={`inline-flex items-center justify-center min-w-[20px] h-5 px-1.5 text-xs font-medium rounded-full ${
isActive
? 'bg-violet-100 dark:bg-violet-900/40 text-violet-700 dark:text-violet-300'
: 'bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400'
}`}
>
{count}
</span>
{/* Active indicator line */}
{isActive && (
<span className="absolute bottom-0 left-0 right-0 h-0.5 bg-violet-600 dark:bg-violet-400 rounded-t" />
)}
</button>
)
})}
</div>
</div>
)
}