import React, { useState } from 'react'; import type { StudentItem, StudentSessionLogItem } from '../api'; import { StudentAvatar, StudentOnlineBadge } from './StudentAvatar'; import { ProctorStreamPanels } from './ProctorStreamPanels'; interface StudentDetailModalProps { student: StudentItem; isOnline: boolean; sessionLog?: StudentSessionLogItem | null; onClose: () => void; } const formatDuration = (totalSeconds: number) => { const hrs = Math.floor(totalSeconds / 3600); const mins = Math.floor((totalSeconds % 3600) / 60); const secs = totalSeconds % 60; const pad = (n: number) => String(n).padStart(2, '0'); return `${pad(hrs)}:${pad(mins)}:${pad(secs)}`; }; export const StudentDetailModal: React.FC = ({ student, isOnline, sessionLog, onClose, }) => { const [showProctor, setShowProctor] = useState(false); return (
e.stopPropagation()}>

{student.fullName}

{student.studentCode} {student.email && <> · {student.email}}

Trạng thái
{student.phone && (
Điện thoại {student.phone}
)} {sessionLog && ( <>
Online (ca) {formatDuration(sessionLog.onlineSeconds)}
Offline (ca) {formatDuration(sessionLog.offlineSeconds)}
{sessionLog.wifiSsids && sessionLog.wifiSsids !== '—' && (
WiFi {sessionLog.wifiSsids}
)} )}
{!isOnline && !showProctor && (

Sinh viên offline — stream chỉ có khi app Simple Care đang chạy.

)}
{showProctor && (
)}
); };