add check modal window

This commit is contained in:
smanylov
2026-01-28 18:53:08 +07:00
parent a6a493fe97
commit c4ab78b89b
13 changed files with 318 additions and 67 deletions
+39 -21
View File
@@ -15,11 +15,12 @@ import { IconImageFile, IconVideoFile, IconAudioFile, IconEye, IconDoubleArrowRi
import { useTranslations, useLocale } from 'next-intl';
import DropDownList from '@/app/components/dropDownList';
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import { getUserFilesData, removeUserFile } from '@/app/actions/fileEntity';
import { getUserFilesData, removeUserFile, viewFileInfo } from '@/app/actions/fileEntity';
import ModalWindow from '@/app/components/modalWindow';
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';
type FileType = 'image' | 'video' | 'audio';
@@ -423,30 +424,12 @@ export default function TanstakFilesTable({ fileType }: { fileType: string }) {
cell: ({ row }) => (
<div className="actions">
<div className="actions-group" style={{ display: "none" }}>
<button
onClick={() => handleView(row.original)}
className="bg-blue-500 hover:bg-blue-600"
>
<IconEye />
</button>
<button
onClick={() => handleProtect(row.original)}
className="bg-violet-500 hover:bg-violet-600"
>
<IconShieldExclamation />
</button>
</div>
<div className="actions-group">
<button
onClick={() => handleDownload(row.original)}
disabled={isFileLoading}
className="table-action-download"
>
<IconFileDownload />
<span>
{t('download')}
</span>
</button>
{/* <button
onClick={() => handleOpenWindowForRemove(row.original)}
className="table-action-delete"
@@ -457,6 +440,31 @@ export default function TanstakFilesTable({ fileType }: { fileType: string }) {
</span>
</button> */}
</div>
<div className="actions-group">
{row.original.protectStatus === 'PROTECTED' && (
<button
onClick={() => handleDownload(row.original)}
disabled={isFileLoading}
className="table-action-download"
>
<IconFileDownload />
<span>
{t('download')}
</span>
</button>
)}
<button
onClick={() => {
handleView(row.original)
}}
className="table-action-view"
>
<IconEye />
<span>
{t('make-check')}
</span>
</button>
</div>
</div>
),
@@ -467,9 +475,19 @@ export default function TanstakFilesTable({ fileType }: { fileType: string }) {
[]
);
// Обработчики действий
const handleView = (file: FileItem) => {
const handleView = async (file: FileItem) => {
console.log(`Просмотр файла: ${file.fileName}`);
console.log(file);
const fileInfo = await viewFileInfo(file.id);
console.log(fileInfo);
setOpenWindowChildren(() => {
return (
<FileInfoModalWindow fileInfo={fileInfo} setWindowClose={setOpenWindow} setWindowChildren={setOpenWindowChildren} />
)
})
setOpenWindow(true);
};
const handleDownload = async (file: FileItem) => {