added multi language features
This commit is contained in:
@@ -1,6 +1,104 @@
|
||||
{
|
||||
"HomePage": {
|
||||
"title": "Salom dunyo!",
|
||||
"title": "Hello world!",
|
||||
"about": "Go to the about page"
|
||||
},
|
||||
"Navbar": {
|
||||
"logo": "Plagat",
|
||||
"aboutSite": "About Site",
|
||||
"contact": "Contact",
|
||||
"login": "Login",
|
||||
"signup": "Sign up",
|
||||
"profile": "Profile",
|
||||
"logout": "Logout"
|
||||
},
|
||||
"Footer": {
|
||||
"product": "Product",
|
||||
"overview": "Overview",
|
||||
"pricing": "Pricing",
|
||||
"marketplace": "Marketplace",
|
||||
"features": "Features",
|
||||
"company": "Company",
|
||||
"about": "About",
|
||||
"team": "Team",
|
||||
"blog": "Blog",
|
||||
"careers": "Careers",
|
||||
"resources": "Resources",
|
||||
"help": "Help",
|
||||
"sales": "Sales",
|
||||
"advertise": "Advertise",
|
||||
"privacy": "Privacy",
|
||||
"copyright": "© {year} Felix IT Solutions. All rights reserved.",
|
||||
"terms": "Terms and Conditions"
|
||||
},
|
||||
"PlagiarismCheck": {
|
||||
"badge": "Originality Check",
|
||||
"title": "Submit Your Document",
|
||||
"description": "Upload a document to verify its originality. Results are typically ready within a few minutes.",
|
||||
"documentTopic": "Document Topic",
|
||||
"topicPlaceholder": "e.g. The Impact of Artificial Intelligence on Education",
|
||||
"senderFullName": "Sender Full Name",
|
||||
"notLoggedIn": "Not logged in",
|
||||
"certificateOption": "Certificate Option",
|
||||
"documentFile": "Document File",
|
||||
"clickToUpload": "Click to upload document",
|
||||
"fileTypes": "PDF, DOC, DOCX, TXT · Max 20 MB",
|
||||
"autoFilled": "Auto-filled",
|
||||
"removeFile": "Remove file",
|
||||
"certificateTitle": "Return result with certificate",
|
||||
"certificateDescription": "An official certificate will be attached to your originality report.",
|
||||
"submitting": "Submitting…",
|
||||
"submitButton": "Submit for Originality Check",
|
||||
"dismiss": "Dismiss"
|
||||
},
|
||||
"HistoryPage": {
|
||||
"title": "Check History",
|
||||
"description": "All plagiarism checks submitted by you",
|
||||
"sender": "Sender",
|
||||
"file": "File",
|
||||
"date": "Date",
|
||||
"amount": "Amount",
|
||||
"result": "Result",
|
||||
"actions": "",
|
||||
"emptyMessage": "No plagiarism checks found.",
|
||||
"tryAgain": "Try again",
|
||||
"view": "View",
|
||||
"viewDetails": "View details for {sender}",
|
||||
"pagination": "Page {current} of {total}",
|
||||
"previousPage": "Previous page",
|
||||
"nextPage": "Next page",
|
||||
"page": "Page {page}",
|
||||
"resultClean": "Clean",
|
||||
"resultPlagiarismFound": "Plagiarism Found",
|
||||
"resultPending": "Pending",
|
||||
"resultFailed": "Failed"
|
||||
},
|
||||
"DetailPage": {
|
||||
"id": "ID",
|
||||
"submissionDetails": "Submission Details",
|
||||
"sender": "Sender",
|
||||
"fileName": "File Name",
|
||||
"fileSize": "File Size",
|
||||
"submitted": "Submitted",
|
||||
"payment": "Payment",
|
||||
"resultTitle": "Result",
|
||||
"analysisInProgress": "Analysis in progress",
|
||||
"resultsReadyAfterProcessing": "Results will appear once processing is complete.",
|
||||
"noResultAvailable": "No result available.",
|
||||
"plagiarismResult": "Plagiarism Result",
|
||||
"wordsChecked": "Words Checked",
|
||||
"wordsMatched": "Words Matched",
|
||||
"matchedSources": "Matched Sources",
|
||||
"processedAt": "Processed At",
|
||||
"certificate": "Certificate",
|
||||
"noCertificate": "No certificate issued for this check.",
|
||||
"noCertificateHighSimilarity": "Certificates are not issued for high-similarity results.",
|
||||
"issued": "Issued",
|
||||
"expires": "Expires",
|
||||
"issuer": "Issuer",
|
||||
"certificateId": "Certificate ID",
|
||||
"downloadCertificate": "Download Certificate",
|
||||
"unknownError": "Unknown error",
|
||||
"words": "words"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,104 @@
|
||||
{
|
||||
"HomePage": {
|
||||
"title": "Hello world!",
|
||||
"about": "Go to the about page"
|
||||
"title": "Привет мир!",
|
||||
"about": "Перейти на страницу о нас"
|
||||
},
|
||||
"Navbar": {
|
||||
"logo": "Plagat",
|
||||
"aboutSite": "О сайте",
|
||||
"contact": "Контакты",
|
||||
"login": "Войти",
|
||||
"signup": "Регистрация",
|
||||
"profile": "Профиль",
|
||||
"logout": "Выйти"
|
||||
},
|
||||
"Footer": {
|
||||
"product": "Продукт",
|
||||
"overview": "Обзор",
|
||||
"pricing": "Цены",
|
||||
"marketplace": "Маркетплейс",
|
||||
"features": "Функции",
|
||||
"company": "Компания",
|
||||
"about": "О нас",
|
||||
"team": "Команда",
|
||||
"blog": "Блог",
|
||||
"careers": "Карьера",
|
||||
"resources": "Ресурсы",
|
||||
"help": "Помощь",
|
||||
"sales": "Продажи",
|
||||
"advertise": "Реклама",
|
||||
"privacy": "Конфиденциальность",
|
||||
"copyright": "© {year} Felix IT Solutions. Все права защищены.",
|
||||
"terms": "Условия и положения"
|
||||
},
|
||||
"PlagiarismCheck": {
|
||||
"badge": "Проверка оригинальности",
|
||||
"title": "Отправьте ваш документ",
|
||||
"description": "Загрузите документ для проверки его оригинальности. Результаты обычно готовы в течение нескольких минут.",
|
||||
"documentTopic": "Тема документа",
|
||||
"topicPlaceholder": "например: Влияние искусственного интеллекта на образование",
|
||||
"senderFullName": "Полное имя отправителя",
|
||||
"notLoggedIn": "Не авторизован",
|
||||
"certificateOption": "Опция сертификата",
|
||||
"documentFile": "Файл документа",
|
||||
"clickToUpload": "Нажмите, чтобы загрузить документ",
|
||||
"fileTypes": "PDF, DOC, DOCX, TXT · Макс 20 МБ",
|
||||
"autoFilled": "Автозаполнено",
|
||||
"removeFile": "Удалить файл",
|
||||
"certificateTitle": "Вернуть результат с сертификатом",
|
||||
"certificateDescription": "Официальный сертификат будет прикреплен к вашему отчету об оригинальности.",
|
||||
"submitting": "Отправка…",
|
||||
"submitButton": "Отправить на проверку оригинальности",
|
||||
"dismiss": "Закрыть"
|
||||
},
|
||||
"HistoryPage": {
|
||||
"title": "История проверок",
|
||||
"description": "Все проверки на плагиат, отправленные вами",
|
||||
"sender": "Отправитель",
|
||||
"file": "Файл",
|
||||
"date": "Дата",
|
||||
"amount": "Сумма",
|
||||
"result": "Результат",
|
||||
"actions": "",
|
||||
"emptyMessage": "Проверки на плагиат не найдены.",
|
||||
"tryAgain": "Попробовать снова",
|
||||
"view": "Просмотр",
|
||||
"viewDetails": "Просмотреть детали для {sender}",
|
||||
"pagination": "Страница {current} из {total}",
|
||||
"previousPage": "Предыдущая страница",
|
||||
"nextPage": "Следующая страница",
|
||||
"page": "Страница {page}",
|
||||
"resultClean": "Чисто",
|
||||
"resultPlagiarismFound": "Обнаружен плагиат",
|
||||
"resultPending": "В ожидании",
|
||||
"resultFailed": "Не удалось"
|
||||
},
|
||||
"DetailPage": {
|
||||
"id": "ID",
|
||||
"submissionDetails": "Детали отправки",
|
||||
"sender": "Отправитель",
|
||||
"fileName": "Имя файла",
|
||||
"fileSize": "Размер файла",
|
||||
"submitted": "Отправлено",
|
||||
"payment": "Оплата",
|
||||
"resultTitle": "Результат",
|
||||
"analysisInProgress": "Анализ выполняется",
|
||||
"resultsReadyAfterProcessing": "Результаты появятся после завершения обработки.",
|
||||
"noResultAvailable": "Результат недоступен.",
|
||||
"plagiarismResult": "Результат на плагиат",
|
||||
"wordsChecked": "Проверено слов",
|
||||
"wordsMatched": "Найдено совпадающих слов",
|
||||
"matchedSources": "Найденные источники",
|
||||
"processedAt": "Обработано",
|
||||
"certificate": "Сертификат",
|
||||
"noCertificate": "Сертификат не выдан для этой проверки.",
|
||||
"noCertificateHighSimilarity": "Сертификаты не выдаются при высокой схожести.",
|
||||
"issued": "Выдан",
|
||||
"expires": "Действителен до",
|
||||
"issuer": "Выдавший",
|
||||
"certificateId": "ID сертификата",
|
||||
"downloadCertificate": "Скачать сертификат",
|
||||
"unknownError": "Неизвестная ошибка",
|
||||
"words": "слов"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,105 @@
|
||||
declare const messages: {
|
||||
HomePage: {
|
||||
title: 'Salom dunyo!';
|
||||
about: 'Go to the about page';
|
||||
about: "Biz haqimizda sahifasiga o'ting";
|
||||
};
|
||||
Navbar: {
|
||||
logo: 'Plagat';
|
||||
aboutSite: 'Sayt haqida';
|
||||
contact: 'Aloqa';
|
||||
login: 'Kirish';
|
||||
signup: "Ro'yxatdan o'tish";
|
||||
profile: 'Profil';
|
||||
logout: 'Chiqish';
|
||||
};
|
||||
Footer: {
|
||||
product: 'Mahsulot';
|
||||
overview: "Umumiy ko'rinish";
|
||||
pricing: 'Narxlar';
|
||||
marketplace: 'Bozor';
|
||||
features: 'Xususiyatlar';
|
||||
company: 'Kompaniya';
|
||||
about: 'Biz haqimizda';
|
||||
team: 'Jamoa';
|
||||
blog: 'Blog';
|
||||
careers: 'Karyera';
|
||||
resources: 'Resurslar';
|
||||
help: 'Yordam';
|
||||
sales: 'Sotuvlar';
|
||||
advertise: 'Reklama';
|
||||
privacy: 'Maxfiylik';
|
||||
copyright: '© {year} Felix IT Solutions. Barcha huquqlar himoyalangan.';
|
||||
terms: 'Foydalanish shartlari';
|
||||
};
|
||||
PlagiarismCheck: {
|
||||
badge: 'Orijinallik tekshiruvi';
|
||||
title: 'Hujjatni yuboring';
|
||||
description: "Hujjatning orijinalligini tekshirish uchun yuklang. Natijalar odatda bir necha daqiqada tayyor bo'ladi.";
|
||||
documentTopic: 'Hujjat mavzusi';
|
||||
topicPlaceholder: "masalan: Sun'iy intellektning ta'limga ta'siri";
|
||||
senderFullName: "Yuboruvchi to'liq ismi";
|
||||
notLoggedIn: 'Kirilmagan';
|
||||
certificateOption: 'Sertifikat varianti';
|
||||
documentFile: 'Hujjat fayli';
|
||||
clickToUpload: 'Hujjatni yuklash uchun bosing';
|
||||
fileTypes: 'PDF, DOC, DOCX, TXT · Maks 20 MB';
|
||||
autoFilled: "Avto-to'ldirilgan";
|
||||
removeFile: 'Faylni olib tashlash';
|
||||
certificateTitle: 'Natijani sertifikat bilan qaytarish';
|
||||
certificateDescription: 'Rasmiy sertifikat sizning orijinallik hisobotingizga ilova qilinadi.';
|
||||
submitting: 'Yuborilmoqda…';
|
||||
submitButton: 'Orijinallik tekshiruvi uchun yuborish';
|
||||
dismiss: 'Yopish';
|
||||
};
|
||||
HistoryPage: {
|
||||
title: 'Tekshiruv tarixi';
|
||||
description: 'Siz tomonidan yuborilgan barcha plagiat tekshiruvlari';
|
||||
sender: 'Yuboruvchi';
|
||||
file: 'Fayl';
|
||||
date: 'Sana';
|
||||
amount: 'Summa';
|
||||
result: 'Natija';
|
||||
actions: '';
|
||||
emptyMessage: 'Plagiat tekshiruvlari topilmadi.';
|
||||
tryAgain: "Qayta urinib ko'ring";
|
||||
view: "Ko'rish";
|
||||
viewDetails: "{sender} uchun tafsilotlarni ko'rish";
|
||||
pagination: '{current} / {total} sahifa';
|
||||
previousPage: 'Oldingi sahifa';
|
||||
nextPage: 'Keyingi sahifa';
|
||||
page: '{page} sahifa';
|
||||
resultClean: 'Toza';
|
||||
resultPlagiarismFound: 'Plagiat topildi';
|
||||
resultPending: 'Kutilmoqda';
|
||||
resultFailed: 'Muvaffaqiyatsiz';
|
||||
};
|
||||
DetailPage: {
|
||||
id: 'ID';
|
||||
submissionDetails: 'Yuborish tafsilotlari';
|
||||
sender: 'Yuboruvchi';
|
||||
fileName: 'Fayl nomi';
|
||||
fileSize: 'Fayl hajmi';
|
||||
submitted: 'Yuborilgan';
|
||||
payment: "To'lov";
|
||||
resultTitle: 'Natija';
|
||||
analysisInProgress: 'Tahlil davom etmoqda';
|
||||
resultsReadyAfterProcessing: "Natijalar qayta ishlash tugagach paydo bo'ladi.";
|
||||
noResultAvailable: 'Natija mavjud emas.';
|
||||
plagiarismResult: 'Plagiat natijasi';
|
||||
wordsChecked: "Tekshirilgan so'zlar";
|
||||
wordsMatched: "Mos keladigan so'zlar";
|
||||
matchedSources: 'Topilgan manbalar';
|
||||
processedAt: 'Qayta ishlangan';
|
||||
certificate: 'Sertifikat';
|
||||
noCertificate: 'Bu tekshiruv uchun sertifikat berilmagan.';
|
||||
noCertificateHighSimilarity: "Yuoqori o'xshashlik natijasida sertifikatlar berilmaydi.";
|
||||
issued: 'Berilgan';
|
||||
expires: 'Muddati tugaydi';
|
||||
issuer: 'Beruvchi';
|
||||
certificateId: 'Sertifikat ID';
|
||||
downloadCertificate: 'Sertifikatni yuklab olish';
|
||||
unknownError: "Noma'lum xato";
|
||||
words: "so'z";
|
||||
};
|
||||
};
|
||||
export default messages;
|
||||
|
||||
@@ -1,6 +1,104 @@
|
||||
{
|
||||
"HomePage": {
|
||||
"title": "Salom dunyo!",
|
||||
"about": "Go to the about page"
|
||||
"about": "Biz haqimizda sahifasiga o'ting"
|
||||
},
|
||||
"Navbar": {
|
||||
"logo": "Plagat",
|
||||
"aboutSite": "Sayt haqida",
|
||||
"contact": "Aloqa",
|
||||
"login": "Kirish",
|
||||
"signup": "Ro'yxatdan o'tish",
|
||||
"profile": "Profil",
|
||||
"logout": "Chiqish"
|
||||
},
|
||||
"Footer": {
|
||||
"product": "Mahsulot",
|
||||
"overview": "Umumiy ko'rinish",
|
||||
"pricing": "Narxlar",
|
||||
"marketplace": "Bozor",
|
||||
"features": "Xususiyatlar",
|
||||
"company": "Kompaniya",
|
||||
"about": "Biz haqimizda",
|
||||
"team": "Jamoa",
|
||||
"blog": "Blog",
|
||||
"careers": "Karyera",
|
||||
"resources": "Resurslar",
|
||||
"help": "Yordam",
|
||||
"sales": "Sotuvlar",
|
||||
"advertise": "Reklama",
|
||||
"privacy": "Maxfiylik",
|
||||
"copyright": "© {year} Felix IT Solutions. Barcha huquqlar himoyalangan.",
|
||||
"terms": "Foydalanish shartlari"
|
||||
},
|
||||
"PlagiarismCheck": {
|
||||
"badge": "Orijinallik tekshiruvi",
|
||||
"title": "Hujjatni yuboring",
|
||||
"description": "Hujjatning orijinalligini tekshirish uchun yuklang. Natijalar odatda bir necha daqiqada tayyor bo'ladi.",
|
||||
"documentTopic": "Hujjat mavzusi",
|
||||
"topicPlaceholder": "masalan: Sun'iy intellektning ta'limga ta'siri",
|
||||
"senderFullName": "Yuboruvchi to'liq ismi",
|
||||
"notLoggedIn": "Kirilmagan",
|
||||
"certificateOption": "Sertifikat varianti",
|
||||
"documentFile": "Hujjat fayli",
|
||||
"clickToUpload": "Hujjatni yuklash uchun bosing",
|
||||
"fileTypes": "PDF, DOC, DOCX, TXT · Maks 20 MB",
|
||||
"autoFilled": "Avto-to'ldirilgan",
|
||||
"removeFile": "Faylni olib tashlash",
|
||||
"certificateTitle": "Natijani sertifikat bilan qaytarish",
|
||||
"certificateDescription": "Rasmiy sertifikat sizning orijinallik hisobotingizga ilova qilinadi.",
|
||||
"submitting": "Yuborilmoqda…",
|
||||
"submitButton": "Orijinallik tekshiruvi uchun yuborish",
|
||||
"dismiss": "Yopish"
|
||||
},
|
||||
"HistoryPage": {
|
||||
"title": "Tekshiruv tarixi",
|
||||
"description": "Siz tomonidan yuborilgan barcha plagiat tekshiruvlari",
|
||||
"sender": "Yuboruvchi",
|
||||
"file": "Fayl",
|
||||
"date": "Sana",
|
||||
"amount": "Summa",
|
||||
"result": "Natija",
|
||||
"actions": "",
|
||||
"emptyMessage": "Plagiat tekshiruvlari topilmadi.",
|
||||
"tryAgain": "Qayta urinib ko'ring",
|
||||
"view": "Ko'rish",
|
||||
"viewDetails": "{sender} uchun tafsilotlarni ko'rish",
|
||||
"pagination": "{current} / {total} sahifa",
|
||||
"previousPage": "Oldingi sahifa",
|
||||
"nextPage": "Keyingi sahifa",
|
||||
"page": "{page} sahifa",
|
||||
"resultClean": "Toza",
|
||||
"resultPlagiarismFound": "Plagiat topildi",
|
||||
"resultPending": "Kutilmoqda",
|
||||
"resultFailed": "Muvaffaqiyatsiz"
|
||||
},
|
||||
"DetailPage": {
|
||||
"id": "ID",
|
||||
"submissionDetails": "Yuborish tafsilotlari",
|
||||
"sender": "Yuboruvchi",
|
||||
"fileName": "Fayl nomi",
|
||||
"fileSize": "Fayl hajmi",
|
||||
"submitted": "Yuborilgan",
|
||||
"payment": "To'lov",
|
||||
"resultTitle": "Natija",
|
||||
"analysisInProgress": "Tahlil davom etmoqda",
|
||||
"resultsReadyAfterProcessing": "Natijalar qayta ishlash tugagach paydo bo'ladi.",
|
||||
"noResultAvailable": "Natija mavjud emas.",
|
||||
"plagiarismResult": "Plagiat natijasi",
|
||||
"wordsChecked": "Tekshirilgan so'zlar",
|
||||
"wordsMatched": "Mos keladigan so'zlar",
|
||||
"matchedSources": "Topilgan manbalar",
|
||||
"processedAt": "Qayta ishlangan",
|
||||
"certificate": "Sertifikat",
|
||||
"noCertificate": "Bu tekshiruv uchun sertifikat berilmagan.",
|
||||
"noCertificateHighSimilarity": "Yuoqori o'xshashlik natijasida sertifikatlar berilmaydi.",
|
||||
"issued": "Berilgan",
|
||||
"expires": "Muddati tugaydi",
|
||||
"issuer": "Beruvchi",
|
||||
"certificateId": "Sertifikat ID",
|
||||
"downloadCertificate": "Sertifikatni yuklab olish",
|
||||
"unknownError": "Noma'lum xato",
|
||||
"words": "so'z"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// ─────────────────────────────────────────────────────────────
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { PlagiarismCheck } from '../lib/types';
|
||||
import {
|
||||
getFileExtension,
|
||||
@@ -166,7 +167,10 @@ interface CheckDetailViewProps {
|
||||
check: PlagiarismCheck;
|
||||
}
|
||||
|
||||
const CheckHeader: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
const CheckHeader: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
const t = useTranslations('DetailPage');
|
||||
|
||||
return (
|
||||
<div className="bg-white rounded-2xl shadow-sm border border-slate-100 p-6">
|
||||
<div className="flex flex-wrap items-center justify-between gap-4">
|
||||
<div className="flex items-center gap-4">
|
||||
@@ -181,7 +185,7 @@ const CheckHeader: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
</h1>
|
||||
<p className="text-sm text-slate-500">{check.sender.email}</p>
|
||||
<p className="text-xs text-slate-400 mt-1 font-mono">
|
||||
ID: {check.id}
|
||||
{t('id')}: {check.id}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -189,11 +193,19 @@ const CheckHeader: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
const SubmissionInfoCard: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
<SectionCard title="Submission Details" icon={<IconFile />} accent="blue">
|
||||
const SubmissionInfoCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
const t = useTranslations('DetailPage');
|
||||
|
||||
return (
|
||||
<SectionCard
|
||||
title={t('submissionDetails')}
|
||||
icon={<IconFile />}
|
||||
accent="blue"
|
||||
>
|
||||
<InfoRow
|
||||
label="Sender"
|
||||
label={t('sender')}
|
||||
icon={<IconUser />}
|
||||
value={
|
||||
<span className="flex items-center gap-2 justify-end">
|
||||
@@ -203,7 +215,7 @@ const SubmissionInfoCard: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
}
|
||||
/>
|
||||
<InfoRow
|
||||
label="File Name"
|
||||
label={t('fileName')}
|
||||
icon={<IconFile />}
|
||||
value={
|
||||
<span className="flex items-center gap-2 justify-end flex-wrap">
|
||||
@@ -215,18 +227,20 @@ const SubmissionInfoCard: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
}
|
||||
/>
|
||||
<InfoRow
|
||||
label="File Size"
|
||||
label={t('fileSize')}
|
||||
value={
|
||||
<span className="text-slate-600">{formatFileSize(check.fileSize)}</span>
|
||||
<span className="text-slate-600">
|
||||
{formatFileSize(check.fileSize)}
|
||||
</span>
|
||||
}
|
||||
/>
|
||||
<InfoRow
|
||||
label="Submitted"
|
||||
label={t('submitted')}
|
||||
icon={<IconCalendar />}
|
||||
value={formatDate(check.submittedAt)}
|
||||
/>
|
||||
<InfoRow
|
||||
label="Payment"
|
||||
label={t('payment')}
|
||||
icon={<IconPayment />}
|
||||
value={
|
||||
<span className="text-emerald-600 font-bold">
|
||||
@@ -236,11 +250,18 @@ const SubmissionInfoCard: React.FC<CheckDetailViewProps> = ({ check }) => (
|
||||
/>
|
||||
</SectionCard>
|
||||
);
|
||||
};
|
||||
|
||||
const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
const t = useTranslations('DetailPage');
|
||||
|
||||
if (check.status === 'processing' || check.status === 'pending') {
|
||||
return (
|
||||
<SectionCard title="Result" icon={<IconShield />} accent="violet">
|
||||
<SectionCard
|
||||
title={t('resultTitle')}
|
||||
icon={<IconShield />}
|
||||
accent="violet"
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center py-10 text-center space-y-3">
|
||||
<div className="w-12 h-12 rounded-full bg-blue-50 flex items-center justify-center">
|
||||
<svg
|
||||
@@ -264,10 +285,10 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
</svg>
|
||||
</div>
|
||||
<p className="text-sm font-semibold text-slate-600">
|
||||
Analysis in progress
|
||||
{t('analysisInProgress')}
|
||||
</p>
|
||||
<p className="text-xs text-slate-400">
|
||||
Results will appear once processing is complete.
|
||||
{t('resultsReadyAfterProcessing')}
|
||||
</p>
|
||||
</div>
|
||||
</SectionCard>
|
||||
@@ -276,8 +297,12 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
|
||||
if (!check.result) {
|
||||
return (
|
||||
<SectionCard title="Result" icon={<IconShield />} accent="violet">
|
||||
<p className="text-sm text-slate-500 py-4">No result available.</p>
|
||||
<SectionCard
|
||||
title={t('resultTitle')}
|
||||
icon={<IconShield />}
|
||||
accent="violet"
|
||||
>
|
||||
<p className="text-sm text-slate-500 py-4">{t('noResultAvailable')}</p>
|
||||
</SectionCard>
|
||||
);
|
||||
}
|
||||
@@ -286,7 +311,7 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
|
||||
return (
|
||||
<SectionCard
|
||||
title="Plagiarism Result"
|
||||
title={t('plagiarismResult')}
|
||||
icon={<IconShield />}
|
||||
accent={
|
||||
result.similarityLevel === 'low'
|
||||
@@ -309,13 +334,13 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
<p className="text-2xl font-bold text-slate-800 tabular-nums">
|
||||
{result.checkedWords.toLocaleString()}
|
||||
</p>
|
||||
<p className="text-xs text-slate-500 mt-1">Words Checked</p>
|
||||
<p className="text-xs text-slate-500 mt-1">{t('wordsChecked')}</p>
|
||||
</div>
|
||||
<div className="bg-slate-50 rounded-xl p-4 text-center">
|
||||
<p className="text-2xl font-bold text-slate-800 tabular-nums">
|
||||
{result.matchedWords.toLocaleString()}
|
||||
</p>
|
||||
<p className="text-xs text-slate-500 mt-1">Words Matched</p>
|
||||
<p className="text-xs text-slate-500 mt-1">{t('wordsMatched')}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -323,7 +348,7 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
{result.sources.length > 0 && (
|
||||
<div>
|
||||
<h3 className="text-xs font-semibold text-slate-500 uppercase tracking-widest mb-3">
|
||||
Matched Sources
|
||||
{t('matchedSources')}
|
||||
</h3>
|
||||
<div className="space-y-2">
|
||||
{result.sources.map((src, i) => (
|
||||
@@ -352,7 +377,7 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
{src.matchPercentage}%
|
||||
</span>
|
||||
<p className="text-xs text-slate-400">
|
||||
{src.matchedWords.toLocaleString()} words
|
||||
{src.matchedWords.toLocaleString()} {t('words')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -362,7 +387,7 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
)}
|
||||
|
||||
<InfoRow
|
||||
label="Processed At"
|
||||
label={t('processedAt')}
|
||||
icon={<IconCalendar />}
|
||||
value={formatDate(result.processedAt)}
|
||||
/>
|
||||
@@ -372,19 +397,19 @@ const ResultCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
};
|
||||
|
||||
const CertificateCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
const t = useTranslations('DetailPage');
|
||||
|
||||
if (!check.certificate) {
|
||||
return (
|
||||
<SectionCard title="Certificate" icon={<IconCert />} accent="violet">
|
||||
<SectionCard title={t('certificate')} icon={<IconCert />} accent="violet">
|
||||
<div className=" flex flex-col items-center justify-center py-8 text-center space-y-2">
|
||||
<div className="w-10 h-10 rounded-full bg-slate-100 flex items-center justify-center">
|
||||
<IconCert />
|
||||
</div>
|
||||
<p className="text-sm text-slate-500">
|
||||
No certificate issued for this check.
|
||||
</p>
|
||||
<p className="text-sm text-slate-500">{t('noCertificate')}</p>
|
||||
{check.result?.similarityLevel === 'high' && (
|
||||
<p className="text-xs text-red-500">
|
||||
Certificates are not issued for high-similarity results.
|
||||
{t('noCertificateHighSimilarity')}
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
@@ -395,7 +420,7 @@ const CertificateCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
const { certificate } = check;
|
||||
|
||||
return (
|
||||
<SectionCard title="Certificate" icon={<IconCert />} accent="green">
|
||||
<SectionCard title={t('certificate')} icon={<IconCert />} accent="green">
|
||||
{/* Certificate visual */}
|
||||
<div className="relative rounded-xl border-2 border-dashed border-emerald-200 bg-linear-to-br from-emerald-50 to-white p-5 mb-4 overflow-hidden">
|
||||
<div className="absolute top-2 right-2 opacity-10">
|
||||
@@ -414,21 +439,21 @@ const CertificateCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
{certificate.verificationCode}
|
||||
</p>
|
||||
<p className="text-xs text-slate-500 mt-1">
|
||||
Certificate ID: {certificate.id}
|
||||
{t('certificateId')}: {certificate.id}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<InfoRow
|
||||
label="Issued"
|
||||
label={t('issued')}
|
||||
icon={<IconCalendar />}
|
||||
value={formatDate(certificate.issuedAt)}
|
||||
/>
|
||||
<InfoRow
|
||||
label="Expires"
|
||||
label={t('expires')}
|
||||
icon={<IconCalendar />}
|
||||
value={formatDate(certificate.expiresAt)}
|
||||
/>
|
||||
<InfoRow label="Issuer" value={certificate.issuerName} />
|
||||
<InfoRow label={t('issuer')} value={certificate.issuerName} />
|
||||
|
||||
<div className="mt-4">
|
||||
<a
|
||||
@@ -436,7 +461,7 @@ const CertificateCard: React.FC<CheckDetailViewProps> = ({ check }) => {
|
||||
className="flex items-center justify-center gap-2 py-2.5 px-4 bg-emerald-600 hover:bg-emerald-700 text-white text-sm font-semibold rounded-xl transition-colors"
|
||||
>
|
||||
<IconDownload />
|
||||
Download Certificate
|
||||
{t('downloadCertificate')}
|
||||
</a>
|
||||
</div>
|
||||
</SectionCard>
|
||||
@@ -466,6 +491,7 @@ interface PlagiarismDetailPageProps {
|
||||
export const PlagiarismDetailPage: React.FC<PlagiarismDetailPageProps> = ({
|
||||
checkId,
|
||||
}) => {
|
||||
const t = useTranslations('DetailPage');
|
||||
const { check, loadingState, error, reload } = usePlagiarismDetail(checkId);
|
||||
|
||||
return (
|
||||
@@ -473,7 +499,7 @@ export const PlagiarismDetailPage: React.FC<PlagiarismDetailPageProps> = ({
|
||||
<main className="max-w-300 mx-auto px-4 py-6">
|
||||
{loadingState === 'loading' && <SkeletonLoader />}
|
||||
{loadingState === 'error' && (
|
||||
<ErrorState message={error ?? 'Unknown error'} onRetry={reload} />
|
||||
<ErrorState message={error ?? t('unknownError')} onRetry={reload} />
|
||||
)}
|
||||
{loadingState === 'success' && check && (
|
||||
<CheckDetailView check={check} />
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from './Plagiraismui';
|
||||
import { usePlagiarismForm } from '../lib/usePlagiraism';
|
||||
import { PaymentModal } from '@/widgets/paymentModal/ui/Paymentmodal';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
// ─── UserIcon (inline) ───────────────────────────────────────────────────────
|
||||
|
||||
@@ -35,6 +36,8 @@ function UserIcon() {
|
||||
// ─── Component ───────────────────────────────────────────────────────────────
|
||||
|
||||
export function PlagiarismCheckForm() {
|
||||
const t = useTranslations('PlagiarismCheck');
|
||||
|
||||
const {
|
||||
form,
|
||||
errors,
|
||||
@@ -59,14 +62,13 @@ export function PlagiarismCheckForm() {
|
||||
<div className="mb-8">
|
||||
<div className="inline-flex items-center gap-2 bg-blue-100 text-blue-700 text-xs font-bold uppercase tracking-widest px-3 py-1.5 rounded-full mb-4">
|
||||
<span className="w-1.5 h-1.5 rounded-full bg-blue-500" />
|
||||
Originality Check
|
||||
{t('badge')}
|
||||
</div>
|
||||
<h1 className="text-3xl font-black text-stone-900 leading-tight">
|
||||
Submit Your Document
|
||||
{t('title')}
|
||||
</h1>
|
||||
<p className="text-stone-500 mt-2 text-sm leading-relaxed">
|
||||
Upload a document to verify its originality. Results are typically
|
||||
ready within a few minutes.
|
||||
{t('description')}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -86,6 +88,7 @@ export function PlagiarismCheckForm() {
|
||||
status="success"
|
||||
message={`Submission successful! ID: ${submission.response.submissionId}. ${submission.response.message}`}
|
||||
onDismiss={resetSubmission}
|
||||
dismissText={t('dismiss')}
|
||||
/>
|
||||
)}
|
||||
{submission.status === 'error' && submission.error && (
|
||||
@@ -93,6 +96,7 @@ export function PlagiarismCheckForm() {
|
||||
status="error"
|
||||
message={submission.error}
|
||||
onDismiss={resetSubmission}
|
||||
dismissText={t('dismiss')}
|
||||
/>
|
||||
)}
|
||||
|
||||
@@ -100,7 +104,7 @@ export function PlagiarismCheckForm() {
|
||||
<div className="flex flex-col gap-6 md:max-w-[50%] w-full">
|
||||
{/* Topic */}
|
||||
<FieldWrapper
|
||||
label="Document Topic"
|
||||
label={t('documentTopic')}
|
||||
htmlFor="topic"
|
||||
error={errors.topic}
|
||||
required
|
||||
@@ -108,7 +112,7 @@ export function PlagiarismCheckForm() {
|
||||
<TextInput
|
||||
id="topic"
|
||||
type="text"
|
||||
placeholder="e.g. The Impact of Artificial Intelligence on Education"
|
||||
placeholder={t('topicPlaceholder')}
|
||||
value={form.topic}
|
||||
onChange={(e) => setTopic(e.target.value)}
|
||||
hasError={!!errors.topic}
|
||||
@@ -118,21 +122,24 @@ export function PlagiarismCheckForm() {
|
||||
</FieldWrapper>
|
||||
|
||||
{/* Sender Full Name (read-only) */}
|
||||
<FieldWrapper label="Sender Full Name">
|
||||
<FieldWrapper label={t('senderFullName')}>
|
||||
<ReadonlyField
|
||||
value={senderFullName || 'Not logged in'}
|
||||
value={senderFullName || t('notLoggedIn')}
|
||||
icon={<UserIcon />}
|
||||
autoFilledText={t('autoFilled')}
|
||||
/>
|
||||
</FieldWrapper>
|
||||
|
||||
{/* Certificate Option */}
|
||||
<div>
|
||||
<p className="text-sm font-semibold tracking-wide text-stone-700 uppercase mb-2">
|
||||
Certificate Option
|
||||
{t('certificateOption')}
|
||||
</p>
|
||||
<CertificateCheckbox
|
||||
checked={form.withCertificate}
|
||||
onChange={toggleCertificate}
|
||||
title={t('certificateTitle')}
|
||||
description={t('certificateDescription')}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
@@ -141,7 +148,7 @@ export function PlagiarismCheckForm() {
|
||||
<div className="flex flex-col gap-6 md:max-w-[50%] w-full">
|
||||
{/* File Upload */}
|
||||
<FieldWrapper
|
||||
label="Document File"
|
||||
label={t('documentFile')}
|
||||
error={errors.file}
|
||||
required
|
||||
>
|
||||
@@ -149,6 +156,9 @@ export function PlagiarismCheckForm() {
|
||||
file={form.file}
|
||||
onFileChange={setFile}
|
||||
hasError={!!errors.file}
|
||||
clickToUploadText={t('clickToUpload')}
|
||||
fileTypesText={t('fileTypes')}
|
||||
removeFileAriaLabel={t('removeFile')}
|
||||
/>
|
||||
</FieldWrapper>
|
||||
|
||||
@@ -156,7 +166,11 @@ export function PlagiarismCheckForm() {
|
||||
<div className="border-t border-stone-100" />
|
||||
|
||||
{/* Submit */}
|
||||
<SubmitButton isLoading={isLoading} />
|
||||
<SubmitButton
|
||||
isLoading={isLoading}
|
||||
submittingText={t('submitting')}
|
||||
submitText={t('submitButton')}
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -71,15 +71,20 @@ export function TextInput({
|
||||
interface ReadonlyFieldProps {
|
||||
value: string;
|
||||
icon?: React.ReactNode;
|
||||
autoFilledText?: string;
|
||||
}
|
||||
|
||||
export function ReadonlyField({ value, icon }: ReadonlyFieldProps) {
|
||||
export function ReadonlyField({
|
||||
value,
|
||||
icon,
|
||||
autoFilledText = 'Auto-filled',
|
||||
}: ReadonlyFieldProps) {
|
||||
return (
|
||||
<div className="flex items-center gap-3 px-4 py-3 rounded-xl bg-stone-100 border-2 border-stone-200">
|
||||
{icon && <span className="text-stone-500 shrink-0">{icon}</span>}
|
||||
<span className="text-sm font-semibold text-stone-700">{value}</span>
|
||||
<span className="ml-auto text-xs text-stone-400 italic font-medium">
|
||||
Auto-filled
|
||||
{autoFilledText}
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
@@ -92,6 +97,9 @@ interface FileUploadFieldProps {
|
||||
onFileChange: (file: File | null) => void;
|
||||
hasError?: boolean;
|
||||
accept?: string;
|
||||
clickToUploadText?: string;
|
||||
fileTypesText?: string;
|
||||
removeFileAriaLabel?: string;
|
||||
}
|
||||
|
||||
export function FileUploadField({
|
||||
@@ -99,6 +107,9 @@ export function FileUploadField({
|
||||
onFileChange,
|
||||
hasError,
|
||||
accept = '.pdf,.doc,.docx,.txt',
|
||||
clickToUploadText = 'Click to upload document',
|
||||
fileTypesText = 'PDF, DOC, DOCX, TXT · Max 20 MB',
|
||||
removeFileAriaLabel = 'Remove file',
|
||||
}: FileUploadFieldProps) {
|
||||
const inputRef = React.useRef<HTMLInputElement>(null);
|
||||
|
||||
@@ -163,11 +174,9 @@ export function FileUploadField({
|
||||
<p
|
||||
className={`text-sm font-semibold transition-colors ${hasError ? 'text-rose-600' : 'text-stone-600 group-hover:text-blue-700'}`}
|
||||
>
|
||||
Click to upload document
|
||||
</p>
|
||||
<p className="text-xs text-stone-400 mt-0.5">
|
||||
PDF, DOC, DOCX, TXT · Max 20 MB
|
||||
{clickToUploadText}
|
||||
</p>
|
||||
<p className="text-xs text-stone-400 mt-0.5">{fileTypesText}</p>
|
||||
</div>
|
||||
</label>
|
||||
) : (
|
||||
@@ -185,7 +194,7 @@ export function FileUploadField({
|
||||
type="button"
|
||||
onClick={handleRemove}
|
||||
className="w-7 h-7 rounded-lg flex items-center justify-center text-stone-400 hover:text-rose-500 hover:bg-rose-100 transition-colors shrink-0"
|
||||
aria-label="Remove file"
|
||||
aria-label={removeFileAriaLabel}
|
||||
>
|
||||
<XIcon />
|
||||
</button>
|
||||
@@ -200,11 +209,15 @@ export function FileUploadField({
|
||||
interface CertificateCheckboxProps {
|
||||
checked: boolean;
|
||||
onChange: () => void;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
export function CertificateCheckbox({
|
||||
checked,
|
||||
onChange,
|
||||
title = 'Return result with certificate',
|
||||
description = 'An official certificate will be attached to your originality report.',
|
||||
}: CertificateCheckboxProps) {
|
||||
return (
|
||||
<label
|
||||
@@ -246,12 +259,8 @@ export function CertificateCheckbox({
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<p className="text-sm font-semibold text-stone-800">
|
||||
Return result with certificate
|
||||
</p>
|
||||
<p className="text-xs text-stone-500 mt-0.5">
|
||||
An official certificate will be attached to your originality report.
|
||||
</p>
|
||||
<p className="text-sm font-semibold text-stone-800">{title}</p>
|
||||
<p className="text-xs text-stone-500 mt-0.5">{description}</p>
|
||||
</div>
|
||||
</label>
|
||||
);
|
||||
@@ -261,9 +270,15 @@ export function CertificateCheckbox({
|
||||
|
||||
interface SubmitButtonProps {
|
||||
isLoading: boolean;
|
||||
submittingText?: string;
|
||||
submitText?: string;
|
||||
}
|
||||
|
||||
export function SubmitButton({ isLoading }: SubmitButtonProps) {
|
||||
export function SubmitButton({
|
||||
isLoading,
|
||||
submittingText = 'Submitting…',
|
||||
submitText = 'Submit for Originality Check',
|
||||
}: SubmitButtonProps) {
|
||||
return (
|
||||
<button
|
||||
type="submit"
|
||||
@@ -282,12 +297,12 @@ export function SubmitButton({ isLoading }: SubmitButtonProps) {
|
||||
{isLoading ? (
|
||||
<>
|
||||
<SpinnerIcon />
|
||||
Submitting…
|
||||
{submittingText}
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<ShieldIcon />
|
||||
Submit for Originality Check
|
||||
{submitText}
|
||||
</>
|
||||
)}
|
||||
</button>
|
||||
@@ -300,12 +315,14 @@ interface StatusBannerProps {
|
||||
status: 'success' | 'error';
|
||||
message: string;
|
||||
onDismiss: () => void;
|
||||
dismissText?: string;
|
||||
}
|
||||
|
||||
export function StatusBanner({
|
||||
status,
|
||||
message,
|
||||
onDismiss,
|
||||
dismissText = 'Dismiss',
|
||||
}: StatusBannerProps) {
|
||||
const isSuccess = status === 'success';
|
||||
useEffect(() => {
|
||||
@@ -334,7 +351,7 @@ export function StatusBanner({
|
||||
onClick={onDismiss}
|
||||
className={`text-xs font-bold uppercase ${isSuccess ? 'text-emerald-600 hover:text-emerald-800' : 'text-rose-600 hover:text-rose-800'}`}
|
||||
>
|
||||
Dismiss
|
||||
{dismissText}
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,31 +1,31 @@
|
||||
const sections = [
|
||||
const getSections = (t: (key: string) => string) => [
|
||||
{
|
||||
title: 'Product',
|
||||
title: t('product'),
|
||||
links: [
|
||||
{ name: 'Overview', href: '#' },
|
||||
{ name: 'Pricing', href: '#' },
|
||||
{ name: 'Marketplace', href: '#' },
|
||||
{ name: 'Features', href: '#' },
|
||||
{ name: t('overview'), href: '#' },
|
||||
{ name: t('pricing'), href: '#' },
|
||||
{ name: t('marketplace'), href: '#' },
|
||||
{ name: t('features'), href: '#' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Company',
|
||||
title: t('company'),
|
||||
links: [
|
||||
{ name: 'About', href: '#' },
|
||||
{ name: 'Team', href: '#' },
|
||||
{ name: 'Blog', href: '#' },
|
||||
{ name: 'Careers', href: '#' },
|
||||
{ name: t('about'), href: '#' },
|
||||
{ name: t('team'), href: '#' },
|
||||
{ name: t('blog'), href: '#' },
|
||||
{ name: t('careers'), href: '#' },
|
||||
],
|
||||
},
|
||||
{
|
||||
title: 'Resources',
|
||||
title: t('resources'),
|
||||
links: [
|
||||
{ name: 'Help', href: '#' },
|
||||
{ name: 'Sales', href: '#' },
|
||||
{ name: 'Advertise', href: '#' },
|
||||
{ name: 'Privacy', href: '#' },
|
||||
{ name: t('help'), href: '#' },
|
||||
{ name: t('sales'), href: '#' },
|
||||
{ name: t('advertise'), href: '#' },
|
||||
{ name: t('privacy'), href: '#' },
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
export { sections };
|
||||
export { getSections };
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const Footer = () => {
|
||||
const t = useTranslations('Footer');
|
||||
|
||||
// const shortLinks = [
|
||||
// { name: 'About', href: '/about' },
|
||||
// { name: 'Contact', href: '/contact' },
|
||||
@@ -7,13 +11,10 @@ const Footer = () => {
|
||||
<section className="py-10">
|
||||
<div className="custom-container">
|
||||
<div className=" flex flex-col justify-between gap-4 border-t pt-8 text-center text-sm font-medium text-muted-foreground lg:flex-row lg:items-center lg:text-left">
|
||||
<p>
|
||||
© {new Date().getFullYear()} Felix IT Solutions. All rights
|
||||
reserved.
|
||||
</p>
|
||||
<p>{t('copyright', { year: new Date().getFullYear() })}</p>
|
||||
<ul className="flex justify-center gap-4 lg:justify-start">
|
||||
<li className="hover:text-primary">
|
||||
<a href="#">Terms and Conditions</a>
|
||||
<a href="#">{t('terms')}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -3,34 +3,34 @@
|
||||
import { CheckResult } from './types';
|
||||
|
||||
export const TABLE_COLUMNS = [
|
||||
{ key: 'senderFullName', label: 'Sender' },
|
||||
{ key: 'fileName', label: 'File' },
|
||||
{ key: 'date', label: 'Date' },
|
||||
{ key: 'paymentAmount', label: 'Amount' },
|
||||
{ key: 'result', label: 'Result' },
|
||||
{ key: 'actions', label: '' },
|
||||
{ key: 'senderFullName', labelKey: 'sender' },
|
||||
{ key: 'fileName', labelKey: 'file' },
|
||||
{ key: 'date', labelKey: 'date' },
|
||||
{ key: 'paymentAmount', labelKey: 'amount' },
|
||||
{ key: 'result', labelKey: 'result' },
|
||||
{ key: 'actions', labelKey: 'actions' },
|
||||
] as const;
|
||||
|
||||
// ─── Result Labels & Styles ────────────────────────────────────────────────────
|
||||
|
||||
export const RESULT_CONFIG: Record<
|
||||
CheckResult,
|
||||
{ label: string; className: string }
|
||||
{ labelKey: string; className: string }
|
||||
> = {
|
||||
clean: {
|
||||
label: 'Clean',
|
||||
labelKey: 'resultClean',
|
||||
className: 'bg-emerald-50 text-emerald-700 ring-1 ring-emerald-200',
|
||||
},
|
||||
plagiarism_found: {
|
||||
label: 'Plagiarism Found',
|
||||
labelKey: 'resultPlagiarismFound',
|
||||
className: 'bg-red-50 text-red-700 ring-1 ring-red-200',
|
||||
},
|
||||
pending: {
|
||||
label: 'Pending',
|
||||
labelKey: 'resultPending',
|
||||
className: 'bg-amber-50 text-amber-700 ring-1 ring-amber-200',
|
||||
},
|
||||
failed: {
|
||||
label: 'Failed',
|
||||
labelKey: 'resultFailed',
|
||||
className: 'bg-slate-100 text-slate-500 ring-1 ring-slate-200',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useHistory } from '../lib/useHistory';
|
||||
import { HistoryTable } from './historyTable';
|
||||
import { Pagination } from './pagination';
|
||||
|
||||
// ─── Page Header ───────────────────────────────────────────────────────────────
|
||||
|
||||
const PageHeader: React.FC = () => (
|
||||
const PageHeader: React.FC = () => {
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
return (
|
||||
<div className="mb-6">
|
||||
<h1 className="text-2xl font-semibold text-slate-900 tracking-tight">
|
||||
Check History
|
||||
{t('title')}
|
||||
</h1>
|
||||
<p className="mt-1 text-sm text-slate-500">
|
||||
All plagiarism checks submitted by you
|
||||
</p>
|
||||
<p className="mt-1 text-sm text-slate-500">{t('description')}</p>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
// ─── HistoryPage ───────────────────────────────────────────────────────────────
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { TABLE_COLUMNS } from '../lib/constants';
|
||||
import { EmptyState, ErrorState, SkeletonRow } from './tableStates';
|
||||
import { HistoryTableRow } from './historyTableRow';
|
||||
@@ -12,7 +13,10 @@ interface HistoryTableFullProps extends HistoryTableProps {
|
||||
|
||||
// ─── Table Header ──────────────────────────────────────────────────────────────
|
||||
|
||||
const TableHead: React.FC = () => (
|
||||
const TableHead: React.FC = () => {
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
return (
|
||||
<thead>
|
||||
<tr className="border-b border-slate-200 bg-slate-50/80">
|
||||
{TABLE_COLUMNS.map((col) => (
|
||||
@@ -23,12 +27,13 @@ const TableHead: React.FC = () => (
|
||||
col.key === 'actions' ? 'text-right' : ''
|
||||
}`}
|
||||
>
|
||||
{col.label}
|
||||
{col.labelKey ? t(col.labelKey) : ''}
|
||||
</th>
|
||||
))}
|
||||
</tr>
|
||||
</thead>
|
||||
);
|
||||
};
|
||||
|
||||
// ─── Table Body ────────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -48,7 +53,7 @@ const TableBody: React.FC<HistoryTableFullProps> = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
if (error) {
|
||||
return (
|
||||
<tbody>
|
||||
<ErrorState message={error} onRetry={onRetry ?? (() => {})} />
|
||||
@@ -56,7 +61,7 @@ const TableBody: React.FC<HistoryTableFullProps> = ({
|
||||
);
|
||||
}
|
||||
|
||||
if (false) {
|
||||
if (items.length === 0) {
|
||||
return (
|
||||
<tbody>
|
||||
<EmptyState />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { HistoryTableRowProps } from '../lib/types';
|
||||
import { formatDate, truncateFileName } from '../lib/utils';
|
||||
import { ResultBadge } from './resultBadge';
|
||||
@@ -7,6 +8,8 @@ import { useRouter } from '@/shared/config/i18n/navigation';
|
||||
|
||||
export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||
const router = useRouter();
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
return (
|
||||
<tr className="border-b border-slate-100 hover:bg-slate-50/70 transition-colors duration-100 group">
|
||||
{/* Sender */}
|
||||
@@ -62,7 +65,7 @@ export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||
<td className="px-4 py-3.5 text-right">
|
||||
<button
|
||||
onClick={() => router.push(`/${item.id}`)}
|
||||
aria-label={`View details for ${item.senderFullName}`}
|
||||
aria-label={t('viewDetails', { sender: item.senderFullName })}
|
||||
className="
|
||||
inline-flex items-center gap-1.5 px-3 py-1.5
|
||||
text-xs font-medium text-slate-600
|
||||
@@ -73,7 +76,7 @@ export const HistoryTableRow: React.FC<HistoryTableRowProps> = ({ item }) => {
|
||||
focus:outline-none focus-visible:ring-2 focus-visible:ring-slate-300
|
||||
"
|
||||
>
|
||||
View
|
||||
{t('view')}
|
||||
<svg
|
||||
width="11"
|
||||
height="11"
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
interface PaginationProps {
|
||||
currentPage: number;
|
||||
@@ -33,6 +34,8 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
totalPages,
|
||||
onPageChange,
|
||||
}) => {
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
if (totalPages <= 1) return null;
|
||||
|
||||
// Build visible page numbers with ellipsis
|
||||
@@ -60,7 +63,7 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
return (
|
||||
<div className="flex items-center justify-between px-4 py-3 border-t border-slate-100">
|
||||
<span className="text-xs text-slate-400">
|
||||
Page {currentPage} of {totalPages}
|
||||
{t('pagination', { current: currentPage, total: totalPages })}
|
||||
</span>
|
||||
|
||||
<div className="flex items-center gap-1">
|
||||
@@ -68,7 +71,7 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
<button
|
||||
onClick={() => onPageChange(currentPage - 1)}
|
||||
disabled={currentPage === 1}
|
||||
aria-label="Previous page"
|
||||
aria-label={t('previousPage')}
|
||||
className={`${btnBase} border-slate-200 text-slate-500 hover:bg-slate-50 hover:text-slate-800 disabled:opacity-30 disabled:cursor-not-allowed`}
|
||||
>
|
||||
<ChevronIcon direction="left" />
|
||||
@@ -87,7 +90,7 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
<button
|
||||
key={p}
|
||||
onClick={() => onPageChange(p as number)}
|
||||
aria-label={`Page ${p}`}
|
||||
aria-label={t('page', { page: p })}
|
||||
aria-current={p === currentPage ? 'page' : undefined}
|
||||
className={`${btnBase} ${
|
||||
p === currentPage
|
||||
@@ -104,7 +107,7 @@ export const Pagination: React.FC<PaginationProps> = ({
|
||||
<button
|
||||
onClick={() => onPageChange(currentPage + 1)}
|
||||
disabled={currentPage === totalPages}
|
||||
aria-label="Next page"
|
||||
aria-label={t('nextPage')}
|
||||
className={`${btnBase} border-slate-200 text-slate-500 hover:bg-slate-50 hover:text-slate-800 disabled:opacity-30 disabled:cursor-not-allowed`}
|
||||
>
|
||||
<ChevronIcon direction="right" />
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { ResultBadgeProps } from '../lib/types';
|
||||
import { RESULT_CONFIG } from '../lib/constants';
|
||||
|
||||
export const ResultBadge: React.FC<ResultBadgeProps> = ({ result }) => {
|
||||
const { label, className } = RESULT_CONFIG[result];
|
||||
const t = useTranslations('HistoryPage');
|
||||
const { labelKey, className } = RESULT_CONFIG[result];
|
||||
|
||||
return (
|
||||
<span
|
||||
className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium whitespace-nowrap ${className}`}
|
||||
>
|
||||
{label}
|
||||
{t(labelKey)}
|
||||
</span>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
'use client';
|
||||
import React from 'react';
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { EmptyStateProps, SkeletonRowProps } from '../lib/types';
|
||||
|
||||
// ─── Empty State ───────────────────────────────────────────────────────────────
|
||||
|
||||
export const EmptyState: React.FC<EmptyStateProps> = ({
|
||||
message = 'No plagiarism checks found.',
|
||||
}) => (
|
||||
export const EmptyState: React.FC<EmptyStateProps> = ({ message }) => {
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={6}>
|
||||
<div className="flex flex-col items-center justify-center py-16 text-slate-400 gap-3">
|
||||
@@ -21,11 +23,14 @@ export const EmptyState: React.FC<EmptyStateProps> = ({
|
||||
>
|
||||
<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 font-medium">{message}</span>
|
||||
<span className="text-sm font-medium">
|
||||
{message || t('emptyMessage')}
|
||||
</span>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
|
||||
// ─── Skeleton Row ──────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -53,7 +58,10 @@ interface ErrorStateProps {
|
||||
onRetry: () => void;
|
||||
}
|
||||
|
||||
export const ErrorState: React.FC<ErrorStateProps> = ({ message, onRetry }) => (
|
||||
export const ErrorState: React.FC<ErrorStateProps> = ({ message, onRetry }) => {
|
||||
const t = useTranslations('HistoryPage');
|
||||
|
||||
return (
|
||||
<tr>
|
||||
<td colSpan={6}>
|
||||
<div className="flex flex-col items-center justify-center py-14 gap-3">
|
||||
@@ -67,9 +75,10 @@ export const ErrorState: React.FC<ErrorStateProps> = ({ message, onRetry }) => (
|
||||
onClick={onRetry}
|
||||
className="text-xs text-slate-500 underline underline-offset-2 hover:text-slate-800 transition-colors"
|
||||
>
|
||||
Try again
|
||||
{t('tryAgain')}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { MenuItem } from './model';
|
||||
import { LanguageRoutes } from '@/shared/config/i18n/types';
|
||||
|
||||
const menu: MenuItem[] = [
|
||||
{ title: 'About Site', url: '/about' },
|
||||
const getMenu = (t: (key: string) => string): MenuItem[] => [
|
||||
{ title: t('aboutSite'), url: '/about' },
|
||||
// {
|
||||
// title: 'Products',
|
||||
// url: '#',
|
||||
@@ -16,7 +16,7 @@ const menu: MenuItem[] = [
|
||||
// ],
|
||||
// },
|
||||
{
|
||||
title: 'Contact',
|
||||
title: t('contact'),
|
||||
url: '/contact',
|
||||
},
|
||||
];
|
||||
@@ -36,4 +36,4 @@ const languages: { name: string; key: LanguageRoutes }[] = [
|
||||
},
|
||||
];
|
||||
|
||||
export { menu, languages };
|
||||
export { getMenu, languages };
|
||||
|
||||
@@ -11,16 +11,19 @@ import {
|
||||
import SubMenuLink from './SubMenuLink';
|
||||
import { ChangeLang } from './ChangeLang';
|
||||
import { useLoginModal, useRegisterModal } from '@/shared/zustand/auth';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
function AuthButtons() {
|
||||
const t = useTranslations('Navbar');
|
||||
|
||||
const auth = {
|
||||
login: { title: 'Login', url: '#' },
|
||||
signup: { title: 'Sign up', url: '#' },
|
||||
login: { title: t('login'), url: '#' },
|
||||
signup: { title: t('signup'), url: '#' },
|
||||
};
|
||||
|
||||
const userItem = [
|
||||
{ title: 'Profile', url: '/profile' },
|
||||
{ title: 'Logout', url: '#' },
|
||||
{ title: t('profile'), url: '/profile' },
|
||||
{ title: t('logout'), url: '#' },
|
||||
];
|
||||
|
||||
const toggleLoginModal = useLoginModal((state) => state.toggleLoginModal);
|
||||
|
||||
@@ -8,13 +8,17 @@ import {
|
||||
SheetTrigger,
|
||||
} from '@/shared/ui/sheet';
|
||||
import { Menu } from 'lucide-react';
|
||||
import { menu } from '../lib/data';
|
||||
import { getMenu } from '../lib/data';
|
||||
import RenderMobileMenuItem from './RenderMobileMenuItem';
|
||||
import { ChangeLang } from './ChangeLang';
|
||||
import Link from 'next/link';
|
||||
import { AuthButtons } from './authButtons';
|
||||
import { useTranslations } from 'next-intl';
|
||||
|
||||
const Navbar = () => {
|
||||
const t = useTranslations('Navbar');
|
||||
const menu = getMenu(t);
|
||||
|
||||
return (
|
||||
<section className="py-4">
|
||||
<div className="custom-container">
|
||||
@@ -26,7 +30,7 @@ const Navbar = () => {
|
||||
href={'/'}
|
||||
className="flex items-center gap-2 text-2xl font-bold "
|
||||
>
|
||||
Plagat
|
||||
{t('logo')}
|
||||
</Link>
|
||||
{/* <div className="flex items-center">
|
||||
<NavigationMenu>
|
||||
@@ -44,7 +48,7 @@ const Navbar = () => {
|
||||
<div className="flex items-center justify-between">
|
||||
{/* Logo */}
|
||||
<Link href={'/'} className="flex items-center gap-2">
|
||||
Plagat
|
||||
{t('logo')}
|
||||
</Link>
|
||||
<Sheet>
|
||||
<div className="space-x-2">
|
||||
@@ -59,7 +63,7 @@ const Navbar = () => {
|
||||
<SheetHeader>
|
||||
<SheetTitle>
|
||||
<Link href={'/'} className="flex items-center gap-2">
|
||||
Plagat
|
||||
{t('logo')}
|
||||
</Link>
|
||||
</SheetTitle>
|
||||
</SheetHeader>
|
||||
|
||||
Reference in New Issue
Block a user