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:
lorentz 2026-05-07 08:43:27 -04:00
parent 91b876310e
commit 8f955a0ff9
17 changed files with 94 additions and 53 deletions

View file

@ -22,6 +22,7 @@ import { ShareModal } from './share-modal';
import { AnalyzeButton } from './analyze-button';
import { AnalysisMarkdown } from './analysis-markdown';
import type { PersistedAnalysis, Visibility } from '@/lib/types/analyzer';
import { useUserTimezone } from '@/lib/hooks/use-user-timezone';
interface AnalysisViewProps {
analysis: PersistedAnalysis;
@ -70,6 +71,7 @@ function ModelBadges({ a }: { a: PersistedAnalysis }) {
}
export function AnalysisView({ analysis: a }: AnalysisViewProps) {
const tz = useUserTimezone();
const [expandedEvent, setExpandedEvent] = useState<number | null>(null);
const [nextStepOpen, setNextStepOpen] = useState(false);
@ -112,7 +114,7 @@ export function AnalysisView({ analysis: a }: AnalysisViewProps) {
)}
</div>
<CardTitle className="text-xl">
AI Analysis &middot; {new Date(a.triggeredAt).toLocaleString()}
AI Analysis &middot; {new Date(a.triggeredAt).toLocaleString(undefined, { timeZone: tz })}
</CardTitle>
<p className="text-muted-foreground text-sm">
{a.totalInputTokens.toLocaleString()} in /{' '}
@ -219,7 +221,7 @@ export function AnalysisView({ analysis: a }: AnalysisViewProps) {
{VISIBILITY_MARKER[event.visibility]}
</span>
<span className="font-mono text-xs text-muted-foreground shrink-0">
{new Date(event.timestamp).toLocaleString()}
{new Date(event.timestamp).toLocaleString(undefined, { timeZone: tz })}
</span>
<span className="font-medium">{event.actor}</span>
<Badge variant="outline" className="text-xs">
@ -307,7 +309,7 @@ export function AnalysisView({ analysis: a }: AnalysisViewProps) {
onClick={() => jumpToEvent(ts)}
className="underline mr-2 font-mono"
>
{new Date(ts).toLocaleString()}
{new Date(ts).toLocaleString(undefined, { timeZone: tz })}
</button>
))}
</div>
@ -398,7 +400,7 @@ export function AnalysisView({ analysis: a }: AnalysisViewProps) {
<CardContent className="space-y-2 text-sm">
<p>
<strong>{a.timeline[expandedEvent].actor}</strong> ·{' '}
{new Date(a.timeline[expandedEvent].timestamp).toLocaleString()}
{new Date(a.timeline[expandedEvent].timestamp).toLocaleString(undefined, { timeZone: tz })}
</p>
<p>{a.timeline[expandedEvent].action}</p>
<Separator />