diff --git a/app/src/components/Archive.js b/app/src/components/Archive.js index a2e7c9fb..4c6407f6 100644 --- a/app/src/components/Archive.js +++ b/app/src/components/Archive.js @@ -18,7 +18,7 @@ import { } from "semantic-ui-react"; import { BackButton, - CardLink, + CardLink, cardTitleWrapper, defaultSearchOrder, epochToDateString, ExternalCardLink, @@ -137,7 +137,7 @@ function ArchivePage() { if (archive.url) { urlHeader =
- {textEllipsis(archive.url, 100)} + {textEllipsis(archive.url)}
; } @@ -149,7 +149,7 @@ function ArchivePage() { {screenshot} -
{textEllipsis(archive.title || archive.url, 100)}
+
{textEllipsis(archive.title || archive.url)}
{epochToDateString(archive.archive_datetime)}
{domainHeader} @@ -198,7 +198,7 @@ export function ArchiveCard({file}) { - {textEllipsis(archive.title || archive.url, 100)} + {cardTitleWrapper(archive.title || archive.url)} @@ -453,7 +453,7 @@ export function ArchiveRowCells({file}) { - {textEllipsis(archive.title || archive.stem, 100)} + {textEllipsis(archive.title || archive.stem)} ) diff --git a/app/src/components/Common.js b/app/src/components/Common.js index 3ec8f7a0..f6a75f41 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -796,3 +796,8 @@ export const filterToMimetypes = (filter) => { export const toLocaleString = (num, locale = 'en-US') => { return num.toLocaleString(locale); } + +export const cardTitleWrapper = (title, maxLength = 100, breakWord = true) => { + const style = breakWord ? {overflowWrap: 'break-word'} : null; + return {textEllipsis(title, maxLength)} +} diff --git a/app/src/components/Files.js b/app/src/components/Files.js index 85f55b7c..06bd8f43 100644 --- a/app/src/components/Files.js +++ b/app/src/components/Files.js @@ -21,7 +21,7 @@ import 'react-keyed-file-browser/dist/react-keyed-file-browser.css'; import {deleteFile, refreshDirectoryFiles, refreshFiles} from "../api"; import { CardGroupCentered, - CardPosterLink, + CardPosterLink, cardTitleWrapper, epochToDateString, ExternalCardLink, FileIcon, @@ -238,7 +238,7 @@ function ImageCard({file}) { -

{textEllipsis(file.title || file.stem || file.path, 100)}

+

{textEllipsis(file.title || file.stem || file.path)}

@@ -281,7 +281,7 @@ function FileCard({file}) { - {textEllipsis(file.title || file.stem || file.path)} + {cardTitleWrapper(file.title || file.stem || file.path)}

{epochToDateString(file.modified / 1000)}

@@ -320,7 +320,7 @@ function ImageRowCells({file}) { -

{textEllipsis(file.title || file.stem || file.path, 100)}

+

{textEllipsis(file.title || file.stem || file.path)}

) diff --git a/app/src/components/Videos.js b/app/src/components/Videos.js index f8ede548..3b291955 100644 --- a/app/src/components/Videos.js +++ b/app/src/components/Videos.js @@ -2,7 +2,7 @@ import React, {Fragment, useContext, useEffect, useState} from 'react'; import {Link, Route, Routes, useParams} from "react-router-dom"; import { CardLink, - CardPosterLink, + CardPosterLink, cardTitleWrapper, defaultSearchOrder, defaultVideoOrder, Duration, @@ -337,7 +337,7 @@ export function VideoCard({file}) { -

{textEllipsis(video.title || video.stem || video.video_path, 100)}

+

{cardTitleWrapper(video.title || video.stem || video.video_path)}

@@ -382,7 +382,7 @@ export function VideoRowCells({file}) { - {textEllipsis(video.title || video.stem || video.video_path, 100)} + {textEllipsis(video.title || video.stem || video.video_path)}