"use client"; import * as React from "react"; import { cn } from "./lib/utils"; export interface Session { id: string; device: string; location: string; lastActive: string; current?: boolean; icon?: "desktop" | "mobile" | "tablet"; } export interface SessionListProps extends React.HTMLAttributes { sessions: Session[]; onRevoke?: (id: string) => void; } /** Active login sessions: device + location + activity + revoke. */ export function SessionList({ sessions, onRevoke, className, ...props }: SessionListProps) { const [revoked, setRevoked] = React.useState([]); const deviceIcon = (icon?: Session["icon"]) => { const paths: Record = { desktop: <>, mobile: <>, tablet: <>, }; return paths[icon ?? "desktop"] ?? paths.desktop; }; const visible = sessions.filter((s) => !revoked.includes(s.id)); return (
{visible.map((s, idx) => (
{s.device} {s.current && ( Bu cihaz )}

{s.location} ยท {s.lastActive}

{!s.current && ( )}
))} {visible.length === 0 && (

All other active sessions revoked.

)}
); }