invertSelection()}
- disabled={!videos || videos.length === 0}
+ disabled={isEmpty(videos)}
>
Invert
@@ -279,3 +298,90 @@ export function VideosRoute(props) {
)
}
+export function VideoCard({file}) {
+ const {video} = file;
+ const {s} = useContext(ThemeContext);
+
+ let video_url = `/videos/video/${video.id}`;
+ const upload_date = uploadDate(video.upload_date);
+ // A video may not have a channel.
+ const channel = video.channel ? video.channel : null;
+ let channel_url = null;
+ if (channel) {
+ channel_url = `/videos/channel/${channel.id}/video`;
+ video_url = `/videos/channel/${channel.id}/video/${video.id}`;
+ }
+ const poster_url = video.poster_path ? `/media/${encodeURIComponent(video.poster_path)}` : null;
+
+ let imageLabel = null;
+ if (video.favorite) {
+ imageLabel = {corner: 'left', icon: 'heart', color: 'green'};
+ }
+ let poster = ;
+ if (poster_url) {
+ poster = ;
+ }
+
+ return (
+
+ {poster}
+
+
+
+
+
+
+ {textEllipsis(video.title || video.stem || video.video_path, 100)}
+
+
+
+
+
+ {channel &&
+ {channel.name}
+ }
+ {upload_date}
+
+
+
+ )
+}
+
+export function VideoRowCells({file}) {
+ const {video} = file;
+
+ let video_url = `/videos/video/${video.id}`;
+ const poster_url = video.poster_path ? `/media/${encodeURIComponent(video.poster_path)}` : null;
+
+ let poster;
+ let imageLabel = video.favorite ? {corner: 'left', icon: 'heart', color: 'green'} : null;
+ if (poster_url) {
+ poster =
+
+
+ } else {
+ poster = ;
+ }
+
+ // Fragment for SelectableRow
+ return
+
+
+ {poster}
+
+
+
+
+ {textEllipsis(video.title || video.stem || video.video_path, 100)}
+
+
+
+}
diff --git a/app/src/components/admin/Downloads.js b/app/src/components/admin/Downloads.js
index 3272d644..3372bd89 100644
--- a/app/src/components/admin/Downloads.js
+++ b/app/src/components/admin/Downloads.js
@@ -2,7 +2,7 @@ import React, {useContext} from "react";
import {clearCompletedDownloads, clearFailedDownloads, killDownload, postDownload} from "../../api";
import {Link} from "react-router-dom";
import {
- DisableDownloadsToggle,
+ DisableDownloadsToggle, isEmpty,
secondsToElapsedPopup,
secondsToFrequency,
textEllipsis,
@@ -301,7 +301,7 @@ export function Downloads() {
);
let onceTable = tablePlaceholder;
- if (onceDownloads && onceDownloads.length === 0) {
+ if (isEmpty(onceDownloads)) {
onceTable = No downloads are scheduled.
} else if (onceDownloads) {
onceTable = (
@@ -320,7 +320,7 @@ export function Downloads() {
}
let recurringTable = tablePlaceholder;
- if (recurringDownloads && recurringDownloads.length === 0) {
+ if (isEmpty(recurringDownloads)) {
recurringTable = No recurring downloads are scheduled.
} else if (recurringDownloads) {
recurringTable =