import React, { memo } from 'react'; import type { GeIdResult } from '../types'; import UserResultItem from './UserResultItem'; interface GeIdResultItemProps { result: GeIdResult; onErrorClick: (details: string) => void; } const GeIdResultItem: React.FC = ({ result, onErrorClick }) => { const completionDate = result.completionTime ? (result.completionTime instanceof Date ? result.completionTime : new Date(result.completionTime)) : null; const timeString = completionDate ? completionDate.toLocaleTimeString('vi-VN') : '-'; // Lấy URL từ detail đầu tiên (tất cả details trong cùng GE/lang đều có cùng URL) const tmsUrl = result.details?.[0]?.url; // Format hiển thị: "1000 DE (https://tms.../project/18?l=de_DE)" // geIdAndLang có dạng "1000 de" hoặc "1000 US" - cần in hoa lang const formatGeIdAndLang = () => { const parts = result.geIdAndLang.split(' '); if (parts.length >= 2) { const geId = parts[0]; const lang = parts.slice(1).join(' ').toUpperCase(); return `${geId} ${lang}`; } return result.geIdAndLang.toUpperCase(); }; return (

{formatGeIdAndLang()} {tmsUrl && ( <> {' '} ( {tmsUrl} ) )}

{timeString}
{(result.details || []).map((detail, index) => ( ))}
); }; export default memo(GeIdResultItem);