diff --git a/app/src/components/Admin.js b/app/src/components/Admin.js
index 690b539e..d6235786 100644
--- a/app/src/components/Admin.js
+++ b/app/src/components/Admin.js
@@ -23,7 +23,7 @@ import {
startDownloads
} from "../api";
import TimezoneSelect from 'react-timezone-select';
-import {secondsToDate, secondsToFrequency, WROLModeMessage} from "./Common";
+import {secondsToDate, secondsToFrequency, textEllipsis, truncateLong, WROLModeMessage} from "./Common";
class Settings extends React.Component {
@@ -185,7 +185,7 @@ class DownloadRow extends React.Component {
}
return (
- {url}
+ {textEllipsis(url, 50)}
{secondsToFrequency(frequency)}
{last_successful_download ? secondsToDate(last_successful_download) : null}
{secondsToDate(next_download)}
@@ -282,7 +282,7 @@ class StoppableRow extends React.Component {
return (
- {url}
+ {textEllipsis(url, 50)}
{last_successful_download ? secondsToDate(last_successful_download) : null}
{status}
{buttonCell}
diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js
index 19f8053f..bd1eeee4 100644
--- a/app/src/components/Archive.js
+++ b/app/src/components/Archive.js
@@ -1,6 +1,6 @@
import React, {useState} from "react";
import {Card, Confirm, Container, Icon, Image, Placeholder, Tab} from "semantic-ui-react";
-import Paginator, {ClearButton, ExternalLink, SearchInput, uploadDate} from "./Common";
+import Paginator, {ClearButton, ExternalLink, SearchInput, textEllipsis, truncateLong, uploadDate} from "./Common";
import {deleteArchive, postDownload, refreshArchives} from "../api";
import Button from "semantic-ui-react/dist/commonjs/elements/Button";
import {Link, NavLink} from "react-router-dom";
@@ -124,7 +124,7 @@ function ArchiveCard({archive, syncArchive, deleteArchive}) {
- {archive.title || archive.url}
+ {textEllipsis(archive.title || archive.url, 100)}
diff --git a/app/src/components/Common.js b/app/src/components/Common.js
index 3641571a..09ff7d3d 100644
--- a/app/src/components/Common.js
+++ b/app/src/components/Common.js
@@ -121,7 +121,7 @@ export function VideoCard({video}) {
- {video.title || video.stem || video.video_path}
+ {textEllipsis(video.title || video.stem || video.video_path, 100)}
@@ -608,3 +608,17 @@ export function WROLModeMessage({content}) {
}
return null;
}
+
+// Thanks https://www.npmjs.com/package/text-ellipsis
+export function textEllipsis(str, maxLength, { side = "end", ellipsis = "..." } = {}) {
+ if (str.length > maxLength) {
+ switch (side) {
+ case "start":
+ return ellipsis + str.slice(-(maxLength - ellipsis.length));
+ case "end":
+ default:
+ return str.slice(0, maxLength - ellipsis.length) + ellipsis;
+ }
+ }
+ return str;
+}