veza/apps/web/src/components/views/analytics-view/AnalyticsViewHeader.tsx
senke de12f5036c fix(web): resolve all 568 TypeScript errors — tsc --noEmit now passes with zero errors
Major categories fixed:
- TS6133 (188): Remove unused imports (React, icons, types) and variables
- TS2322 (222): Fix type mismatches in stories (satisfies Meta -> const meta: Meta),
  add nullish coalescing for optional values, fix component prop types
- TS2345 (43): Fix argument type mismatches with proper null checks and type narrowing
- TS2741 (21): Add missing required properties to mock/story data
- TS2339 (19): Fix property access on incorrect types, add type guards
- TS2353 (13): Remove extra properties from object literals or extend interfaces
- TS2352 (11): Fix type conversion chains
- TS2307 (9): Fix import paths and module references
- Other (42): Fix implicit any, possibly undefined, export declarations

Vite build and tsc --noEmit both pass cleanly.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-13 00:32:08 +01:00

67 lines
2.2 KiB
TypeScript

import { Button } from '@/components/ui/button';
import { Activity, Download } from 'lucide-react';
import { cn } from '@/lib/utils';
import type { DateRangeKey } from './types';
const RANGES: DateRangeKey[] = ['7d', '30d', '90d', 'ytd'];
interface AnalyticsViewHeaderProps {
dateRange: DateRangeKey;
onDateRangeChange: (range: DateRangeKey) => void;
onExportCsv: () => void;
onExportJson: () => void;
}
export function AnalyticsViewHeader({
dateRange,
onDateRangeChange,
onExportCsv,
onExportJson,
}: AnalyticsViewHeaderProps) {
return (
<div className="flex flex-col lg:flex-row justify-between items-start lg:items-end gap-6 border-b border-white/5 pb-8">
<div>
<h1 className="text-4xl font-heading font-bold text-foreground mb-2 flex items-center gap-3">
<Activity className="text-primary w-8 h-8" /> NEURAL ANALYTICS
</h1>
<p className="text-muted-foreground font-mono text-xs tracking-wide">
DEEP PACKET INSPECTION AUDIENCE METRICS
</p>
</div>
<div className="flex flex-wrap items-center gap-3">
<div className="bg-black/40 p-1 rounded-xl border border-white/10 backdrop-blur-md flex">
{RANGES.map((range) => (
<button
key={range}
type="button"
onClick={() => onDateRangeChange(range)}
className={cn(
'px-4 py-2 rounded-lg text-xs font-bold uppercase tracking-widest transition-all',
dateRange === range
? 'bg-primary text-black shadow-glow-cyan'
: 'text-muted-foreground hover:text-foreground'
)}
>
{range}
</button>
))}
</div>
<div className="flex gap-2">
<Button
variant="outline"
size="sm"
onClick={onExportCsv}
className="border-white/10 hover:border-primary/50"
>
<Download className="w-4 h-4 mr-2" /> CSV
</Button>
<Button variant="primary" size="sm" onClick={onExportJson} className="shadow-glow-cyan">
REPORT
</Button>
</div>
</div>
</div>
);
}