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

@ -5,6 +5,7 @@ import { Loader2, Monitor, Smartphone, Trash2, Globe } from "lucide-react";
import { toast } from "sonner";
import { Button } from "@/components/ui/button";
import { Badge } from "@/components/ui/badge";
import { useUserTimezone } from "@/lib/hooks/use-user-timezone";
interface Session {
id: string;
@ -32,6 +33,7 @@ function parseUserAgent(ua: string): { device: string; browser: string } {
}
export function ActiveSessions({ userId }: ActiveSessionsProps) {
const tz = useUserTimezone();
const [sessions, setSessions] = useState<Session[]>([]);
const [isLoading, setIsLoading] = useState(true);
const [revokingId, setRevokingId] = useState<string | null>(null);
@ -115,7 +117,7 @@ export function ActiveSessions({ userId }: ActiveSessionsProps) {
<Globe className="h-3 w-3" />
{session.ip_address || "Unknown IP"}
<span></span>
{new Date(session.created_at).toLocaleDateString()}
{new Date(session.created_at).toLocaleDateString(undefined, { timeZone: tz })}
</div>
</div>
</div>