ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
import React, {useState} from "react";
|
2026-02-23 17:29:09 -07:00
|
|
|
import {useHotkeys} from "react-hotkeys-hook";
|
2022-08-06 05:22:07 +00:00
|
|
|
import {
|
2023-07-21 15:14:09 -06:00
|
|
|
APIButton,
|
2022-11-30 19:31:18 -07:00
|
|
|
BackButton,
|
2023-01-04 09:14:33 -07:00
|
|
|
CardLink,
|
2026-03-28 14:19:09 -06:00
|
|
|
DirectoryLink,
|
2023-10-20 18:53:26 -06:00
|
|
|
encodeMediaPath,
|
|
|
|
|
ErrorMessage,
|
2022-08-06 05:22:07 +00:00
|
|
|
ExternalCardLink,
|
|
|
|
|
FileIcon,
|
2023-03-29 13:46:39 -06:00
|
|
|
findPosterPath,
|
2023-04-09 14:52:44 -06:00
|
|
|
humanFileSize,
|
2025-12-17 17:27:17 -07:00
|
|
|
humanNumber,
|
2025-01-26 12:44:16 -07:00
|
|
|
InfoHeader,
|
2024-08-20 13:13:21 -06:00
|
|
|
isoDatetimeToAgoPopup,
|
2023-02-15 21:05:34 -07:00
|
|
|
PageContainer,
|
2023-08-26 20:28:34 -06:00
|
|
|
PreviewPath,
|
2025-12-24 12:30:04 -07:00
|
|
|
resolveDataPath,
|
2023-04-09 14:34:33 -06:00
|
|
|
SearchInput,
|
2022-01-29 22:25:35 -07:00
|
|
|
TabLinks,
|
2022-01-29 21:24:39 -07:00
|
|
|
textEllipsis,
|
ui: bring back the card mimetype accent
Two agents independently dropped it, each because our Card had no `color` prop
and each citing the other's precedent -- which is how a deliberate feature
quietly becomes a convention. Roland wanted it back.
Card takes a token colour name and draws it as a 3px edge along the top rather
than tinting the surface: surfaces stay flat per the design rules, and an edge
survives night mode without becoming a bright patch. Because it is a token, the
accent remaps per theme -- four hues in light and dark, a single one in night and
amber, which is the point of those themes.
Restored on every card that shows a file: the video, image and generic file cards
in Files.js, and the archive card. All of them take it from
`mimetypeColor(mimetype, path)`, the same helper that colours the file icons, so
a card and its icon agree.
2026-07-30 13:51:05 -06:00
|
|
|
mimetypeColor,
|
|
|
|
|
useTitle,
|
2022-01-29 21:24:39 -07:00
|
|
|
} from "./Common";
|
2025-12-06 14:49:46 -07:00
|
|
|
import {
|
|
|
|
|
deleteDomain,
|
2026-05-03 18:50:22 -06:00
|
|
|
deleteFileGroups,
|
2026-01-23 19:51:02 -07:00
|
|
|
fetchArchiveBrowsers,
|
2025-12-22 17:56:35 -07:00
|
|
|
fetchArchiveDownloaderConfig,
|
2025-12-06 14:49:46 -07:00
|
|
|
generateArchiveScreenshot,
|
|
|
|
|
getCollectionTagInfo,
|
2025-12-22 17:56:35 -07:00
|
|
|
postArchiveFileFormat,
|
2025-12-06 14:49:46 -07:00
|
|
|
postDownload,
|
2026-01-23 19:51:02 -07:00
|
|
|
previewBatchReorganization,
|
2025-12-06 14:49:46 -07:00
|
|
|
refreshDomain,
|
|
|
|
|
tagDomain,
|
|
|
|
|
tagFileGroup,
|
2025-12-22 17:56:35 -07:00
|
|
|
untagFileGroup,
|
|
|
|
|
updateArchiveDownloaderConfig,
|
2025-12-06 14:49:46 -07:00
|
|
|
} from "../api";
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
import {useForm} from "../hooks/useForm";
|
2026-05-03 17:28:06 -06:00
|
|
|
import {TaggedDeleteConfirmModal} from "./TaggedDeleteConfirmModal";
|
2025-10-29 22:16:33 -06:00
|
|
|
import {CollectionTagModal} from "./collections/CollectionTagModal";
|
2026-01-23 19:51:02 -07:00
|
|
|
import {CollectionReorganizeModal} from "./collections/CollectionReorganizeModal";
|
|
|
|
|
import {BatchReorganizeModal} from "./collections/BatchReorganizeModal";
|
2026-01-31 12:54:27 -07:00
|
|
|
import {useReorganizationStatus} from "../contexts/FileWorkerStatusContext";
|
2025-12-07 11:54:20 -07:00
|
|
|
import {Link, Route, Routes, useLocation, useNavigate, useParams} from "react-router";
|
2025-12-25 09:14:00 -07:00
|
|
|
import {
|
|
|
|
|
useArchive,
|
2026-02-02 15:15:28 -07:00
|
|
|
useArchiveStatistics,
|
2026-01-23 19:51:02 -07:00
|
|
|
useDockerized,
|
2025-12-25 09:14:00 -07:00
|
|
|
useDomain,
|
|
|
|
|
useDomains,
|
|
|
|
|
useOneQuery,
|
|
|
|
|
useSearchArchives,
|
|
|
|
|
useSearchDomain,
|
|
|
|
|
useSearchOrder
|
|
|
|
|
} from "../hooks/customHooks";
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
import {DeepSearchHint, FileCards, FileRowTagIcon, FilesView, SearchControlBar} from "./Files";
|
2022-08-06 05:22:07 +00:00
|
|
|
import _ from "lodash";
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
import {
|
|
|
|
|
ActionInput,
|
|
|
|
|
Button,
|
|
|
|
|
Card,
|
|
|
|
|
Header,
|
|
|
|
|
Icon,
|
|
|
|
|
IconButton,
|
|
|
|
|
Loader,
|
|
|
|
|
Loading,
|
|
|
|
|
Message,
|
|
|
|
|
Panel,
|
|
|
|
|
Placeholder,
|
|
|
|
|
Select,
|
|
|
|
|
Statistic,
|
|
|
|
|
StatisticGroup,
|
|
|
|
|
Table,
|
|
|
|
|
Tabs,
|
|
|
|
|
Textarea,
|
|
|
|
|
TextInput,
|
|
|
|
|
Tooltip,
|
|
|
|
|
toast,
|
|
|
|
|
} from "./ui";
|
2026-04-09 16:18:26 -06:00
|
|
|
import {BulkTagModal} from "./BulkTagModal";
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
import {TagsSelector} from "../Tags";
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
import {AddToPlaylistButton} from "./AddToPlaylist";
|
2025-01-26 12:44:16 -07:00
|
|
|
import {API_ARCHIVE_UPLOAD_URI, Downloaders} from "./Vars";
|
2025-10-29 22:16:33 -06:00
|
|
|
import {CollectionTable} from "./collections/CollectionTable";
|
|
|
|
|
import {CollectionEditForm} from "./collections/CollectionEditForm";
|
|
|
|
|
import {RecurringDownloadsTable} from "./admin/Downloads";
|
2025-12-05 18:26:36 -07:00
|
|
|
import {DestinationForm} from "./Download";
|
2022-08-06 05:22:07 +00:00
|
|
|
|
|
|
|
|
function ArchivePage() {
|
|
|
|
|
const navigate = useNavigate();
|
2026-03-20 15:38:32 -06:00
|
|
|
const {fileGroupId} = useParams();
|
|
|
|
|
const {archiveFile, history, fetchArchive} = useArchive(fileGroupId);
|
2026-05-03 17:28:06 -06:00
|
|
|
const [taggedFileGroups, setTaggedFileGroups] = useState(null);
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2023-10-24 10:20:06 -06:00
|
|
|
let title = archiveFile ? archiveFile.title ? archiveFile.title : archiveFile.name : null;
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle(title);
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
if (archiveFile === null) {
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
return <Panel><Loading>Loading archive...</Loading></Panel>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
2022-08-06 05:22:07 +00:00
|
|
|
if (archiveFile === undefined) {
|
2022-05-16 17:56:55 -06:00
|
|
|
return <>
|
|
|
|
|
<Header as='h2'>Unknown archive</Header>
|
2022-09-28 09:38:05 -06:00
|
|
|
<Header as='h4'>This archive does not exist</Header>
|
2022-05-16 17:56:55 -06:00
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
const {data, size, directory} = archiveFile;
|
2022-08-06 05:22:07 +00:00
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
// 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;
|
2022-05-16 17:56:55 -06:00
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
const singlefileButton = <ExternalCardLink to={singlefileUrl}>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Button color='violet'>View</Button>
|
2022-08-06 05:22:07 +00:00
|
|
|
</ExternalCardLink>;
|
2024-05-25 09:40:13 -06:00
|
|
|
const readButton = <ExternalCardLink to={readabilityUrl}>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Button color='blue' disabled={!!!readabilityUrl}>Read</Button>
|
2024-05-25 09:40:13 -06:00
|
|
|
</ExternalCardLink>
|
2022-05-16 17:56:55 -06:00
|
|
|
|
|
|
|
|
const screenshot = screenshotUrl ?
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<img alt='Archive screenshot' src={screenshotUrl}
|
|
|
|
|
style={{marginTop: '1em', marginBottom: '1em', maxWidth: '100%'}}/> :
|
2022-05-16 17:56:55 -06:00
|
|
|
null;
|
|
|
|
|
|
2026-05-03 17:28:06 -06:00
|
|
|
const localDeleteArchive = async (force = false) => {
|
2026-05-03 18:50:22 -06:00
|
|
|
const result = await deleteFileGroups([archiveFile.id], force);
|
2026-05-03 17:28:06 -06:00
|
|
|
if (result && result.tagged) {
|
|
|
|
|
setTaggedFileGroups(result.file_groups);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2023-07-21 15:14:09 -06:00
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Archive Deleted',
|
|
|
|
|
description: 'Archive was successfully deleted.',
|
|
|
|
|
time: 2000,
|
|
|
|
|
})
|
2022-09-23 16:22:57 -06:00
|
|
|
navigate(-1);
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
2024-04-14 14:05:22 -06:00
|
|
|
|
2022-11-14 15:42:57 -07:00
|
|
|
const localUpdateArchive = async () => {
|
2024-11-02 15:14:02 -06:00
|
|
|
const downloadData = {urls: [archiveFile.url], downloader: Downloaders.Archive};
|
|
|
|
|
const response = await postDownload(downloadData);
|
2024-04-14 14:02:02 -06:00
|
|
|
if (response.ok) {
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Archive Downloading',
|
|
|
|
|
description: 'Archive update has been scheduled.',
|
|
|
|
|
time: 2000,
|
|
|
|
|
});
|
|
|
|
|
}
|
2022-05-16 17:56:55 -06:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-10-19 11:40:02 -06:00
|
|
|
const localGenerateScreenshot = async () => {
|
2026-03-20 15:38:32 -06:00
|
|
|
const success = await generateArchiveScreenshot(archiveFile.id);
|
2025-10-19 11:40:02 -06:00
|
|
|
if (success) {
|
|
|
|
|
// Refresh the archive data after a short delay to show the new screenshot
|
|
|
|
|
setTimeout(() => fetchArchive(), 2000);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
const updateButton = <APIButton
|
|
|
|
|
color='green'
|
|
|
|
|
confirmContent='Download the latest version of this URL?'
|
|
|
|
|
confirmButton='Update'
|
|
|
|
|
onClick={localUpdateArchive}
|
|
|
|
|
obeyWROLMode={true}
|
2023-08-26 20:28:34 -06:00
|
|
|
>
|
|
|
|
|
Update
|
|
|
|
|
</APIButton>;
|
2023-07-21 15:14:09 -06:00
|
|
|
const deleteButton = <APIButton
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='danger'
|
2023-07-21 15:14:09 -06:00
|
|
|
confirmContent='Are you sure you want to delete this archive? All files will be deleted'
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
confirmButton='Delete Archive'
|
2026-05-03 17:28:06 -06:00
|
|
|
onClick={() => localDeleteArchive(false)}
|
2023-07-21 15:14:09 -06:00
|
|
|
obeyWROLMode={true}
|
2023-08-26 20:28:34 -06:00
|
|
|
>
|
|
|
|
|
Delete
|
|
|
|
|
</APIButton>;
|
2025-10-19 11:40:02 -06:00
|
|
|
const generateScreenshotButton = !screenshotUrl ? <APIButton
|
|
|
|
|
color='yellow'
|
|
|
|
|
confirmContent='Generate a screenshot for this archive?'
|
|
|
|
|
confirmButton='Generate'
|
|
|
|
|
onClick={localGenerateScreenshot}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
>
|
|
|
|
|
Generate Screenshot
|
|
|
|
|
</APIButton> : null;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
let historyList = <Loader/>;
|
2023-01-04 09:14:33 -07:00
|
|
|
if (history && history.length === 0) {
|
2022-11-14 15:42:57 -07:00
|
|
|
historyList = <p>No history available</p>;
|
2023-01-04 09:14:33 -07:00
|
|
|
} else if (history) {
|
|
|
|
|
historyList = <FileCards files={history}/>;
|
2022-01-03 15:13:02 -07:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2023-07-27 15:53:47 -06:00
|
|
|
const domain = data.domain ? data.domain : null;
|
2023-08-26 20:28:34 -06:00
|
|
|
let domainHeader = <p>Unknown</p>;
|
2022-10-27 11:30:53 -06:00
|
|
|
if (domain) {
|
2026-03-20 15:38:32 -06:00
|
|
|
const domainUrl = `/archives?domain=${domain}`;
|
2023-07-27 15:53:47 -06:00
|
|
|
domainHeader = <Header as='h4'>
|
2023-10-31 10:20:45 -06:00
|
|
|
<a href={domainUrl}>{domain}</a>
|
2022-10-27 11:30:53 -06:00
|
|
|
</Header>;
|
|
|
|
|
}
|
|
|
|
|
|
2023-04-02 16:30:01 -06:00
|
|
|
const localAddTag = async (name) => {
|
2023-05-29 18:04:03 -06:00
|
|
|
await tagFileGroup(archiveFile, name);
|
2023-04-02 16:30:01 -06:00
|
|
|
await fetchArchive();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const localRemoveTag = async (name) => {
|
2023-05-29 18:04:03 -06:00
|
|
|
await untagFileGroup(archiveFile, name);
|
2023-04-02 16:30:01 -06:00
|
|
|
await fetchArchive();
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-25 09:14:00 -07:00
|
|
|
const downloadDatetimeString = archiveFile.download_datetime ?
|
|
|
|
|
isoDatetimeToAgoPopup(archiveFile.download_datetime, true) : 'unknown';
|
|
|
|
|
const publishedDatetimeString = archiveFile.published_datetime ?
|
|
|
|
|
isoDatetimeToAgoPopup(archiveFile.published_datetime, true) : 'unknown';
|
2023-10-20 18:53:26 -06:00
|
|
|
const modifiedDatetimeString = archiveFile.published_modified_datetime
|
2024-11-02 15:14:02 -06:00
|
|
|
? isoDatetimeToAgoPopup(archiveFile.published_modified_datetime, true)
|
2023-10-20 18:53:26 -06:00
|
|
|
: 'unknown';
|
|
|
|
|
|
2026-03-28 14:19:09 -06:00
|
|
|
// Helper to find file size from the files array by resolved path
|
|
|
|
|
const findFileSize = (resolvedPath) => {
|
|
|
|
|
if (!resolvedPath || !archiveFile.files) return null;
|
|
|
|
|
const file = archiveFile.files.find(i => String(i.path) === String(resolvedPath));
|
|
|
|
|
return file && file.size
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
? <span style={{marginLeft: '1em', color: 'var(--muted)'}}>({humanFileSize(file.size)})</span>
|
2026-03-28 14:19:09 -06:00
|
|
|
: null;
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
// Helper to resolve and preview a data path
|
|
|
|
|
const localPreviewPath = (dataPath, mimetype) => {
|
|
|
|
|
const resolvedPath = resolveDataPath(dataPath, directory);
|
|
|
|
|
if (resolvedPath) {
|
2026-03-28 14:19:09 -06:00
|
|
|
return <><PreviewPath path={resolvedPath} mimetype={mimetype}
|
|
|
|
|
taggable={false}>{resolvedPath}</PreviewPath>{findFileSize(resolvedPath)}</>
|
2023-08-26 20:28:34 -06:00
|
|
|
} else {
|
|
|
|
|
return 'Unknown'
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-03-28 14:19:09 -06:00
|
|
|
const tableStyle = {width: '100%', borderCollapse: 'separate', borderSpacing: '0 0.7em'};
|
|
|
|
|
const labelStyle = {whiteSpace: 'nowrap', paddingRight: '1.5em', verticalAlign: 'top'};
|
2023-08-26 20:28:34 -06:00
|
|
|
|
2023-02-17 16:09:24 -07:00
|
|
|
return <>
|
ui: a Back button is a row of one, not a stretched flex child
Reported: the Back button fills the page width on the domain and channel edit
pages. It fills it on all nine pages that have one, and this is mine from the
last PR.
`.wrolpi-stack` is a flex column at `align-items: stretch`, deliberately -- a
panel was full-width as a block element and has to stay that way. A BARE button
as a direct child of that stack is stretched too, and every page's Back button
was one. On the domain, channel and playlist edit pages it also pushed the
button beside it onto its own line, where the two had been inline.
Wrapping each in a `.wrolpi-button-row` fixes both without touching the stack:
the row is the stretched child, and it lays its buttons out at their own width.
The three pages that have a second button get one row holding both, which is how
they read before.
Also the Videos, Archives and Documents select bars, whose Tag/Delete/Invert/
Clear were four touching buttons in a bare div. They are inline elements rather
than interpolations, which is the shape the bare-siblings scan does not see.
Guarded twice: the row keeps its buttons their own width inside a stack while
itself stretching (both halves, since a row that refused to stretch would pass a
test that only looked at the button), and every `<BackButton/>` in the app is
inside a row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:47:33 -06:00
|
|
|
<div className='wrolpi-button-row'><BackButton/></div>
|
2022-05-16 17:56:55 -06:00
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Panel>
|
2023-02-17 16:09:24 -07:00
|
|
|
{screenshot}
|
|
|
|
|
<ExternalCardLink to={singlefileUrl}>
|
2023-04-06 11:05:14 -06:00
|
|
|
<Header as='h2'>{textEllipsis(archiveFile.title || data.url)}</Header>
|
2023-02-17 16:09:24 -07:00
|
|
|
</ExternalCardLink>
|
2023-10-20 18:53:26 -06:00
|
|
|
|
|
|
|
|
<Header as='h3'>Author: {archiveFile.author ? archiveFile.author : 'unknown'}</Header>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{display: 'flex', flexWrap: 'wrap', gap: '1em', marginBottom: '1em'}}>
|
|
|
|
|
<div style={{flex: '1 1 240px'}}>
|
|
|
|
|
<Header as='h4'>Published: {publishedDatetimeString}</Header>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{flex: '1 1 240px'}}>
|
|
|
|
|
<Header as='h4'>Downloaded: {downloadDatetimeString}</Header>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2023-02-17 16:09:24 -07:00
|
|
|
|
ui: a row of buttons is spaced by the row
The archive page's six actions shared edges, and Update sat lower than the
rest. Both come from the same thing: Semantic's Button carried
`margin: 0 .25em .25em 0`, so a page could list buttons as bare siblings and
they arrived spaced -- and separated from the line below when the row wrapped.
Nothing replaced that margin.
Two of those six answered with `marginTop: 0.5em`, which is the wrong axis: a
Button is `display: inline-flex; vertical-align: middle`, and `vertical-align`
is measured on the MARGIN box, so half of any top margin shows up as the
visible button dropping. It was covering the wrapped-row case in the only axis
a margin can, and paying for it in the other one.
`.wrolpi-button-row` is a flex row with a gap, so both axes are covered at once
and no button needs a margin of its own -- the same rule as `.wrolpi-stack`,
along the other axis. Applied to the five rows in the app that had no gap: the
archive page, the shared collection edit form (which three pages hand action
buttons to, and where nine buttons plus Cancel carried `margin-top: 1em` each
while Save carried none), the doc page's two responsive branches, and the
downloads table's edit/restart pair.
`.action-button-spacing` goes with them; it was that same margin, on Cancel.
Guarded four ways. ui-layout.cy.js measures that the row really spaces what it
holds, wraps rather than overflows, centres its buttons against a taller item
beside them, and counts a confirmed APIButton as one item rather than two --
that one returns a fragment holding a `<Confirm/>`, which would open a hole in
the row if it did not portal. Common.test.js scans for the two ways this comes
back: a button in a row stamping a vertical margin, and a row of buttons that is
not a row. Neither throws, which is how the app got here.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:39:03 -06:00
|
|
|
<div className='wrolpi-button-row'>
|
|
|
|
|
{singlefileButton}
|
|
|
|
|
{readButton}
|
|
|
|
|
{updateButton}
|
|
|
|
|
{deleteButton}
|
|
|
|
|
{generateScreenshotButton}
|
|
|
|
|
<AddToPlaylistButton fileGroupId={archiveFile.id}/>
|
|
|
|
|
</div>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
2023-02-17 16:09:24 -07:00
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Panel>
|
2024-07-22 16:36:57 -06:00
|
|
|
<TagsSelector
|
|
|
|
|
selectedTagNames={archiveFile['tags']}
|
|
|
|
|
onAdd={localAddTag}
|
|
|
|
|
onRemove={localRemoveTag}
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
|
|
|
|
|
|
|
|
|
<Tabs defaultValue='about'>
|
|
|
|
|
<Tabs.List>
|
|
|
|
|
<Tabs.Tab value='about'>About</Tabs.Tab>
|
|
|
|
|
<Tabs.Tab value='files'>Files</Tabs.Tab>
|
|
|
|
|
</Tabs.List>
|
|
|
|
|
<Tabs.Panel value='about' pt='md'>
|
|
|
|
|
<Header as={'h3'}>Domain</Header>
|
|
|
|
|
{domainHeader}
|
|
|
|
|
|
|
|
|
|
<Header as='h3'>Size</Header>
|
|
|
|
|
{humanFileSize(size)}
|
|
|
|
|
|
|
|
|
|
<Header as={'h3'}>URL</Header>
|
|
|
|
|
<p>{archiveFile.url ? <a href={archiveFile.url}>{archiveFile.url}</a> : 'N/A'}</p>
|
|
|
|
|
|
|
|
|
|
<Header as={'h3'}>Modified Date</Header>
|
|
|
|
|
<p>{modifiedDatetimeString}</p>
|
|
|
|
|
</Tabs.Panel>
|
|
|
|
|
<Tabs.Panel value='files' pt='md'>
|
|
|
|
|
<table style={tableStyle}>
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Singlefile File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.singlefile_path, 'text/html')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_path, 'text/html')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability Text File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_txt_path, 'text/plain')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Readability JSON File</strong></td>
|
|
|
|
|
<td>{localPreviewPath(data.readability_json_path, 'application/json')}</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Screenshot File</strong></td>
|
|
|
|
|
<td>
|
|
|
|
|
{screenshotPath
|
|
|
|
|
? <><PreviewPath path={screenshotPath} mimetype='image/*'
|
|
|
|
|
taggable={false}>{screenshotPath}</PreviewPath>{findFileSize(screenshotPath)}</>
|
|
|
|
|
: 'Unknown'}
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
<tr>
|
|
|
|
|
<td style={labelStyle}><strong>Directory</strong></td>
|
|
|
|
|
<td><DirectoryLink path={archiveFile.directory}/></td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</Tabs.Panel>
|
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
|
<Panel>
|
2025-01-24 14:28:04 -07:00
|
|
|
<InfoHeader
|
2023-02-17 16:09:24 -07:00
|
|
|
headerContent='History'
|
|
|
|
|
popupContent='Other archives of this URL created at different times.'
|
|
|
|
|
/>
|
|
|
|
|
{historyList}
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
2026-05-03 17:28:06 -06:00
|
|
|
|
|
|
|
|
<TaggedDeleteConfirmModal
|
|
|
|
|
open={taggedFileGroups !== null}
|
|
|
|
|
taggedFileGroups={taggedFileGroups}
|
|
|
|
|
onCancel={() => setTaggedFileGroups(null)}
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
|
setTaggedFileGroups(null);
|
|
|
|
|
await localDeleteArchive(true);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-02-17 16:09:24 -07:00
|
|
|
</>
|
2022-05-16 17:56:55 -06:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
export function ArchiveCard({file}) {
|
2026-03-17 18:35:57 -06:00
|
|
|
const {sort} = useSearchOrder();
|
|
|
|
|
const sortField = sort ? sort.replace(/^-/, '') : null;
|
2025-12-24 12:30:04 -07:00
|
|
|
const {data, directory} = file;
|
|
|
|
|
|
|
|
|
|
// Resolve data paths (filename-only) to full relative paths using directory
|
|
|
|
|
const screenshotPath = resolveDataPath(data.screenshot_path, directory);
|
|
|
|
|
const singlefilePath = resolveDataPath(data.singlefile_path, directory);
|
2022-05-16 17:56:55 -06:00
|
|
|
|
2025-12-24 12:30:04 -07:00
|
|
|
const imageSrc = screenshotPath ? `/media/${encodeMediaPath(screenshotPath)}` : null;
|
|
|
|
|
const singlefileUrl = singlefilePath ? `/media/${encodeMediaPath(singlefilePath)}` : null;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
// Marks a tagged file, pinned to the poster's corner (same convention as CardPoster).
|
|
|
|
|
const cardTagIcon = <div className='wrolpi-card-tag'><Icon name='tag' size={14} label='Tagged'/></div>;
|
|
|
|
|
const imageLabel = !_.isEmpty(file.tags) ? cardTagIcon : null;
|
|
|
|
|
|
|
|
|
|
let media;
|
2022-08-06 05:22:07 +00:00
|
|
|
if (imageSrc) {
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
media = <ExternalCardLink to={singlefileUrl}>
|
|
|
|
|
<div style={{position: 'relative'}}>
|
|
|
|
|
{imageLabel}
|
|
|
|
|
<img alt='' src={imageSrc} style={{width: '100%', display: 'block'}}/>
|
|
|
|
|
</div>
|
|
|
|
|
</ExternalCardLink>;
|
|
|
|
|
} else {
|
|
|
|
|
media = <ExternalCardLink to={singlefileUrl}>
|
|
|
|
|
<div className='wrolpi-card-icon'>
|
|
|
|
|
{imageLabel}
|
|
|
|
|
<FileIcon file={file}/>
|
|
|
|
|
</div>
|
|
|
|
|
</ExternalCardLink>;
|
2022-08-06 05:22:07 +00:00
|
|
|
}
|
|
|
|
|
|
2023-03-24 08:58:18 -06:00
|
|
|
const domain = data ? data.domain : null;
|
2026-03-20 15:38:32 -06:00
|
|
|
const domainUrl = `/archives?domain=${domain}`;
|
2022-01-30 16:27:06 -07:00
|
|
|
|
2024-08-20 13:13:21 -06:00
|
|
|
const title = file.title || data.url;
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
const titleElm = <Tooltip label={title}>
|
|
|
|
|
<ExternalCardLink to={singlefileUrl} className='card-title-ellipsis'>{title}</ExternalCardLink>
|
|
|
|
|
</Tooltip>;
|
2024-08-20 13:13:21 -06:00
|
|
|
const dt = file.published_datetime || file.published_modified_datetime || file.modified;
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
|
|
|
|
|
const meta = <>
|
|
|
|
|
{domain && <div>
|
|
|
|
|
<CardLink to={domainUrl}>{domain}</CardLink>
|
|
|
|
|
</div>}
|
2023-02-17 16:09:24 -07:00
|
|
|
<div>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
{sortField === 'published_modified_datetime'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.published_modified_datetime, false)
|
|
|
|
|
: sortField === 'download_datetime'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.download_datetime, false)
|
|
|
|
|
: sortField === 'size'
|
|
|
|
|
? humanFileSize(file.size)
|
|
|
|
|
: sortField === 'viewed'
|
|
|
|
|
? isoDatetimeToAgoPopup(file.viewed, false)
|
|
|
|
|
: isoDatetimeToAgoPopup(dt, false)
|
|
|
|
|
}
|
|
|
|
|
</div>
|
|
|
|
|
</>;
|
|
|
|
|
|
ui: cards get legible titles, contained posters, and meta beside the title
Four defects on /videos, /docs and /archives.
Titles were invisible outside light. `.card-link` carried a literal
`color: black` from before the themes existed -- about 1.1:1 on the dark,
night and amber panels. It applies to every card title and to the
channel/author/domain line beside it. The date was fine, since it takes
`--muted` from the card body, which is what made this look like a card
bug rather than a link bug. Titles now take `--text`: they are links,
but they are the card's text, not a wall of blue.
Posters were cropped, not mis-proportioned. The image carried a fixed
290x163 box; a card in the default grid is about 233px wide and Mantine's
Card sets `overflow: hidden`, so the browser painted the middle 233px of
a 290px image. The ratio was right in the layout tree and wrong on
screen. Replaced with caps on both axes -- the card's width and
`--card-poster-max-height: 200px` -- with `width`/`height` left `auto` so
the pair behaves as "contain". Bounding the width alone was tried first
and is not enough: a square thumbnail then stands as tall as the card is
wide, and a portrait book cover taller still.
The meta line was foot-anchored, so on /docs a PDF with no author had its
date shoved up to 55px below the title, at the bottom of a card that was
tall only because of its neighbour in the row. It now sits directly
under the title.
Archive cards read buttons-then-domain, because the buttons were children
and the meta was what got pushed to the foot. Card gains an `actions`
slot, rendered last and anchored to the foot, so a row lines its buttons
up however many lines each title took.
Gallery gains a poster row covering all five ratios and a row showing
meta/actions against unequal titles.
1076 jest tests, 145 in ui-layout.cy.js, clean build. Every new guard was
checked against a planted regression: dropping the height cap reddens the
square and portrait cases and leaves 16:9 green; `width: 100%` reddens
containment; restoring `color: black` reddens dark/night/amber and leaves
light green; re-anchoring the meta and swapping the slot order redden both
the jest order test and the cypress geometry tests.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-02 09:16:31 -06:00
|
|
|
const actions = <div style={{display: 'flex', gap: '0.5em'}}>
|
|
|
|
|
<Link to={`/archives/${file.id}`}>
|
|
|
|
|
<Button icon='file alternate'>Details</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
<IconButton
|
|
|
|
|
icon='external'
|
|
|
|
|
label='Open original URL'
|
|
|
|
|
component='a'
|
|
|
|
|
href={file.url}
|
|
|
|
|
target='_blank'
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
/>
|
|
|
|
|
</div>;
|
|
|
|
|
|
|
|
|
|
return <Card media={media} title={titleElm} meta={meta} actions={actions}
|
|
|
|
|
color={mimetypeColor(file.mimetype, file.primary_path)}/>
|
2022-01-03 15:13:02 -07:00
|
|
|
}
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-12-05 17:12:21 -07:00
|
|
|
// Domain table column configuration
|
|
|
|
|
const DOMAIN_COLUMNS = [
|
|
|
|
|
{key: 'domain', label: 'Domain', sortable: true, width: 7},
|
|
|
|
|
{key: 'tag_name', label: 'Tag', sortable: true, width: 2},
|
|
|
|
|
{key: 'archive_count', label: 'Archives', sortable: true, align: 'right', width: 2},
|
2025-12-06 14:49:46 -07:00
|
|
|
{
|
|
|
|
|
key: 'min_download_frequency',
|
|
|
|
|
label: 'Download Frequency',
|
|
|
|
|
sortable: true,
|
|
|
|
|
format: 'frequency',
|
|
|
|
|
width: 2,
|
|
|
|
|
hideOnMobile: true
|
|
|
|
|
},
|
2025-12-05 17:12:21 -07:00
|
|
|
{key: 'size', label: 'Size', sortable: true, align: 'right', format: 'bytes', width: 2, hideOnMobile: true},
|
|
|
|
|
{key: 'actions', label: 'Manage', sortable: false, type: 'actions', width: 1}
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
const DOMAIN_ROUTES = {
|
2026-03-20 15:38:32 -06:00
|
|
|
list: '/archives/domains',
|
|
|
|
|
edit: '/archives/domain/:id/edit',
|
|
|
|
|
search: '/archives',
|
2025-12-05 17:12:21 -07:00
|
|
|
searchParam: 'domain'
|
|
|
|
|
};
|
|
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
function DomainStatistics({statistics}) {
|
|
|
|
|
if (!statistics) {
|
|
|
|
|
return <></>
|
|
|
|
|
}
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
return <Panel>
|
2025-12-17 17:27:17 -07:00
|
|
|
<Header as='h1'>Statistics</Header>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<StatisticGroup>
|
|
|
|
|
<Statistic value={statistics.archive_count} label='Archives'/>
|
|
|
|
|
<Statistic value={humanFileSize(statistics.size, true)} label='Total Size'/>
|
|
|
|
|
<Statistic value={humanFileSize(statistics.largest_archive, true)} label='Largest Archive'/>
|
|
|
|
|
<Statistic value={humanNumber(statistics.archive_tags)} label='Archive Tags'/>
|
|
|
|
|
</StatisticGroup>
|
|
|
|
|
</Panel>
|
2025-12-17 17:27:17 -07:00
|
|
|
}
|
|
|
|
|
|
2023-04-09 14:13:36 -06:00
|
|
|
export function DomainsPage() {
|
2022-10-25 15:57:44 -06:00
|
|
|
useTitle('Archive Domains');
|
|
|
|
|
|
2025-12-05 17:12:21 -07:00
|
|
|
const [domains] = useDomains();
|
2025-10-29 22:16:33 -06:00
|
|
|
const [searchStr, setSearchStr] = useOneQuery('domain');
|
2026-02-23 17:29:09 -07:00
|
|
|
const searchInputRef = React.useRef();
|
|
|
|
|
|
|
|
|
|
useHotkeys('f', (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (searchInputRef.current) {
|
|
|
|
|
searchInputRef.current.focus();
|
|
|
|
|
}
|
|
|
|
|
}, {enableOnFormTags: false});
|
2025-10-29 22:16:33 -06:00
|
|
|
|
ui: stop /archives/settings wrapping itself in a second PageContainer
`ArchiveRoute` wraps its `<Routes>` in a PageContainer, and
`ArchiveSettingsPage` wrapped itself in another. PageContainer carries
`margin-top: 1em` and `padding: 1em`, so that page sat 1em lower and 1em
further in on all four sides than /archives/domains beside it -- which is
exactly what "seems to have more margin" was. It is a fragment now, so its
panels are blocks of the route's own stack.
Guarded by a source scan rather than a render, since a doubled margin throws
nothing: it takes each PageContainer that wraps a router, reads the
components it routes to, and fails if one of them renders a PageContainer of
its own.
The first version of that scan passed against the live bug. It looked at
only the first `<PageContainer>` in a file, and in Archive.js that is the
offender itself, whose block holds no `<Routes>` -- so the file was skipped
before the route wrapper 400 lines below was reached. It reads every
occurrence now, and the premise assertions count both the wrappers found and
the routes within them.
Two more top-level blocks gave up margins that were being added to the
page's gap, both headers "matching" each other's pattern: the domain filter
row (35.2px against 17.6px) and the channel filter row.
/archives/settings and /archives/domains now measure identically -- tab bar
bottom at 136.8px, first block 17.6px below it, content inset 17.6px -- as
do the statistics and settings pages of every other tab group.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 15:53:04 -06:00
|
|
|
// Header section matching ChannelsPage pattern. No `marginBottom`: this is a top-level block
|
|
|
|
|
// of the page, and the page's stack spaces it -- its own margin was added to that gap.
|
|
|
|
|
const header = <div style={{display: 'flex', flexWrap: 'wrap', gap: '1em', alignItems: 'center'}}>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{flex: '1 1 240px'}}>
|
|
|
|
|
<SearchInput
|
|
|
|
|
placeholder='Domain filter...'
|
|
|
|
|
size='large'
|
|
|
|
|
searchStr={searchStr}
|
|
|
|
|
disabled={!Array.isArray(domains) || domains.length === 0}
|
|
|
|
|
onClear={() => setSearchStr('')}
|
|
|
|
|
onChange={setSearchStr}
|
|
|
|
|
onSubmit={null}
|
|
|
|
|
inputRef={searchInputRef}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
<div style={{flex: '1 1 240px', textAlign: 'right'}}>
|
|
|
|
|
{/* No "New Domain" button - domains are auto-created */}
|
|
|
|
|
</div>
|
2025-10-29 22:16:33 -06:00
|
|
|
</div>;
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Empty state
|
|
|
|
|
if (domains && domains.length === 0) {
|
2023-01-04 09:14:33 -07:00
|
|
|
return <>
|
2025-10-29 22:16:33 -06:00
|
|
|
{header}
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Message kind='info' title='No domains yet. Archive some webpages!'/>
|
2023-01-04 09:14:33 -07:00
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Error state
|
|
|
|
|
if (domains === undefined) {
|
|
|
|
|
return <>
|
|
|
|
|
{header}
|
|
|
|
|
<ErrorMessage>Could not fetch Domains</ErrorMessage>
|
|
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
return <>
|
|
|
|
|
{header}
|
|
|
|
|
<CollectionTable
|
|
|
|
|
collections={domains}
|
2025-12-05 17:12:21 -07:00
|
|
|
columns={DOMAIN_COLUMNS}
|
|
|
|
|
routes={DOMAIN_ROUTES}
|
2025-10-29 22:16:33 -06:00
|
|
|
searchStr={searchStr}
|
|
|
|
|
/>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function DomainEditPage() {
|
|
|
|
|
const {domainId} = useParams();
|
|
|
|
|
const navigate = useNavigate();
|
|
|
|
|
const {domain, form, fetchDomain} = useDomain(parseInt(domainId));
|
|
|
|
|
|
|
|
|
|
// Modal state for tagging
|
|
|
|
|
const [tagEditModalOpen, setTagEditModalOpen] = useState(false);
|
2026-01-23 19:51:02 -07:00
|
|
|
// Modal state for reorganization
|
|
|
|
|
const [reorganizeModalOpen, setReorganizeModalOpen] = useState(false);
|
2025-10-29 22:16:33 -06:00
|
|
|
|
|
|
|
|
useTitle(`Edit Domain: ${domain?.domain || '...'}`);
|
|
|
|
|
|
|
|
|
|
// Wrap form.onSubmit to add toast and refresh domain data
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (form && form.onSubmit) {
|
|
|
|
|
const originalOnSubmit = form.onSubmit;
|
|
|
|
|
form.onSubmit = async () => {
|
|
|
|
|
try {
|
|
|
|
|
await originalOnSubmit();
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Domain Updated',
|
|
|
|
|
description: 'Domain was successfully updated',
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
// Refresh domain data to show updated values
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to update domain:', e);
|
|
|
|
|
throw e;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}, [form, fetchDomain]);
|
|
|
|
|
|
|
|
|
|
// Handler for tag modal save
|
|
|
|
|
const handleTagSave = async (tagName, directory) => {
|
|
|
|
|
try {
|
|
|
|
|
await tagDomain(parseInt(domainId), tagName, directory);
|
|
|
|
|
toast({
|
|
|
|
|
type: 'success',
|
|
|
|
|
title: 'Domain Tagged',
|
|
|
|
|
description: `Domain "${domain?.domain}" has been tagged with "${tagName}"`,
|
|
|
|
|
time: 3000,
|
|
|
|
|
});
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to tag domain', e);
|
|
|
|
|
} finally {
|
|
|
|
|
setTimeout(async () => {
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
}, 500);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// Handler for fetching tag info
|
|
|
|
|
const handleGetTagInfo = async (tagName) => {
|
|
|
|
|
if (domain?.id) {
|
|
|
|
|
return await getCollectionTagInfo(domain.id, tagName);
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const handleRefreshDomain = async (e) => {
|
|
|
|
|
if (e) {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
}
|
|
|
|
|
await refreshDomain(parseInt(domainId));
|
|
|
|
|
// Refresh domain data after completion
|
|
|
|
|
await fetchDomain();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (!form.ready) {
|
2026-07-16 19:40:28 -06:00
|
|
|
if (form.error) {
|
|
|
|
|
return <>
|
ui: a Back button is a row of one, not a stretched flex child
Reported: the Back button fills the page width on the domain and channel edit
pages. It fills it on all nine pages that have one, and this is mine from the
last PR.
`.wrolpi-stack` is a flex column at `align-items: stretch`, deliberately -- a
panel was full-width as a block element and has to stay that way. A BARE button
as a direct child of that stack is stretched too, and every page's Back button
was one. On the domain, channel and playlist edit pages it also pushed the
button beside it onto its own line, where the two had been inline.
Wrapping each in a `.wrolpi-button-row` fixes both without touching the stack:
the row is the stretched child, and it lays its buttons out at their own width.
The three pages that have a second button get one row holding both, which is how
they read before.
Also the Videos, Archives and Documents select bars, whose Tag/Delete/Invert/
Clear were four touching buttons in a bare div. They are inline elements rather
than interpolations, which is the shape the bare-siblings scan does not see.
Guarded twice: the row keeps its buttons their own width inside a stack while
itself stretching (both halves, since a row that refused to stretch would pass a
test that only looked at the button), and every `<BackButton/>` in the app is
inside a row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:47:33 -06:00
|
|
|
<div className='wrolpi-button-row'><BackButton/></div>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Message kind='error' title='Domain not found'>
|
2026-07-16 19:40:28 -06:00
|
|
|
<p>{form.error}</p>
|
|
|
|
|
</Message>
|
|
|
|
|
</>;
|
|
|
|
|
}
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
return <Loading>Loading domain...</Loading>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
// Handler for domain deletion
|
|
|
|
|
const handleDelete = async () => {
|
|
|
|
|
try {
|
|
|
|
|
let response = await deleteDomain(parseInt(domainId));
|
|
|
|
|
if (response.status === 204) {
|
2026-03-20 15:38:32 -06:00
|
|
|
navigate('/archives/domains');
|
2025-10-29 22:16:33 -06:00
|
|
|
}
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Failed to delete domain', e);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const deleteButton = <APIButton
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='danger'
|
2025-10-29 22:16:33 -06:00
|
|
|
size='small'
|
|
|
|
|
confirmContent='Are you sure you want to delete this domain? No archive files will be deleted, but archives will be orphaned.'
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
confirmButton='Delete Domain'
|
2025-10-29 22:16:33 -06:00
|
|
|
confirmHeader='Delete Domain?'
|
|
|
|
|
onClick={handleDelete}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
>Delete</APIButton>;
|
|
|
|
|
|
|
|
|
|
const refreshButton = domain?.directory ? (
|
|
|
|
|
<APIButton
|
|
|
|
|
color='blue'
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={handleRefreshDomain}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
>Refresh</APIButton>
|
|
|
|
|
) : null;
|
|
|
|
|
|
|
|
|
|
const tagButton = <Button
|
|
|
|
|
type="button"
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={() => setTagEditModalOpen(true)}
|
Add ordered collections (playlists): polymorphic items + item API (#475)
* Add Playlists: ordered, mixed-type collections
A playlist (Collection kind='playlist') is a manually-curated, ordered list that
mixes item types. Squash of the playlists feature branch (24 commits).
Data model & API:
- CollectionItem is polymorphic via item_kind: 'file' (FileGroup), 'zim'
(zim_id + zim_entry), or 'url' (link to anything the WROLPi browser opens,
e.g. /map?lat=&lon=&z=). CHECK constraint enforces exactly one kind; per-kind
unique constraints; migration a7b1c2d3e4f5.
- Endpoints: create playlist; add/remove/reorder items (idempotent adds: 201 new,
200 existing); GET returns the ordered items. All mutations wrol_mode_check'd.
Config (source of truth):
- playlists.yaml (PlaylistsConfig) stores each playlist's metadata AND ordered
items (file by relative path, zim by path+entry, url inline); round-trips a
DB wipe. Supports backup import (DB_CONFIG_FILE_NAMES).
- The redundant generic CollectionsConfig (collections.yaml) is deleted:
channels/domains own their configs, authors/subjects are re-derived.
On-disk sync (sync_playlists_directory switch):
- Each playlist materializes into the configurable Playlists Directory
(playlists_destination, Settings UI input, excluded from indexing) with
position-prefixed entries: NNNN_<file> hard links (copy fallback across
filesystems) and NNNN_<title>.html stubs for zim/url items.
- Tagged playlists are namespaced like channels: <playlists>/<tag>/<name>;
a tag change moves the directory and prunes the empty old tag dir.
- Deletion safety: managed files are only removed when they are our marked
stubs or still have another hard link (st_nlink > 1) -- never a last copy.
Stray loose files at the playlists root are removed; stub URLs are
scheme-allowlisted (no javascript:/data:).
Frontend:
- /playlists list page (CollectionTable, name filter, New Playlist modal, Tag
column) between Files and Zim in the nav.
- View-only detail page (Name link) and edit page (Edit button): themed table
with model icons/colors + poster thumbnails, items link to their model page
(video/archive/doc) or preview, up/down reorder, remove, add-URL form,
single-tag selector; all editing disabled in WROL Mode.
- Reusable green "Add to Playlist" button on Video/Archive/Doc detail pages,
the FilePreview toolbar, Zim search results, and Map pins (added as a /map
URL item with a map-marker icon).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Playlist edit page parity: rename, custom directory, tag modal move suggestion
Match the ChannelEditPage/DomainEditPage UX on the playlist edit page:
Back/View buttons, an edit form (name, description, directory), and the
shared CollectionTagModal with the violet "Tag" button. The tag modal now
suggests moving the playlist to its managed tag location
(playlists/<tag>/<name>); accepting the suggestion stores directory=None so
the sync keeps auto-managing the location. Tag buttons on the Channel and
Domain edit pages are now violet to match.
Backend: update_collection learns rename (with per-kind validation and
duplicate checks) and playlist custom directories (cleanup of the abandoned
directory, config round-trip, commit-before-switch to avoid the background
sync racing pre-commit state). tag_collection's duplicated untag/tag
branches are merged, and the per-kind config-save dispatch is consolidated
into _activate_config_save().
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Deduplicate Collection error handling and Tag creation
Delete the duplicate UnknownCollection in wrolpi/collections/errors.py and
re-export the canonical one from wrolpi/errors.py, which carries
status_code=NOT_FOUND (the local copy inherited 500). Replace the repeated
query/raise pattern in reorganize.py with Collection.find_by_id.
Add Tag.get_or_create_tag and use it for collection tagging; flush the new
Tag before returning so callers can read .id immediately -- previously
tagging a collection with a brand-new tag name set tag_id=None. Regression
test included.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-09 19:37:34 -06:00
|
|
|
color='violet'
|
2025-10-29 22:16:33 -06:00
|
|
|
>Tag</Button>;
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
const reorganizeButton = (
|
|
|
|
|
<APIButton
|
|
|
|
|
color='orange'
|
|
|
|
|
size='small'
|
|
|
|
|
onClick={() => setReorganizeModalOpen(true)}
|
|
|
|
|
obeyWROLMode={true}
|
|
|
|
|
>Reorganize Files</APIButton>
|
|
|
|
|
);
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
const actionButtons = <>
|
|
|
|
|
{deleteButton}
|
|
|
|
|
{refreshButton}
|
|
|
|
|
{tagButton}
|
2026-01-23 19:51:02 -07:00
|
|
|
{reorganizeButton}
|
2025-10-29 22:16:33 -06:00
|
|
|
</>;
|
2023-01-31 18:08:07 -07:00
|
|
|
|
2025-12-05 18:26:36 -07:00
|
|
|
const [descriptionProps] = form.getCustomProps({name: 'description', path: 'description'});
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
return <>
|
ui: a Back button is a row of one, not a stretched flex child
Reported: the Back button fills the page width on the domain and channel edit
pages. It fills it on all nine pages that have one, and this is mine from the
last PR.
`.wrolpi-stack` is a flex column at `align-items: stretch`, deliberately -- a
panel was full-width as a block element and has to stay that way. A BARE button
as a direct child of that stack is stretched too, and every page's Back button
was one. On the domain, channel and playlist edit pages it also pushed the
button beside it onto its own line, where the two had been inline.
Wrapping each in a `.wrolpi-button-row` fixes both without touching the stack:
the row is the stretched child, and it lays its buttons out at their own width.
The three pages that have a second button get one row holding both, which is how
they read before.
Also the Videos, Archives and Documents select bars, whose Tag/Delete/Invert/
Clear were four touching buttons in a bare div. They are inline elements rather
than interpolations, which is the shape the bare-siblings scan does not see.
Guarded twice: the row keeps its buttons their own width inside a stack while
itself stretching (both halves, since a row that refused to stretch would pass a
test that only looked at the button), and every `<BackButton/>` in the app is
inside a row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:47:33 -06:00
|
|
|
<div className='wrolpi-button-row'>
|
|
|
|
|
<BackButton/>
|
|
|
|
|
<Link to={`/archives?domain=${domain?.domain}`}>
|
|
|
|
|
<Button>Archives</Button>
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
2025-12-17 17:27:17 -07:00
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
{domain?.needs_reorganization && (
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Message kind='warning' title='File Format Changed'>
|
2026-01-23 19:51:02 -07:00
|
|
|
<p>
|
|
|
|
|
The file name format has changed. Click "Reorganize Files" to move existing files
|
|
|
|
|
to match the new format.
|
|
|
|
|
</p>
|
|
|
|
|
</Message>
|
|
|
|
|
)}
|
|
|
|
|
|
2025-10-29 22:16:33 -06:00
|
|
|
<CollectionEditForm
|
|
|
|
|
form={form}
|
|
|
|
|
title={`Edit Domain: ${domain?.domain || '...'}`}
|
|
|
|
|
wrolModeContent='Domain editing is disabled while in WROL Mode.'
|
|
|
|
|
actionButtons={actionButtons}
|
|
|
|
|
appliedTagName={domain?.tag_name}
|
2025-12-05 18:26:36 -07:00
|
|
|
>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
{/*
|
|
|
|
|
* CollectionEditForm still wraps its children in a `ui stackable grid` div (Semantic's
|
|
|
|
|
* grid CSS, not a component) because it is shared with unmigrated callers (Channels.js,
|
|
|
|
|
* Playlists.js). Plain "row"/"column" divs are that CSS's own class names, not a
|
|
|
|
|
* semantic-ui-react import.
|
|
|
|
|
*/}
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="column">
|
2025-12-05 18:26:36 -07:00
|
|
|
<DestinationForm
|
|
|
|
|
form={form}
|
|
|
|
|
label='Directory'
|
|
|
|
|
name='directory'
|
|
|
|
|
path='directory'
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div className="row">
|
|
|
|
|
<div className="column">
|
|
|
|
|
<label style={{display: 'block', marginBottom: 4}}>Description</label>
|
|
|
|
|
<Textarea
|
|
|
|
|
placeholder='Optional description'
|
|
|
|
|
value={descriptionProps.value || ''}
|
|
|
|
|
onChange={(e) => descriptionProps.onChange(e.target.value)}
|
|
|
|
|
rows={3}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
2025-12-05 18:26:36 -07:00
|
|
|
</CollectionEditForm>
|
2025-10-29 22:16:33 -06:00
|
|
|
|
|
|
|
|
{/* Tag Modal */}
|
|
|
|
|
<CollectionTagModal
|
|
|
|
|
open={tagEditModalOpen}
|
|
|
|
|
onClose={() => setTagEditModalOpen(false)}
|
|
|
|
|
currentTagName={domain?.tag_name}
|
|
|
|
|
originalDirectory={domain?.directory}
|
|
|
|
|
getTagInfo={handleGetTagInfo}
|
|
|
|
|
onSave={handleTagSave}
|
|
|
|
|
collectionName="Domain"
|
2025-12-06 09:27:40 -07:00
|
|
|
hasDirectory={!!domain?.directory}
|
2023-01-31 18:08:07 -07:00
|
|
|
/>
|
2025-10-29 22:16:33 -06:00
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
{/* Reorganize Modal */}
|
|
|
|
|
<CollectionReorganizeModal
|
|
|
|
|
open={reorganizeModalOpen}
|
|
|
|
|
onClose={() => setReorganizeModalOpen(false)}
|
|
|
|
|
collectionId={domain?.id}
|
|
|
|
|
collectionName={domain?.domain}
|
|
|
|
|
onComplete={fetchDomain}
|
|
|
|
|
needsReorganization={domain?.needs_reorganization}
|
|
|
|
|
/>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
{/* Downloads Panel */}
|
|
|
|
|
<Panel>
|
2025-10-29 22:16:33 -06:00
|
|
|
<Header as='h1'>Downloads</Header>
|
|
|
|
|
<RecurringDownloadsTable
|
|
|
|
|
downloads={domain?.downloads}
|
|
|
|
|
fetchDownloads={fetchDomain}
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
2025-12-17 17:27:17 -07:00
|
|
|
|
|
|
|
|
{domain && domain.statistics && <DomainStatistics statistics={domain.statistics}/>}
|
2022-08-06 05:22:07 +00:00
|
|
|
</>;
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|
|
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
function ArchiveFileNameForm({form}) {
|
|
|
|
|
const [message, setMessage] = React.useState(null);
|
|
|
|
|
|
|
|
|
|
const onChange = async (value) => {
|
|
|
|
|
const response = await postArchiveFileFormat(value);
|
|
|
|
|
const {error, preview} = await response.json();
|
|
|
|
|
if (error) {
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
setMessage({kind: 'error', title: 'Invalid File Name', content: error});
|
2025-12-22 17:56:35 -07:00
|
|
|
} else {
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
setMessage({kind: 'success', title: 'File Name Preview', content: preview});
|
2025-12-22 17:56:35 -07:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
const [inputProps] = form.getInputProps({name: 'file_name_format', path: 'file_name_format', onChange});
|
|
|
|
|
|
|
|
|
|
return <div>
|
|
|
|
|
<InfoHeader
|
|
|
|
|
headerSize='h5'
|
|
|
|
|
headerContent='Archive File Format'
|
|
|
|
|
popupContent={<>
|
|
|
|
|
<p>Variables:</p>
|
|
|
|
|
<ul>
|
|
|
|
|
<li><code>%(title)s</code> - Page title</li>
|
|
|
|
|
<li><code>%(download_datetime)s</code> - Full datetime (YYYY-MM-DD-HH-MM-SS)</li>
|
|
|
|
|
<li><code>%(download_date)s</code> - Date only (YYYY-MM-DD)</li>
|
|
|
|
|
<li><code>%(download_year)s</code> - Year</li>
|
|
|
|
|
<li><code>%(download_month)s</code> - Month (zero-padded)</li>
|
|
|
|
|
<li><code>%(download_day)s</code> - Day (zero-padded)</li>
|
|
|
|
|
<li><code>%(domain)s</code> - Domain name</li>
|
|
|
|
|
<li><code>%(ext)s</code> - File extension (required, must be at end)</li>
|
|
|
|
|
</ul>
|
|
|
|
|
<p>Subdirectories supported: <code>%(download_year)s/%(title)s.%(ext)s</code></p>
|
|
|
|
|
</>}
|
|
|
|
|
/>
|
|
|
|
|
<TextInput
|
|
|
|
|
id='file_name_format_input'
|
|
|
|
|
name='file_name_format'
|
|
|
|
|
value={inputProps.value ?? ''}
|
|
|
|
|
onChange={inputProps.onChange}
|
|
|
|
|
data-path={inputProps['data-path']}
|
|
|
|
|
/>
|
|
|
|
|
{message && <Message kind={message.kind} title={message.title}>{message.content}</Message>}
|
|
|
|
|
</div>
|
2025-12-22 17:56:35 -07:00
|
|
|
}
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
function BrowserConfigForm({form, browsers, browsersAvailable}) {
|
|
|
|
|
const [useCustomPath, setUseCustomPath] = useState(false);
|
|
|
|
|
|
|
|
|
|
// Determine if custom path is being used based on current value
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
const currentBrowser = form.formData?.browser_executable;
|
|
|
|
|
if (currentBrowser) {
|
|
|
|
|
// Check if current value matches any known browser
|
|
|
|
|
const isKnownBrowser = browsers.some(b => b.path === currentBrowser || b.key === currentBrowser);
|
|
|
|
|
setUseCustomPath(!isKnownBrowser);
|
|
|
|
|
}
|
|
|
|
|
}, [form.formData?.browser_executable, browsers]);
|
|
|
|
|
|
|
|
|
|
if (!browsersAvailable) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Build dropdown options: auto-detect + installed browsers + custom
|
|
|
|
|
const browserOptions = [
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
{value: '', label: 'Auto-detect (recommended)'},
|
|
|
|
|
...browsers.map(b => ({value: b.path, label: `${b.name} (${b.path})`})),
|
|
|
|
|
{value: '__custom__', label: 'Custom path...'},
|
2026-01-23 19:51:02 -07:00
|
|
|
];
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
const handleBrowserChange = (value) => {
|
2026-01-23 19:51:02 -07:00
|
|
|
if (value === '__custom__') {
|
|
|
|
|
setUseCustomPath(true);
|
|
|
|
|
form.setValue('browser_executable', '');
|
|
|
|
|
} else {
|
|
|
|
|
setUseCustomPath(false);
|
|
|
|
|
form.setValue('browser_executable', value || null);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const currentValue = form.formData?.browser_executable || '';
|
|
|
|
|
const dropdownValue = useCustomPath ? '__custom__' : currentValue;
|
|
|
|
|
|
|
|
|
|
return <>
|
|
|
|
|
<Header as='h4'>Browser Settings</Header>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<p>
|
2026-01-23 19:51:02 -07:00
|
|
|
Configure which browser SingleFile uses to create archives.
|
|
|
|
|
These settings only apply to native deployments (Raspberry Pi/Debian).
|
|
|
|
|
</p>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{marginBottom: '1em'}}>
|
|
|
|
|
<label style={{display: 'block', marginBottom: 4}}>Browser</label>
|
|
|
|
|
<Select
|
|
|
|
|
data={browserOptions}
|
2026-01-23 19:51:02 -07:00
|
|
|
value={dropdownValue}
|
|
|
|
|
onChange={handleBrowserChange}
|
|
|
|
|
placeholder='Select browser...'
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</div>
|
2026-01-23 19:51:02 -07:00
|
|
|
|
|
|
|
|
{useCustomPath && (
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{marginBottom: '1em'}}>
|
|
|
|
|
<label style={{display: 'block', marginBottom: 4}}>Custom Browser Path</label>
|
|
|
|
|
<TextInput
|
2026-01-23 19:51:02 -07:00
|
|
|
placeholder='/usr/bin/chromium'
|
|
|
|
|
value={form.formData?.browser_executable || ''}
|
|
|
|
|
onChange={(e) => form.setValue('browser_executable', e.target.value)}
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<small style={{color: 'var(--muted)'}}>Enter the absolute path to the browser executable.</small>
|
|
|
|
|
</div>
|
2026-01-23 19:51:02 -07:00
|
|
|
)}
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{marginBottom: '1em'}}>
|
|
|
|
|
<label style={{display: 'block', marginBottom: 4}}>Browser Arguments</label>
|
|
|
|
|
<TextInput
|
2026-01-23 19:51:02 -07:00
|
|
|
placeholder='["--no-sandbox"]'
|
|
|
|
|
value={form.formData?.browser_args || '["--no-sandbox"]'}
|
|
|
|
|
onChange={(e) => form.setValue('browser_args', e.target.value)}
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<small style={{color: 'var(--muted)'}}>JSON array of arguments passed to the browser. Default:
|
|
|
|
|
["--no-sandbox"]</small>
|
|
|
|
|
</div>
|
2026-01-23 19:51:02 -07:00
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div>
|
|
|
|
|
<label style={{display: 'block', marginBottom: 4}}>User Agent</label>
|
|
|
|
|
<TextInput
|
2026-01-23 19:51:02 -07:00
|
|
|
placeholder='Leave empty to use system default'
|
|
|
|
|
value={form.formData?.user_agent || ''}
|
|
|
|
|
onChange={(e) => form.setValue('user_agent', e.target.value || null)}
|
|
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<small style={{color: 'var(--muted)'}}>Custom user agent string. Leave empty to use the system
|
|
|
|
|
default.</small>
|
|
|
|
|
</div>
|
2026-01-23 19:51:02 -07:00
|
|
|
</>;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
function ArchiveSettingsPage() {
|
2025-12-22 17:56:35 -07:00
|
|
|
useTitle('Archive Settings');
|
|
|
|
|
|
2026-01-23 19:51:02 -07:00
|
|
|
const dockerized = useDockerized();
|
|
|
|
|
const [batchModalOpen, setBatchModalOpen] = useState(false);
|
|
|
|
|
const [domainsNeedingReorg, setDomainsNeedingReorg] = useState(0);
|
|
|
|
|
const [fetchingReorgCount, setFetchingReorgCount] = useState(true);
|
|
|
|
|
const [browsers, setBrowsers] = useState([]);
|
|
|
|
|
const [browsersAvailable, setBrowsersAvailable] = useState(false);
|
|
|
|
|
|
2026-01-31 12:54:27 -07:00
|
|
|
// Check if batch reorganization is currently active for domains
|
|
|
|
|
const {isReorganizing, taskType, collectionKind} = useReorganizationStatus();
|
|
|
|
|
const isBatchReorganizingDomains = isReorganizing && taskType === 'batch_reorganize' && collectionKind === 'domain';
|
|
|
|
|
|
|
|
|
|
// Check how many domains need reorganization on mount (skip if batch is in progress)
|
2026-01-23 19:51:02 -07:00
|
|
|
React.useEffect(() => {
|
2026-01-31 12:54:27 -07:00
|
|
|
if (isBatchReorganizingDomains) {
|
|
|
|
|
// Skip fetching preview while batch reorganization is in progress
|
|
|
|
|
setFetchingReorgCount(false);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2026-01-23 19:51:02 -07:00
|
|
|
setFetchingReorgCount(true);
|
|
|
|
|
previewBatchReorganization('domain')
|
|
|
|
|
.then(data => {
|
|
|
|
|
setDomainsNeedingReorg(data.total_collections || 0);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
setDomainsNeedingReorg(0);
|
|
|
|
|
})
|
|
|
|
|
.finally(() => {
|
|
|
|
|
setFetchingReorgCount(false);
|
|
|
|
|
});
|
2026-01-31 12:54:27 -07:00
|
|
|
}, [isBatchReorganizingDomains]);
|
2026-01-23 19:51:02 -07:00
|
|
|
|
|
|
|
|
// Fetch available browsers on mount (only if not dockerized)
|
|
|
|
|
React.useEffect(() => {
|
|
|
|
|
if (dockerized === false) {
|
|
|
|
|
fetchArchiveBrowsers()
|
|
|
|
|
.then(data => {
|
|
|
|
|
setBrowsers(data.browsers || []);
|
|
|
|
|
setBrowsersAvailable(data.available === true);
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
setBrowsers([]);
|
|
|
|
|
setBrowsersAvailable(false);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
}, [dockerized]);
|
2023-04-09 14:13:36 -06:00
|
|
|
|
2025-12-22 17:56:35 -07:00
|
|
|
const emptyFormData = {
|
2025-12-23 19:11:07 -07:00
|
|
|
file_name_format: '%(download_datetime)s_%(title)s.%(ext)s',
|
2026-01-23 19:51:02 -07:00
|
|
|
browser_executable: null,
|
|
|
|
|
browser_args: '["--no-sandbox"]',
|
|
|
|
|
user_agent: null,
|
2025-12-22 17:56:35 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const configSubmitter = async () => {
|
|
|
|
|
return await updateArchiveDownloaderConfig(configForm.formData);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
const configForm = useForm({
|
|
|
|
|
fetcher: fetchArchiveDownloaderConfig,
|
|
|
|
|
submitter: configSubmitter,
|
|
|
|
|
emptyFormData,
|
|
|
|
|
});
|
|
|
|
|
|
2025-01-26 12:44:16 -07:00
|
|
|
const urlClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText(API_ARCHIVE_UPLOAD_URI)}
|
|
|
|
|
/>;
|
|
|
|
|
const dataFieldNameClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText('singlefile_contents')}
|
|
|
|
|
/>;
|
|
|
|
|
const urlFieldNameClipboardButton = <APIButton
|
|
|
|
|
icon='copy'
|
|
|
|
|
onClick={() => navigator.clipboard.writeText('url')}
|
|
|
|
|
/>;
|
2023-09-07 20:13:36 -06:00
|
|
|
|
ui: stop /archives/settings wrapping itself in a second PageContainer
`ArchiveRoute` wraps its `<Routes>` in a PageContainer, and
`ArchiveSettingsPage` wrapped itself in another. PageContainer carries
`margin-top: 1em` and `padding: 1em`, so that page sat 1em lower and 1em
further in on all four sides than /archives/domains beside it -- which is
exactly what "seems to have more margin" was. It is a fragment now, so its
panels are blocks of the route's own stack.
Guarded by a source scan rather than a render, since a doubled margin throws
nothing: it takes each PageContainer that wraps a router, reads the
components it routes to, and fails if one of them renders a PageContainer of
its own.
The first version of that scan passed against the live bug. It looked at
only the first `<PageContainer>` in a file, and in Archive.js that is the
offender itself, whose block holds no `<Routes>` -- so the file was skipped
before the route wrapper 400 lines below was reached. It reads every
occurrence now, and the premise assertions count both the wrappers found and
the routes within them.
Two more top-level blocks gave up margins that were being added to the
page's gap, both headers "matching" each other's pattern: the domain filter
row (35.2px against 17.6px) and the channel filter row.
/archives/settings and /archives/domains now measure identically -- tab bar
bottom at 136.8px, first block 17.6px below it, content inset 17.6px -- as
do the statistics and settings pages of every other tab group.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 15:53:04 -06:00
|
|
|
/*
|
|
|
|
|
* A fragment, not a `PageContainer`. `ArchiveRoute` already wraps its `<Routes>` in one, and
|
|
|
|
|
* a second applies its `margin-top: 1em` and `padding: 1em` again -- so this page sat 1em
|
|
|
|
|
* lower and 1em further in on all four sides than /archives/domains beside it. As a fragment
|
|
|
|
|
* these panels become blocks of the route's own page stack, which spaces them.
|
|
|
|
|
*/
|
|
|
|
|
return <>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Panel>
|
2025-12-22 17:56:35 -07:00
|
|
|
<Header as='h3'>Archive Downloader Config</Header>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<div style={{opacity: configForm.loading ? 0.6 : 1, pointerEvents: configForm.loading ? 'none' : 'auto'}}>
|
|
|
|
|
<div style={{maxWidth: 500, marginBottom: '1em'}}>
|
|
|
|
|
<ArchiveFileNameForm form={configForm}/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{/* Browser settings - only shown on native deployments */}
|
|
|
|
|
{!dockerized && browsersAvailable && (
|
|
|
|
|
<div style={{maxWidth: 500, marginBottom: '1em'}}>
|
|
|
|
|
<BrowserConfigForm
|
|
|
|
|
form={configForm}
|
|
|
|
|
browsers={browsers}
|
|
|
|
|
browsersAvailable={browsersAvailable}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<div style={{textAlign: 'right'}}>
|
|
|
|
|
<APIButton
|
|
|
|
|
disabled={configForm.disabled || !configForm.ready}
|
|
|
|
|
type='submit'
|
|
|
|
|
style={{marginTop: '0.5em'}}
|
|
|
|
|
onClick={configForm.onSubmit}
|
|
|
|
|
id='archive_settings_save_button'
|
|
|
|
|
>Save</APIButton>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</Panel>
|
|
|
|
|
|
|
|
|
|
<Panel>
|
2026-01-23 19:51:02 -07:00
|
|
|
<Header as='h4'>File Organization</Header>
|
|
|
|
|
<p>
|
|
|
|
|
{fetchingReorgCount
|
|
|
|
|
? 'Checking for domains that need reorganization...'
|
|
|
|
|
: <>
|
|
|
|
|
<strong>{domainsNeedingReorg}</strong> domain{domainsNeedingReorg !== 1 ? 's' : ''}
|
|
|
|
|
{domainsNeedingReorg > 0
|
|
|
|
|
? ' have files that do not match the current file name format.'
|
|
|
|
|
: '. All domains are organized correctly.'}
|
|
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
</p>
|
|
|
|
|
<Button
|
|
|
|
|
color='orange'
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
icon='folder open outline'
|
2026-01-23 19:51:02 -07:00
|
|
|
onClick={() => setBatchModalOpen(true)}
|
|
|
|
|
id='reorganize_all_domains_button'
|
|
|
|
|
disabled={fetchingReorgCount || domainsNeedingReorg === 0}
|
|
|
|
|
loading={fetchingReorgCount}
|
|
|
|
|
>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
Reorganize All Domains
|
2026-01-23 19:51:02 -07:00
|
|
|
</Button>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
2026-01-23 19:51:02 -07:00
|
|
|
|
|
|
|
|
<BatchReorganizeModal
|
|
|
|
|
open={batchModalOpen}
|
|
|
|
|
onClose={() => setBatchModalOpen(false)}
|
|
|
|
|
kind='domain'
|
|
|
|
|
onComplete={() => {
|
|
|
|
|
setBatchModalOpen(false);
|
|
|
|
|
setDomainsNeedingReorg(0);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Panel>
|
2025-12-22 17:56:35 -07:00
|
|
|
<Header as='h3'>SingleFile Browser Extension</Header>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<p>
|
2025-12-22 17:56:35 -07:00
|
|
|
These are the settings necessary to configure the <a
|
2026-02-15 17:26:36 -07:00
|
|
|
href="https://github.com/gildas-lormeau/SingleFile?tab=readme-ov-file#install"
|
|
|
|
|
rel='noopener noreferrer'
|
|
|
|
|
target='_blank'>SingleFile Browser
|
2025-12-22 17:56:35 -07:00
|
|
|
Extension</a> to automatically upload to your WROLPi.
|
|
|
|
|
</p>
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<label style={{display: 'block', marginBottom: 4}}>Upload URL</label>
|
|
|
|
|
<ActionInput readOnly
|
2025-12-22 17:56:35 -07:00
|
|
|
value={API_ARCHIVE_UPLOAD_URI}
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
action={urlClipboardButton}
|
2025-12-22 17:56:35 -07:00
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<label style={{display: 'block', marginBottom: 4, marginTop: '1em'}}>Data Field Name</label>
|
|
|
|
|
<ActionInput readOnly
|
2025-12-22 17:56:35 -07:00
|
|
|
value='singlefile_contents'
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
action={dataFieldNameClipboardButton}
|
2025-12-22 17:56:35 -07:00
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<label style={{display: 'block', marginBottom: 4, marginTop: '1em'}}>URL Field Name</label>
|
|
|
|
|
<ActionInput readOnly
|
2025-12-22 17:56:35 -07:00
|
|
|
value='url'
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
action={urlFieldNameClipboardButton}
|
2025-12-22 17:56:35 -07:00
|
|
|
/>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Panel>
|
ui: stop /archives/settings wrapping itself in a second PageContainer
`ArchiveRoute` wraps its `<Routes>` in a PageContainer, and
`ArchiveSettingsPage` wrapped itself in another. PageContainer carries
`margin-top: 1em` and `padding: 1em`, so that page sat 1em lower and 1em
further in on all four sides than /archives/domains beside it -- which is
exactly what "seems to have more margin" was. It is a fragment now, so its
panels are blocks of the route's own stack.
Guarded by a source scan rather than a render, since a doubled margin throws
nothing: it takes each PageContainer that wraps a router, reads the
components it routes to, and fails if one of them renders a PageContainer of
its own.
The first version of that scan passed against the live bug. It looked at
only the first `<PageContainer>` in a file, and in Archive.js that is the
offender itself, whose block holds no `<Routes>` -- so the file was skipped
before the route wrapper 400 lines below was reached. It reads every
occurrence now, and the premise assertions count both the wrappers found and
the routes within them.
Two more top-level blocks gave up margins that were being added to the
page's gap, both headers "matching" each other's pattern: the domain filter
row (35.2px against 17.6px) and the channel filter row.
/archives/settings and /archives/domains now measure identically -- tab bar
bottom at 136.8px, first block 17.6px below it, content inset 17.6px -- as
do the statistics and settings pages of every other tab group.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 15:53:04 -06:00
|
|
|
</>
|
2023-04-09 14:13:36 -06:00
|
|
|
}
|
|
|
|
|
|
2023-07-21 15:14:09 -06:00
|
|
|
function ArchivesPage() {
|
2022-09-23 16:22:57 -06:00
|
|
|
const [selectedArchives, setSelectedArchives] = useState([]);
|
2026-04-09 16:18:26 -06:00
|
|
|
const [bulkTagOpen, setBulkTagOpen] = useState(false);
|
2026-05-03 17:28:06 -06:00
|
|
|
const [taggedFileGroups, setTaggedFileGroups] = useState(null);
|
2026-02-23 17:29:09 -07:00
|
|
|
const searchInputRef = React.useRef();
|
|
|
|
|
|
|
|
|
|
useHotkeys('f', (e) => {
|
|
|
|
|
e.preventDefault();
|
|
|
|
|
if (searchInputRef.current) {
|
|
|
|
|
searchInputRef.current.focus();
|
|
|
|
|
}
|
|
|
|
|
}, {enableOnFormTags: false});
|
2022-09-23 16:22:57 -06:00
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
const {domain, domains} = useSearchDomain();
|
|
|
|
|
|
|
|
|
|
// Find the domain object from the domains list to get the ID for the edit link
|
|
|
|
|
const domainObj = domain && domains ? domains.find(d => d.domain === domain) : null;
|
|
|
|
|
|
|
|
|
|
let title = 'Archives';
|
|
|
|
|
if (domainObj && domainObj.domain) {
|
|
|
|
|
title = `${domainObj.domain} Archives`;
|
|
|
|
|
}
|
|
|
|
|
useTitle(title);
|
2022-01-15 18:05:51 -07:00
|
|
|
|
2022-09-23 16:22:57 -06:00
|
|
|
const {
|
|
|
|
|
archives,
|
|
|
|
|
totalPages,
|
|
|
|
|
activePage,
|
|
|
|
|
setPage,
|
|
|
|
|
searchStr,
|
|
|
|
|
setSearchStr,
|
2022-10-24 15:08:53 -06:00
|
|
|
fetchArchives,
|
2023-04-09 14:13:36 -06:00
|
|
|
} = useSearchArchives();
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2022-10-24 15:17:48 -06:00
|
|
|
let archiveOrders = [
|
2023-10-24 10:20:06 -06:00
|
|
|
{value: 'published_datetime', text: 'Published Date', short: 'P.Date'},
|
|
|
|
|
{value: 'published_modified_datetime', text: 'Modified Date', short: 'M.Date'},
|
|
|
|
|
{value: 'download_datetime', text: 'Download Date', short: 'D.Date'},
|
2023-04-09 14:13:36 -06:00
|
|
|
{value: 'size', text: 'Size'},
|
2023-10-24 10:20:06 -06:00
|
|
|
{value: 'viewed', text: 'Recently Viewed', short: 'R.Viewed'},
|
2022-08-06 05:22:07 +00:00
|
|
|
];
|
|
|
|
|
|
2022-10-24 15:17:48 -06:00
|
|
|
if (searchStr) {
|
2023-04-09 14:13:36 -06:00
|
|
|
archiveOrders = [{value: 'rank', text: 'Rank'}, ...archiveOrders];
|
2022-10-24 15:17:48 -06:00
|
|
|
}
|
|
|
|
|
|
2022-09-23 16:22:57 -06:00
|
|
|
const onSelect = (path, checked) => {
|
2022-10-24 17:15:15 -06:00
|
|
|
if (checked && path) {
|
|
|
|
|
setSelectedArchives([...selectedArchives, path]);
|
|
|
|
|
} else if (path) {
|
|
|
|
|
setSelectedArchives(selectedArchives.filter(i => i !== path));
|
2022-09-23 16:22:57 -06:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-05-03 18:50:22 -06:00
|
|
|
const fileGroupIdsForSelection = () => archives
|
2026-05-03 17:28:06 -06:00
|
|
|
.filter(i => selectedArchives.indexOf(i['primary_path']) >= 0)
|
|
|
|
|
.map(i => i['id']);
|
|
|
|
|
|
|
|
|
|
const onDelete = async (force = false) => {
|
2026-05-03 18:50:22 -06:00
|
|
|
const fileGroupIds = fileGroupIdsForSelection();
|
|
|
|
|
const result = await deleteFileGroups(fileGroupIds, force);
|
2026-05-03 17:28:06 -06:00
|
|
|
if (result && result.tagged) {
|
|
|
|
|
setTaggedFileGroups(result.file_groups);
|
|
|
|
|
return;
|
|
|
|
|
}
|
2022-09-23 16:22:57 -06:00
|
|
|
await fetchArchives();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
2022-10-24 17:15:15 -06:00
|
|
|
const invertSelection = async () => {
|
|
|
|
|
const newSelectedArchives = archives.map(archive => archive['key']).filter(i => selectedArchives.indexOf(i) < 0);
|
|
|
|
|
setSelectedArchives(newSelectedArchives);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const clearSelection = async (e) => {
|
|
|
|
|
if (e) e.preventDefault();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-09 16:18:26 -06:00
|
|
|
const onBulkTagComplete = async () => {
|
|
|
|
|
await fetchArchives();
|
|
|
|
|
setSelectedArchives([]);
|
|
|
|
|
}
|
|
|
|
|
|
ui: a Back button is a row of one, not a stretched flex child
Reported: the Back button fills the page width on the domain and channel edit
pages. It fills it on all nine pages that have one, and this is mine from the
last PR.
`.wrolpi-stack` is a flex column at `align-items: stretch`, deliberately -- a
panel was full-width as a block element and has to stay that way. A BARE button
as a direct child of that stack is stretched too, and every page's Back button
was one. On the domain, channel and playlist edit pages it also pushed the
button beside it onto its own line, where the two had been inline.
Wrapping each in a `.wrolpi-button-row` fixes both without touching the stack:
the row is the stretched child, and it lays its buttons out at their own width.
The three pages that have a second button get one row holding both, which is how
they read before.
Also the Videos, Archives and Documents select bars, whose Tag/Delete/Invert/
Clear were four touching buttons in a bare div. They are inline elements rather
than interpolations, which is the shape the bare-siblings scan does not see.
Guarded twice: the row keeps its buttons their own width inside a stack while
itself stretching (both halves, since a row that refused to stretch would pass a
test that only looked at the button), and every `<BackButton/>` in the app is
inside a row.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-05 16:47:33 -06:00
|
|
|
const selectElm = <div className='wrolpi-button-row' style={{marginTop: '0.5em'}}>
|
2026-04-09 16:18:26 -06:00
|
|
|
<Button
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='primary'
|
2026-04-09 16:18:26 -06:00
|
|
|
disabled={_.isEmpty(selectedArchives)}
|
|
|
|
|
onClick={() => setBulkTagOpen(true)}
|
|
|
|
|
>Tag</Button>
|
2023-07-27 15:53:47 -06:00
|
|
|
<APIButton
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='danger'
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(selectedArchives)}
|
2022-09-23 16:22:57 -06:00
|
|
|
confirmButton='Delete'
|
2023-07-27 15:53:47 -06:00
|
|
|
confirmContent='Are you sure you want to delete these archives files? This cannot be undone.'
|
2026-05-03 17:28:06 -06:00
|
|
|
onClick={() => onDelete(false)}
|
2023-07-27 15:53:47 -06:00
|
|
|
>Delete</APIButton>
|
2022-10-24 17:15:15 -06:00
|
|
|
<Button
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='cancel'
|
2023-01-04 11:16:40 -07:00
|
|
|
onClick={invertSelection}
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(archives)}
|
2022-10-24 17:15:15 -06:00
|
|
|
>
|
|
|
|
|
Invert
|
|
|
|
|
</Button>
|
|
|
|
|
<Button
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
role='cancel'
|
2023-01-04 11:16:40 -07:00
|
|
|
onClick={clearSelection}
|
2023-01-04 09:14:33 -07:00
|
|
|
disabled={_.isEmpty(archives) || _.isEmpty(selectedArchives)}
|
2022-10-24 17:15:15 -06:00
|
|
|
>
|
|
|
|
|
Clear
|
|
|
|
|
</Button>
|
2026-04-09 16:18:26 -06:00
|
|
|
<BulkTagModal
|
|
|
|
|
open={bulkTagOpen}
|
|
|
|
|
onClose={() => setBulkTagOpen(false)}
|
|
|
|
|
paths={selectedArchives}
|
|
|
|
|
onComplete={onBulkTagComplete}
|
|
|
|
|
/>
|
2022-09-23 16:22:57 -06:00
|
|
|
</div>;
|
|
|
|
|
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
const {body, paginator, viewButton} = FilesView(
|
2024-07-22 16:36:57 -06:00
|
|
|
{
|
|
|
|
|
files: archives,
|
|
|
|
|
activePage: activePage,
|
|
|
|
|
totalPages: totalPages,
|
|
|
|
|
selectElem: selectElm,
|
|
|
|
|
selectedKeys: selectedArchives,
|
|
|
|
|
onSelect: onSelect,
|
|
|
|
|
setPage: setPage,
|
|
|
|
|
headlines: !!searchStr
|
|
|
|
|
},
|
2023-04-09 14:13:36 -06:00
|
|
|
);
|
|
|
|
|
|
2024-02-19 15:08:04 -07:00
|
|
|
|
2025-12-17 17:27:17 -07:00
|
|
|
// Domain header with edit link when filtering by domain
|
|
|
|
|
let header;
|
|
|
|
|
if (domainObj && domainObj.domain) {
|
2026-03-20 15:38:32 -06:00
|
|
|
const editLink = `/archives/domain/${domainObj.id}/edit`;
|
2025-12-17 17:27:17 -07:00
|
|
|
header = <>
|
|
|
|
|
<Header as='h1'>
|
|
|
|
|
{domainObj.domain}
|
|
|
|
|
<Link to={editLink}>
|
|
|
|
|
<Icon name='edit' style={{marginLeft: '0.5em'}}/>
|
|
|
|
|
</Link>
|
|
|
|
|
</Header>
|
|
|
|
|
</>;
|
|
|
|
|
} else if (domain) {
|
|
|
|
|
// Domain filter is set but domain object not loaded yet
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
header = <div style={{marginBottom: '1em'}}>
|
|
|
|
|
<Placeholder lines={1}/>
|
|
|
|
|
</div>;
|
2025-12-17 17:27:17 -07:00
|
|
|
}
|
|
|
|
|
|
2023-04-09 14:13:36 -06:00
|
|
|
return <>
|
2025-12-17 17:27:17 -07:00
|
|
|
{header}
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
<SearchControlBar
|
|
|
|
|
searchStr={searchStr}
|
|
|
|
|
setSearchStr={setSearchStr}
|
|
|
|
|
placeholder='Search Archives...'
|
|
|
|
|
inputRef={searchInputRef}
|
|
|
|
|
viewButton={viewButton}
|
|
|
|
|
sorts={archiveOrders}
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
showDeep={true}
|
Consolidate search options into a single Filter modal (#497)
* Consolidate search options into a single Filter modal
Reworks the file-search UI on the Dashboard, Videos, Archives, and Docs
pages. The crowded row of controls (sort, tags, limit, file-type filter,
date selector) is replaced with a single "Filter" button that opens one
comprehensive modal.
- Add SearchFilterModal + SearchFilterButton (violet + count badge when
active). Sections (Sort, File Type, Tags, Results Per Page, Published
Date) are shown per-page via props; layout uses a Semantic Grid.
- Selections are drafted locally and applied in a single updateQuery only
on close/Done, so the search isn't re-run on every field change.
- Results Per Page and Sort use buttons (fewer clicks, no clipped dropdown).
- Extract shared SearchControlBar (view toggle + input + Filter) for the
three results pages; move the global-search view toggle onto the tab row.
- Rework the Dashboard search line into one adaptive flex row; clear button
only shows when there's an active search.
- Remove now-dead FilesView limit/tag returns and SearchLimitDropdown.
* Address review: reset limit on Clear All; use replace over replaceAll
- handleClearAll now resets Results Per Page to the default page size
(DEFAULT_SEARCH_LIMIT = 24) so "Clear All" actually clears every setting.
- Replace start-anchored replaceAll(/^-/g) with replace(/^-/) for the sort key.
- Add a test covering the Clear All limit reset.
* Remove now-unused Media import from Files.js
The FilesSearchView refactor dropped the last <Media> usage in this file,
leaving an unused import (a build warning). Remove it.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 19:49:15 -06:00
|
|
|
/>
|
2023-04-09 14:13:36 -06:00
|
|
|
{body}
|
Search: fast ABC mode by default, opt-in deep search
The file_group.textsearch tsvector indexes all four text columns;
d_text (captions, document text, zip contents) is ~90% of the data,
making ts_rank searches take seconds on large libraries. Add a
textsearch_abc generated column (title/author/description only, ~8x
smaller) and default all searches to it, with deep=true opting into the
full column.
Database:
- Migration adds the generated column and a GIN index (rewrites the
table; a few minutes on large libraries).
Backend:
- FilesSearchRequest, VideoSearchRequest, ArchiveSearchRequest, and
DocSearchRequest accept `deep`; each search function picks the column.
- /api/search_file_estimates returns both counts in one index-bound
query (COUNT FILTER on the abc subset): `file_groups` (fast) and
`file_groups_deep`.
UI (one coherent story across the count surfaces):
- The typing dropdown always suggests the deep count (what is findable).
- The tab badge shows the active mode's count so it matches the result
list.
- The gap is reconciled by a hint offering deep search: count-aware on
the global search ("No results in fast search. N results available in
deep search." / "N more results available..."), generic on the module
pages (no deep estimate there). The hint resets pagination.
- "Search Depth" toggle in the search filter modals, persisted as
?deep=true.
Tests that relied on d_text matches now pass deep=True, with fast-mode
assertions alongside. Also skip flaky test_download_channel on
CircleCI.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 10:09:08 -06:00
|
|
|
<DeepSearchHint searchStr={searchStr} files={archives}/>
|
2023-04-09 14:13:36 -06:00
|
|
|
{paginator}
|
2026-05-03 17:28:06 -06:00
|
|
|
<TaggedDeleteConfirmModal
|
|
|
|
|
open={taggedFileGroups !== null}
|
|
|
|
|
taggedFileGroups={taggedFileGroups}
|
|
|
|
|
onCancel={() => setTaggedFileGroups(null)}
|
|
|
|
|
onConfirm={async () => {
|
|
|
|
|
setTaggedFileGroups(null);
|
|
|
|
|
await onDelete(true);
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2023-04-09 14:13:36 -06:00
|
|
|
</>
|
2022-08-06 05:22:07 +00:00
|
|
|
}
|
2022-01-03 15:13:02 -07:00
|
|
|
|
2022-11-04 09:58:38 -06:00
|
|
|
export function ArchiveRowCells({file}) {
|
2023-03-24 08:58:18 -06:00
|
|
|
const {data} = file;
|
2023-11-02 16:56:05 -06:00
|
|
|
let {sort} = useSearchOrder();
|
|
|
|
|
sort = sort ? sort.replace(/^-+/, '') : null;
|
2022-11-04 09:58:38 -06:00
|
|
|
|
2026-03-20 15:38:32 -06:00
|
|
|
const archiveUrl = `/archives/${file.id}`;
|
2023-03-29 13:46:39 -06:00
|
|
|
const posterPath = findPosterPath(file);
|
|
|
|
|
const posterUrl = posterPath ? `/media/${encodeMediaPath(posterPath)}` : null;
|
2022-11-04 09:58:38 -06:00
|
|
|
|
|
|
|
|
let poster;
|
|
|
|
|
if (posterUrl) {
|
|
|
|
|
poster = <CardLink to={archiveUrl}>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<img alt='' src={posterUrl} style={{width: '50px', height: 'auto'}}/>
|
2022-11-04 09:58:38 -06:00
|
|
|
</CardLink>;
|
|
|
|
|
} else {
|
|
|
|
|
poster = <FileIcon file={file} size='large'/>;
|
|
|
|
|
}
|
|
|
|
|
|
2024-11-02 15:14:02 -06:00
|
|
|
let dataCell = file.published_datetime ? isoDatetimeToAgoPopup(file.published_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
if (sort === 'published_modified_datetime') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = file.published_modified_datetime ? isoDatetimeToAgoPopup(file.published_modified_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
} else if (sort === 'download_datetime') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = file.download_datetime ? isoDatetimeToAgoPopup(file.download_datetime) : '';
|
2023-11-02 16:56:05 -06:00
|
|
|
} else if (sort === 'size') {
|
|
|
|
|
dataCell = humanFileSize(file.size);
|
|
|
|
|
} else if (sort === 'viewed') {
|
2024-11-02 15:14:02 -06:00
|
|
|
dataCell = isoDatetimeToAgoPopup(file.viewed);
|
2023-11-02 16:56:05 -06:00
|
|
|
}
|
|
|
|
|
|
2022-11-04 09:58:38 -06:00
|
|
|
// Fragment for SelectableRow
|
2023-02-17 16:09:24 -07:00
|
|
|
return <React.Fragment>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Table.Cell>
|
|
|
|
|
<div style={{textAlign: 'center'}}>
|
|
|
|
|
{poster}
|
|
|
|
|
</div>
|
|
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>
|
2022-11-04 09:58:38 -06:00
|
|
|
<CardLink to={archiveUrl}>
|
2023-03-24 08:58:18 -06:00
|
|
|
<FileRowTagIcon file={file}/>
|
|
|
|
|
{textEllipsis(file.title || file.stem)}
|
2022-11-04 09:58:38 -06:00
|
|
|
</CardLink>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</Table.Cell>
|
|
|
|
|
<Table.Cell>{dataCell}</Table.Cell>
|
2023-02-17 16:09:24 -07:00
|
|
|
</React.Fragment>
|
2022-11-04 09:58:38 -06:00
|
|
|
}
|
|
|
|
|
|
2026-02-02 15:15:28 -07:00
|
|
|
function ArchiveStatistics() {
|
|
|
|
|
useTitle('Archive Statistics');
|
|
|
|
|
|
|
|
|
|
const {statistics} = useArchiveStatistics();
|
|
|
|
|
|
|
|
|
|
if (statistics === null) {
|
|
|
|
|
// Request is pending.
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
return <Loading/>
|
2026-02-02 15:15:28 -07:00
|
|
|
} else if (statistics === undefined) {
|
|
|
|
|
return <ErrorMessage>Unable to fetch Archive Statistics</ErrorMessage>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const {archives, historical, domains} = statistics;
|
|
|
|
|
|
|
|
|
|
const archiveNames = [
|
|
|
|
|
{key: 'archives', label: 'Archives'},
|
|
|
|
|
{key: 'sum_size', label: 'Total Size'},
|
|
|
|
|
{key: 'max_size', label: 'Largest Archive'},
|
|
|
|
|
{key: 'week', label: 'Downloads Past Week'},
|
|
|
|
|
{key: 'month', label: 'Downloads Past Month'},
|
|
|
|
|
{key: 'year', label: 'Downloads Past Year'},
|
|
|
|
|
];
|
|
|
|
|
const historicalNames = [
|
|
|
|
|
{key: 'average_count', label: 'Average Monthly Downloads'},
|
|
|
|
|
{key: 'average_size', label: 'Average Monthly Usage'},
|
|
|
|
|
];
|
|
|
|
|
const domainNames = [
|
|
|
|
|
{key: 'domains', label: 'Domains'},
|
|
|
|
|
{key: 'tagged_domains', label: 'Tagged Domains'},
|
|
|
|
|
];
|
|
|
|
|
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
const buildPanel = (title, names, stats) => {
|
|
|
|
|
return <Panel>
|
|
|
|
|
<Header as='h1' style={{textAlign: 'center'}}>{title}</Header>
|
|
|
|
|
<StatisticGroup>
|
2026-02-02 15:15:28 -07:00
|
|
|
{names.map(
|
|
|
|
|
({key, label}) =>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
<Statistic key={key} value={stats[key]} label={label}/>
|
2026-02-02 15:15:28 -07:00
|
|
|
)}
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
</StatisticGroup>
|
|
|
|
|
</Panel>
|
2026-02-02 15:15:28 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return <>
|
ui: migrate Archive.js off Semantic UI React
Replaces every semantic-ui-react and ./Theme import with the token-driven
./ui library: Segment->Panel, Tab/Tab.Pane->Tabs (Tabs.List/Tabs.Tab/
Tabs.Panel), Loader active inline='centered'->Loading, Message/Message.Header
->Message kind/title, Statistic/StatisticValue/StatisticLabel->Statistic
value/label, Card/CardContent/CardHeader/CardMeta/CardDescription->Card
media/title/meta/children, Input label={...}->ActionInput action={...},
Form.Dropdown->Select, Form/Form.Field/TextArea->plain markup + Textarea.
Converts all three Semantic grid spellings (Grid.Row/Grid.Column, bare
GridRow/GridColumn) to flexbox for the two-up rows in ArchivePage and
DomainsPage, and to plain "row"/"column" divs (CollectionEditForm's existing
CSS-class convention, shared with still-unmigrated Channels.js/Playlists.js)
for the fields passed into CollectionEditForm in DomainEditPage.
ArchiveFileNameForm no longer goes through hooks/useForm's InputForm helper,
which still renders Semantic's Form.Input internally (hooks/useForm.js is
off-limits for this migration) -- it now builds its field directly against
form.getInputProps, mirroring the pattern Download.js already established.
Drops ThemeContext's obsolete i/s/t/inverted spreads throughout, and the
mimetype-color accent on Card (the new Card has no color prop; Videos.js's
already-migrated VideoCard dropped the same accent for the same reason).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-30 13:13:06 -06:00
|
|
|
{buildPanel('Archives', archiveNames, archives)}
|
|
|
|
|
{buildPanel('Historical Archives', historicalNames, historical)}
|
|
|
|
|
{buildPanel('Domains', domainNames, domains)}
|
2026-02-02 15:15:28 -07:00
|
|
|
</>
|
|
|
|
|
}
|
|
|
|
|
|
2022-08-06 05:22:07 +00:00
|
|
|
export function ArchiveRoute() {
|
2025-10-29 22:16:33 -06:00
|
|
|
const location = useLocation();
|
|
|
|
|
const path = location.pathname;
|
|
|
|
|
|
2022-01-29 22:25:35 -07:00
|
|
|
const links = [
|
2025-10-29 22:16:33 -06:00
|
|
|
{
|
|
|
|
|
text: 'Archives',
|
2026-03-20 15:38:32 -06:00
|
|
|
to: '/archives',
|
2025-10-29 22:16:33 -06:00
|
|
|
end: true,
|
2026-03-20 15:38:32 -06:00
|
|
|
isActive: () => path === '/archives' || /^\/archives\/\d+$/.test(path)
|
2025-10-29 22:16:33 -06:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
text: 'Domains',
|
2026-03-20 15:38:32 -06:00
|
|
|
to: '/archives/domains',
|
|
|
|
|
isActive: () => path.startsWith('/archives/domain')
|
2025-10-29 22:16:33 -06:00
|
|
|
},
|
2026-03-20 15:38:32 -06:00
|
|
|
{text: 'Settings', to: '/archives/settings'},
|
|
|
|
|
{text: 'Statistics', to: '/archives/statistics'},
|
2022-01-29 21:24:39 -07:00
|
|
|
];
|
2022-01-31 09:32:06 -07:00
|
|
|
return <PageContainer>
|
2022-01-29 22:25:35 -07:00
|
|
|
<TabLinks links={links}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
<Routes>
|
2023-07-21 15:14:09 -06:00
|
|
|
<Route path='/' element={<ArchivesPage/>}/>
|
2023-04-09 14:13:36 -06:00
|
|
|
<Route path='domains' element={<DomainsPage/>}/>
|
2025-10-29 22:16:33 -06:00
|
|
|
<Route path='domain/:domainId/edit' element={<DomainEditPage/>}/>
|
2025-01-26 12:44:16 -07:00
|
|
|
<Route path='settings' element={<ArchiveSettingsPage/>}/>
|
2026-02-02 15:15:28 -07:00
|
|
|
<Route path='statistics' element={<ArchiveStatistics/>}/>
|
2026-03-20 15:38:32 -06:00
|
|
|
<Route path=':fileGroupId' element={<ArchivePage/>}/>
|
2022-08-06 05:22:07 +00:00
|
|
|
</Routes>
|
2022-01-31 09:32:06 -07:00
|
|
|
</PageContainer>
|
2021-11-01 16:42:52 -06:00
|
|
|
}
|