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