refactor
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "no-copy-frontend",
|
||||
"version": "0.38.0",
|
||||
"version": "0.39.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev -p 2999",
|
||||
|
||||
@@ -6,7 +6,6 @@ import { fileUpload, cancelUpload, chunkUpload, checkChunkStatus } from '@/app/a
|
||||
import { useTranslations } from 'next-intl';
|
||||
import { useNavigationBlocker } from '@/app/hooks/useNavigationBlocker';
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { resolve } from 'path';
|
||||
|
||||
interface SelectedFile {
|
||||
file: File;
|
||||
@@ -128,8 +127,8 @@ export default function UploadSectionFile({
|
||||
if (fileType === "image") {
|
||||
try {
|
||||
dimensions = await getImageDimensions(file) as { width: number, height: number };
|
||||
if (dimensions.width < 100 || dimensions.height < 100 ||
|
||||
dimensions.width > 10000 || dimensions.height > 10000) {
|
||||
if (dimensions?.width < 100 || dimensions?.height < 100 ||
|
||||
dimensions?.width > 10000 || dimensions?.height > 10000) {
|
||||
setError(prev => prev ? `${prev}, ${t('image-size')}: ${dimensions?.width}x${dimensions?.height}. ${t('acceptable-range')}: 100x100 - 10000x10000 ${t('pixels')}.` :
|
||||
`${t('image-size')}: ${dimensions?.width}x${dimensions?.height}. ${t('acceptable-range')}: 100x100 - 10000x10000 ${t('pixels')}.`);
|
||||
continue;
|
||||
@@ -184,7 +183,6 @@ export default function UploadSectionFile({
|
||||
|
||||
const handleClearFile = async (fileId?: string): Promise<void> => {
|
||||
if (fileId) {
|
||||
// Очистка конкретного файла
|
||||
const fileToClear = selectedFiles.find(f => f.uploadId === fileId || f.name === fileId);
|
||||
if (fileToClear?.preview) {
|
||||
URL.revokeObjectURL(fileToClear.preview);
|
||||
@@ -204,14 +202,12 @@ export default function UploadSectionFile({
|
||||
f.uploadId !== fileId && f.name !== fileId
|
||||
));
|
||||
} else {
|
||||
// Очистка всех файлов
|
||||
selectedFiles.forEach(file => {
|
||||
if (file.preview) {
|
||||
URL.revokeObjectURL(file.preview);
|
||||
}
|
||||
});
|
||||
|
||||
// Отмена всех активных загрузок
|
||||
const cancelPromises = Array.from(activeUploads).map(uploadId =>
|
||||
cancelUpload(uploadId)
|
||||
);
|
||||
@@ -319,14 +315,6 @@ export default function UploadSectionFile({
|
||||
f.name === fileInfo.name ? { ...f, status: 'error', error: errorMessage } : f
|
||||
));
|
||||
}
|
||||
} finally {
|
||||
/* if (fileInfo.uploadId) {
|
||||
setActiveUploads(prev => {
|
||||
const newSet = new Set(prev);
|
||||
newSet.delete(fileInfo.uploadId!);
|
||||
return newSet;
|
||||
});
|
||||
} */
|
||||
}
|
||||
};
|
||||
|
||||
@@ -341,9 +329,6 @@ export default function UploadSectionFile({
|
||||
|
||||
if (batch.length === 0) return;
|
||||
|
||||
console.log('Текущие pending файлы:', currentPending);
|
||||
console.log('Загружаемая партия:', batch);
|
||||
|
||||
await Promise.all(batch.map(file => uploadSingleFile(file)));
|
||||
|
||||
if (selectedFilesRef.current.some(f => f.status === 'pending')) {
|
||||
|
||||
@@ -309,8 +309,6 @@
|
||||
|
||||
.build-versions {
|
||||
position: absolute;
|
||||
/* margin-top: 20px;
|
||||
margin-left: 5px; */
|
||||
bottom: 10px;
|
||||
left: 10px;
|
||||
color: #fffc;
|
||||
|
||||
Reference in New Issue
Block a user