history compolated
This commit is contained in:
@@ -2,26 +2,37 @@
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { HistoryTableRowProps } from '../lib/types';
|
||||
import { formatDate, truncateFileName } from '../lib/utils';
|
||||
import { formatDate } from '../lib/utils';
|
||||
import { ResultBadge } from './resultBadge';
|
||||
import { useRouter } from '@/shared/config/i18n/navigation';
|
||||
import { useUserPlagiatStore } from '@/shared/zustand/user';
|
||||
|
||||
export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||
const router = useRouter();
|
||||
const t = useTranslations('HistoryPage');
|
||||
const tUnknown = useTranslations();
|
||||
const user = useUserPlagiatStore((state) => state.user);
|
||||
|
||||
const userName = user
|
||||
? `${user.name} ${user.surname}`
|
||||
: tUnknown('unknownUser');
|
||||
|
||||
return (
|
||||
<tr className="border-b border-slate-100 hover:bg-slate-50/70 transition-colors duration-100 group">
|
||||
{/* Sender */}
|
||||
<td className="px-4 py-3.5">
|
||||
<span className="text-sm font-medium text-slate-800 whitespace-nowrap">
|
||||
{item.senderFullName}
|
||||
{userName}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
{/* File Name */}
|
||||
<td className="px-4 py-3.5">
|
||||
<div className="flex items-center gap-2">
|
||||
<a
|
||||
href={item.file}
|
||||
target="_blank"
|
||||
className="flex items-center gap-2 underline"
|
||||
>
|
||||
<svg
|
||||
width="14"
|
||||
height="14"
|
||||
@@ -33,39 +44,36 @@ export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||
>
|
||||
<path d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" />
|
||||
</svg>
|
||||
<span
|
||||
className="text-sm text-slate-600 font-mono"
|
||||
title={item.fileName}
|
||||
>
|
||||
{truncateFileName(item.fileName)}
|
||||
<span className="text-sm text-slate-600 font-mono" title={item.file}>
|
||||
{tUnknown('file')}
|
||||
</span>
|
||||
</div>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
{/* Date */}
|
||||
<td className="px-4 py-3.5">
|
||||
<span className="text-sm text-slate-500 whitespace-nowrap">
|
||||
{formatDate(item.date)}
|
||||
{formatDate(item.created_at)}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
{/* Amount */}
|
||||
<td className="px-4 py-3.5">
|
||||
{/* <td className="px-4 py-3.5">
|
||||
<span className="text-sm font-medium text-slate-700 whitespace-nowrap tabular-nums">
|
||||
{item.paymentAmount}
|
||||
{item.} UZS
|
||||
</span>
|
||||
</td>
|
||||
</td> */}
|
||||
|
||||
{/* Result */}
|
||||
<td className="px-4 py-3.5">
|
||||
<ResultBadge result={item.result} />
|
||||
<ResultBadge result={'clean'} />
|
||||
</td>
|
||||
|
||||
{/* View Button */}
|
||||
<td className="px-4 py-3.5 text-right">
|
||||
<button
|
||||
onClick={() => router.push(`/${item.id}`)}
|
||||
aria-label={t('viewDetails', { sender: item.senderFullName })}
|
||||
aria-label={t('viewDetails', { sender: item.title })}
|
||||
className="
|
||||
inline-flex items-center gap-1.5 px-3 py-1.5
|
||||
text-xs font-medium text-slate-600
|
||||
|
||||
Reference in New Issue
Block a user