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
|
|
@ -12,6 +12,7 @@ import {
|
|||
XAxis,
|
||||
YAxis,
|
||||
} from 'recharts';
|
||||
import { useUserTimezone } from '@/lib/hooks/use-user-timezone';
|
||||
|
||||
interface ResolutionPoint {
|
||||
date: string;
|
||||
|
|
@ -23,18 +24,19 @@ interface ResolutionTrendProps {
|
|||
height?: number;
|
||||
}
|
||||
|
||||
function fmtDate(iso: string) {
|
||||
return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
|
||||
function fmtDate(iso: string, tz: string) {
|
||||
return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric', timeZone: tz });
|
||||
}
|
||||
|
||||
export function ResolutionTrend({ data, height = 180 }: ResolutionTrendProps) {
|
||||
const tz = useUserTimezone();
|
||||
return (
|
||||
<ResponsiveContainer width="100%" height={height}>
|
||||
<LineChart data={data} margin={{ top: 4, right: 8, bottom: 4, left: 0 }}>
|
||||
<CartesianGrid stroke="var(--border)" strokeDasharray="2 4" vertical={false} />
|
||||
<XAxis
|
||||
dataKey="date"
|
||||
tickFormatter={fmtDate}
|
||||
tickFormatter={(iso: string) => fmtDate(iso, tz)}
|
||||
interval="preserveStartEnd"
|
||||
minTickGap={48}
|
||||
tick={{ fontSize: 11, fill: 'var(--muted-foreground)' }}
|
||||
|
|
@ -55,7 +57,7 @@ export function ResolutionTrend({ data, height = 180 }: ResolutionTrendProps) {
|
|||
borderRadius: 6,
|
||||
fontSize: 12,
|
||||
}}
|
||||
labelFormatter={(value) => fmtDate(String(value))}
|
||||
labelFormatter={(value) => fmtDate(String(value), tz)}
|
||||
formatter={(value) =>
|
||||
value == null ? ['—', 'avg'] : [`${Number(value).toFixed(1)} h`, 'avg']
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ import {
|
|||
XAxis,
|
||||
YAxis,
|
||||
} from 'recharts';
|
||||
import { useUserTimezone } from '@/lib/hooks/use-user-timezone';
|
||||
|
||||
interface VolumePoint {
|
||||
date: string;
|
||||
|
|
@ -24,11 +25,12 @@ interface VolumeTrendProps {
|
|||
height?: number;
|
||||
}
|
||||
|
||||
function fmtDate(iso: string) {
|
||||
return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
|
||||
function fmtDate(iso: string, tz: string) {
|
||||
return new Date(iso).toLocaleDateString(undefined, { month: 'short', day: 'numeric', timeZone: tz });
|
||||
}
|
||||
|
||||
export function VolumeTrend({ data, height = 180 }: VolumeTrendProps) {
|
||||
const tz = useUserTimezone();
|
||||
return (
|
||||
<ResponsiveContainer width="100%" height={height}>
|
||||
<AreaChart data={data} margin={{ top: 4, right: 8, bottom: 4, left: 0 }}>
|
||||
|
|
@ -40,7 +42,7 @@ export function VolumeTrend({ data, height = 180 }: VolumeTrendProps) {
|
|||
</defs>
|
||||
<XAxis
|
||||
dataKey="date"
|
||||
tickFormatter={fmtDate}
|
||||
tickFormatter={(iso: string) => fmtDate(iso, tz)}
|
||||
interval="preserveStartEnd"
|
||||
minTickGap={48}
|
||||
tick={{ fontSize: 11, fill: 'var(--muted-foreground)' }}
|
||||
|
|
@ -61,7 +63,7 @@ export function VolumeTrend({ data, height = 180 }: VolumeTrendProps) {
|
|||
borderRadius: 6,
|
||||
fontSize: 12,
|
||||
}}
|
||||
labelFormatter={(value) => fmtDate(String(value))}
|
||||
labelFormatter={(value) => fmtDate(String(value), tz)}
|
||||
formatter={(value) => [value ?? 0, 'opened']}
|
||||
/>
|
||||
<Area
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue