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 {
|
|||
AlertDialogHeader,
|
||||
AlertDialogTitle,
|
||||
} from "@/components/ui/alert-dialog";
|
||||
import { useUserTimezone } from "@/lib/hooks/use-user-timezone";
|
||||
|
||||
interface Session {
|
||||
id: string;
|
||||
|
|
@ -52,6 +53,7 @@ function parseUserAgent(ua: string): { device: string; browser: string } {
|
|||
}
|
||||
|
||||
export function UserSessions({ sessions, userId }: UserSessionsProps) {
|
||||
const tz = useUserTimezone();
|
||||
const router = useRouter();
|
||||
const [isLoading, setIsLoading] = useState(false);
|
||||
const [showRevokeAllDialog, setShowRevokeAllDialog] = useState(false);
|
||||
|
|
@ -158,10 +160,10 @@ export function UserSessions({ sessions, userId }: UserSessionsProps) {
|
|||
</div>
|
||||
</TableCell>
|
||||
<TableCell className="text-muted-foreground">
|
||||
{new Date(session.created_at).toLocaleString()}
|
||||
{new Date(session.created_at).toLocaleString(undefined, { timeZone: tz })}
|
||||
</TableCell>
|
||||
<TableCell className="text-muted-foreground">
|
||||
{new Date(session.expires_at).toLocaleString()}
|
||||
{new Date(session.expires_at).toLocaleString(undefined, { timeZone: tz })}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<Button
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ import { Badge } from "@/components/ui/badge";
|
|||
import { RoleBadge } from "./role-badge";
|
||||
import { UserActions } from "./user-actions";
|
||||
import { useSession } from "@/lib/auth-client";
|
||||
import { useUserTimezone } from "@/lib/hooks/use-user-timezone";
|
||||
|
||||
interface User {
|
||||
id: string;
|
||||
|
|
@ -43,6 +44,7 @@ interface Pagination {
|
|||
}
|
||||
|
||||
export function UserTable() {
|
||||
const tz = useUserTimezone();
|
||||
const router = useRouter();
|
||||
const searchParams = useSearchParams();
|
||||
const { data: session } = useSession();
|
||||
|
|
@ -202,7 +204,7 @@ export function UserTable() {
|
|||
)}
|
||||
</TableCell>
|
||||
<TableCell className="text-muted-foreground">
|
||||
{new Date(user.created_at).toLocaleDateString()}
|
||||
{new Date(user.created_at).toLocaleDateString(undefined, { timeZone: tz })}
|
||||
</TableCell>
|
||||
<TableCell>
|
||||
<UserActions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue