feat(07.1-05): user-tz on shared client components
- DetailModal: thread tz through resolveLabel(...) module helper + default export's 3 inline date/time calls. - IntegrationStatusTabs: thread tz through fmtDate helper + VeeamTab sub-component prop. - SyncScheduler: thread tz into closure-scoped formatDate helper. - audit-log-table, user-table, user-sessions, active-sessions: inline toLocale calls in component body. - analysis-view: useUserTimezone in AnalysisView; thread tz into 4 toLocaleString calls. - resolution-trend, volume-trend (recharts): module-scope fmtDate(iso) → fmtDate(iso, tz); useUserTimezone in named export; thread tz into axis tickFormatter + tooltip labelFormatter. - ticket-detail-modal: thread tz into formatDate arrow inside TicketDetailModal. - TimelineView: useUserTimezone; thread tz into 4 toLocale*String calls (hour/day/month/event-time formatters). - ScoreCard: useUserTimezone in AggregateScoreCard; thread tz into the date-range latest call. - addigy-tab: useUserTimezone in AddigyTab; thread tz into 2 inline calls. - activity-sparkline: module-scope fmtHour(iso) → fmtHour(iso, tz); useUserTimezone in ActivitySparkline; update 3 callsites in title/aria. - compliance-detail-table: thread tz from ComplianceDetailTable into ContractCoverageModal sub-component (2 inline date calls). - company-backup-detail: module-scope formatDate(d) → formatDate(d, tz); useUserTimezone in CompanyBackupDetail; update 3 callsites. Migrates 31 of 81 audit leak callsites.
This commit is contained in:
parent
91b876310e
commit
8f955a0ff9
17 changed files with 94 additions and 53 deletions
|
|
@ -24,6 +24,7 @@ import {
|
|||
TimeEntryAnalysis,
|
||||
AggregateAnalysis
|
||||
} from '@/lib/types/analytics';
|
||||
import { useUserTimezone } from '@/lib/hooks/use-user-timezone';
|
||||
|
||||
interface ScoreCardProps {
|
||||
title: string;
|
||||
|
|
@ -424,6 +425,7 @@ interface AggregateScoreCardProps {
|
|||
}
|
||||
|
||||
export function AggregateScoreCard({ analysis, className }: AggregateScoreCardProps) {
|
||||
const tz = useUserTimezone();
|
||||
return (
|
||||
<Card className={className}>
|
||||
<CardHeader>
|
||||
|
|
@ -483,7 +485,7 @@ export function AggregateScoreCard({ analysis, className }: AggregateScoreCardPr
|
|||
<div className="flex justify-between">
|
||||
<span className="text-gray-600">Date Range:</span>
|
||||
<span className="font-medium">
|
||||
{analysis.dateRange.latest.toLocaleDateString()}
|
||||
{analysis.dateRange.latest.toLocaleDateString(undefined, { timeZone: tz })}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,6 +9,7 @@ import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@
|
|||
import { Calendar, Clock, Users, ChevronDown, ChevronRight, Activity, AlertCircle, CheckCircle } from 'lucide-react';
|
||||
import { TimelineEvent, TimelineView as TimelineViewType } from '@/lib/types/analytics';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { useUserTimezone } from '@/lib/hooks/use-user-timezone';
|
||||
|
||||
interface TimelineViewProps {
|
||||
events: TimelineEvent[];
|
||||
|
|
@ -18,13 +19,14 @@ interface TimelineViewProps {
|
|||
className?: string;
|
||||
}
|
||||
|
||||
export function TimelineView({
|
||||
events,
|
||||
timeRange,
|
||||
onTimeRangeChange,
|
||||
export function TimelineView({
|
||||
events,
|
||||
timeRange,
|
||||
onTimeRangeChange,
|
||||
loading = false,
|
||||
className
|
||||
className
|
||||
}: TimelineViewProps) {
|
||||
const tz = useUserTimezone();
|
||||
const [expandedSections, setExpandedSections] = useState<Set<string>>(new Set());
|
||||
const [selectedEvent, setSelectedEvent] = useState<TimelineEvent | null>(null);
|
||||
|
||||
|
|
@ -135,12 +137,14 @@ export function TimelineView({
|
|||
day: 'numeric',
|
||||
hour: 'numeric',
|
||||
hour12: true,
|
||||
timeZone: tz,
|
||||
});
|
||||
case 'day':
|
||||
return new Date(groupKey).toLocaleDateString('en-US', {
|
||||
weekday: 'long',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
timeZone: tz,
|
||||
});
|
||||
case 'week':
|
||||
return groupKey;
|
||||
|
|
@ -148,6 +152,7 @@ export function TimelineView({
|
|||
return new Date(groupKey + '-01').toLocaleDateString('en-US', {
|
||||
month: 'long',
|
||||
year: 'numeric',
|
||||
timeZone: tz,
|
||||
});
|
||||
default:
|
||||
return groupKey;
|
||||
|
|
@ -300,7 +305,7 @@ export function TimelineView({
|
|||
<div className="flex items-center gap-4 text-xs text-gray-500">
|
||||
<span className="flex items-center gap-1">
|
||||
<Clock className="h-3 w-3" />
|
||||
{new Date(event.timestamp).toLocaleTimeString()}
|
||||
{new Date(event.timestamp).toLocaleTimeString(undefined, { timeZone: tz })}
|
||||
</span>
|
||||
|
||||
{event.duration && (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue