'use client'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import { Building2, Clock3 } from 'lucide-react'; import { pickAppText } from '@/lib/i18n/core'; import { useAppI18n } from '@/lib/i18n/provider'; import { cn } from '@/lib/utils'; const TASK_MANAGEMENT_TABS = [ { label: 'Office', href: '/office', icon: Building2, match: (pathname: string) => pathname === '/office' || pathname.startsWith('/office/'), }, { label: 'Scheduled tasks', href: '/cron', icon: Clock3, match: (pathname: string) => pathname === '/cron' || pathname.startsWith('/cron/'), }, ] as const; export function TaskManagementTabs() { const { locale } = useAppI18n(); const pathname = usePathname(); return (
{TASK_MANAGEMENT_TABS.map((tab) => { const isActive = tab.match(pathname); const Icon = tab.icon; return ( {tab.href === '/cron' ? pickAppText(locale, '定时任务', 'Scheduled tasks') : pickAppText(locale, '办公室', 'Office')} ); })}
); }