diff --git a/app/src/App.css b/app/src/App.css index 2a820ae9..66fb95fe 100644 --- a/app/src/App.css +++ b/app/src/App.css @@ -258,3 +258,73 @@ table.ratio-table td.equal-width { table.ratio-table td.min-width { width: auto; } + +/* CollectionEditForm styles */ +.required-indicator { + color: red; +} + +.action-button-spacing { + margin-top: 1em; +} + +/* Form loading skeleton */ +.form-skeleton-field { + margin-bottom: 1.5em; +} + +.form-skeleton-label { + height: 14px; + width: 80px; + margin-bottom: 8px; + background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%); + background-size: 200% 100%; + animation: skeleton-shimmer 1.5s infinite; + border-radius: 3px; +} + +.form-skeleton-input { + height: 38px; + width: 100%; + background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%); + background-size: 200% 100%; + animation: skeleton-shimmer 1.5s infinite; + border-radius: 4px; +} + +.form-skeleton-textarea { + height: 80px; + width: 100%; + background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%); + background-size: 200% 100%; + animation: skeleton-shimmer 1.5s infinite; + border-radius: 4px; +} + +.form-skeleton-button { + height: 42px; + width: 100px; + background: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%); + background-size: 200% 100%; + animation: skeleton-shimmer 1.5s infinite; + border-radius: 4px; +} + +@keyframes skeleton-shimmer { + 0% { + background-position: -200% 0; + } + 100% { + background-position: 200% 0; + } +} + +/* Dark mode skeleton */ +.inverted .form-skeleton-label, +.inverted .form-skeleton-input, +.inverted .form-skeleton-textarea, +.inverted .form-skeleton-button { + background: linear-gradient(90deg, #333 25%, #444 50%, #333 75%); + background-size: 200% 100%; + animation: skeleton-shimmer 1.5s infinite; +} diff --git a/app/src/components/Common.js b/app/src/components/Common.js index 3f9e3910..8b49896e 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -255,9 +255,17 @@ export function RequiredAsterisk() { return * } -export function secondsToFrequency(seconds) { - const option = allFrequencyOptions[seconds]; - return option ? option.text : null; +/** + * Format a frequency value (in seconds) to a human-readable string using allFrequencyOptions. + * @param {number|null} frequency - Frequency in seconds + * @returns {string} Human-readable frequency text or '-' if null/undefined + */ +export function formatFrequency(frequency) { + if (frequency === null || frequency === undefined) { + return '-'; + } + const option = allFrequencyOptions[frequency]; + return option ? option.text : `${frequency}s`; } const secondsToYears = 31536000; diff --git a/app/src/components/admin/Downloads.js b/app/src/components/admin/Downloads.js index 6bee85c4..62a7e46e 100644 --- a/app/src/components/admin/Downloads.js +++ b/app/src/components/admin/Downloads.js @@ -12,13 +12,14 @@ import { APIButton, DisableDownloadsToggle, ErrorMessage, + formatFrequency, isoDatetimeToElapsedPopup, - secondsToFrequency, useTitle, WROLModeMessage } from "../Common"; import { - Button as SButton, ButtonGroup, + Button as SButton, + ButtonGroup, Label, Loader, PlaceholderLine, @@ -32,12 +33,12 @@ import { import {Button, Header, Modal, ModalActions, ModalContent, ModalHeader, Placeholder, Segment, Table} from "../Theme"; import {useDownloads} from "../../hooks/customHooks"; import { + EditArchiveDownloadForm, EditChannelDownloadForm, EditRSSDownloadForm, EditScrapeFilesDownloadForm, - EditZimDownloadForm, EditVideosDownloadForm, - EditArchiveDownloadForm + EditZimDownloadForm } from "../Download"; import {Downloaders} from "../Vars"; @@ -230,7 +231,7 @@ function RecurringDownloadRow({download, fetchDownloads, onDelete}) { {link(url)} - {secondsToFrequency(frequency)} + {formatFrequency(frequency)} {last_successful_download && isoDatetimeToElapsedPopup(last_successful_download)} {status === 'pending' && } @@ -278,11 +279,11 @@ class OnceDownloadRow extends React.Component { }; handleEditOpen = () => { - this.setState({ editModalOpen: true }); + this.setState({editModalOpen: true}); }; handleEditClose = () => { - this.setState({ editModalOpen: false }); + this.setState({editModalOpen: false}); }; handleEditSuccess = async () => { @@ -317,29 +318,29 @@ class OnceDownloadRow extends React.Component { - - {(downloader === Downloaders.Video || downloader === Downloaders.Archive) && status !== 'pending' && ( -