update your files block

This commit is contained in:
smanylov
2026-01-29 16:28:05 +07:00
parent 832c4b0e76
commit fc9a7afada
6 changed files with 222 additions and 60 deletions
+22
View File
@@ -0,0 +1,22 @@
import { IconImageFile, IconVideoFile, IconAudioFile, IconDocument } from '@/app/ui/icons/icons';
export const FileTypeIcon = ({ type }: { type: string }) => {
switch (type) {
case 'image':
return <span className="color-image">
<IconImageFile />
</span>;
case 'video':
return <span className="color-video">
<IconVideoFile />
</span>;
case 'audio':
return <span className="color-audio">
<IconAudioFile />
</span>;
default:
return <span className="color-document">
<IconDocument />
</span>;
}
};
+2 -21
View File
@@ -11,7 +11,7 @@ import {
SortingState,
ColumnFiltersState,
} from '@tanstack/react-table';
import { IconImageFile, IconVideoFile, IconAudioFile, IconEye, IconDoubleArrowRight, IconArrowRight, IconDoubleArrowLeft, IconArrowLeft, IconArrowUp, IconArrowDown, IconFilter, IconFileDownload, IconShieldExclamation } from '@/app/ui/icons/icons';
import { IconEye, IconDoubleArrowRight, IconArrowRight, IconDoubleArrowLeft, IconArrowLeft, IconArrowUp, IconArrowDown, IconFilter, IconFileDownload, IconShieldExclamation } from '@/app/ui/icons/icons';
import { useTranslations, useLocale } from 'next-intl';
import DropDownList from '@/app/components/dropDownList';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
@@ -21,6 +21,7 @@ import { toast } from 'sonner';
import { pluralize } from '@/app/lib/pluralize';
import { convertBytes } from '@/app/lib/convertBytes';
import { FileInfoModalWindow } from '@/app/ui/modal-windows/file-info-modal-window';
import { FileTypeIcon } from '@/app/components/FileTypeIcon';
type FileType = 'image' | 'video' | 'audio';
@@ -53,26 +54,6 @@ type ApiResponse = {
files?: ApiFile[];
};
// Иконки для типов файлов
const FileTypeIcon = ({ type }: { type: string }) => {
switch (type) {
case 'image':
return <span className="color-image">
<IconImageFile />
</span>;
case 'video':
return <span className="color-video">
<IconVideoFile />
</span>;
case 'audio':
return <span className="color-audio">
<IconAudioFile />
</span>;
default:
return <span>📄</span>;
}
};
// Форматирование даты из timestamp
const formatDate = (timestamp: number) => {
const date = new Date(timestamp);