import React, {useContext, useState} from "react"; import {useHotkeys} from "react-hotkeys-hook"; import { CardContent, CardDescription, CardHeader, CardMeta, Container, Form, GridColumn, GridRow, Image, Input, PlaceholderHeader, PlaceholderLine, StatisticLabel, StatisticValue, TableCell, TextArea, } from "semantic-ui-react"; import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"; import { APIButton, BackButton, CardLink, DirectoryLink, encodeMediaPath, ErrorMessage, ExternalCardLink, FileIcon, findPosterPath, humanFileSize, humanNumber, InfoHeader, isoDatetimeToAgoPopup, mimetypeColor, PageContainer, PreviewPath, resolveDataPath, SearchInput, SortButton, TabLinks, textEllipsis, useTitle } from "./Common"; import { deleteArchives, deleteDomain, fetchArchiveBrowsers, fetchArchiveDownloaderConfig, generateArchiveScreenshot, getCollectionTagInfo, postArchiveFileFormat, postDownload, previewBatchReorganization, refreshDomain, tagDomain, tagFileGroup, untagFileGroup, updateArchiveDownloaderConfig, } from "../api"; import {InputForm, useForm} from "../hooks/useForm"; import {CollectionTagModal} from "./collections/CollectionTagModal"; import {CollectionReorganizeModal} from "./collections/CollectionReorganizeModal"; import {BatchReorganizeModal} from "./collections/BatchReorganizeModal"; import {useReorganizationStatus} from "../contexts/FileWorkerStatusContext"; import {Link, Route, Routes, useLocation, useNavigate, useParams} from "react-router"; import Message from "semantic-ui-react/dist/commonjs/collections/Message"; import { useArchive, useArchiveStatistics, useDockerized, useDomain, useDomains, useOneQuery, useSearchArchives, useSearchDomain, useSearchOrder } from "../hooks/customHooks"; import {FileCards, FileRowTagIcon, FilesView} from "./Files"; import Grid from "semantic-ui-react/dist/commonjs/collections/Grid"; import _ from "lodash"; import {Media, ThemeContext} from "../contexts/contexts"; import {Button, Card, darkTheme, Header, Loader, Placeholder, Popup, Segment, Statistic, Tab} from "./Theme"; import {BulkTagModal} from "./BulkTagModal"; import {taggedImageLabel, TagsSelector} from "../Tags"; import {toast} from "react-semantic-toasts-2"; import {API_ARCHIVE_UPLOAD_URI, Downloaders} from "./Vars"; import {CollectionTable} from "./collections/CollectionTable"; import {CollectionEditForm} from "./collections/CollectionEditForm"; import {RecurringDownloadsTable} from "./admin/Downloads"; import {DestinationForm} from "./Download"; function ArchivePage() { const navigate = useNavigate(); const {fileGroupId} = useParams(); const {archiveFile, history, fetchArchive} = useArchive(fileGroupId); const {theme} = useContext(ThemeContext); let title = archiveFile ? archiveFile.title ? archiveFile.title : archiveFile.name : null; useTitle(title); if (archiveFile === null) { return ; } if (archiveFile === undefined) { return <>
Unknown archive
This archive does not exist
} const {data, size, directory} = archiveFile; // Resolve data paths (filename-only) to full relative paths using directory const singlefilePath = resolveDataPath(data.singlefile_path, directory); const readabilityPath = resolveDataPath(data.readability_path, directory); const screenshotPath = resolveDataPath(data.screenshot_path, directory); const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null; const readabilityUrl = readabilityPath ? `/media/${encodeMediaPath(readabilityPath)}` : null; const screenshotUrl = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null; const singlefileButton = ; const reorganizeButton = ( setReorganizeModalOpen(true)} obeyWROLMode={true} style={{marginTop: '1em'}} >Reorganize Files ); const actionButtons = <> {deleteButton} {refreshButton} {tagButton} {reorganizeButton} ; const [descriptionProps] = form.getCustomProps({name: 'description', path: 'description'}); return <> {domain?.needs_reorganization && ( File Format Changed

The file name format has changed. Click "Reorganize Files" to move existing files to match the new format.

)}