Show runs coming up with hourglass preview and icon.

master
Icedream 2021-01-04 07:51:44 +01:00
parent b0f4ae9fc0
commit 5a0003d094
3 changed files with 169 additions and 46 deletions

View File

@ -15,6 +15,8 @@ import FormattedDuration from './localization/FormattedDuration';
import style from './VideoListItem.module.scss'; import style from './VideoListItem.module.scss';
import sanitizeTitle from '../util/sanitizeTitle'; import sanitizeTitle from '../util/sanitizeTitle';
import hourglassImage from '../images/hourglass.svg';
export default function VideoListItem({ export default function VideoListItem({
thumbnailServerURL, thumbnailServerURL,
duration, duration,
@ -59,46 +61,63 @@ export default function VideoListItem({
displayDuration = videoEnd - videoStart; displayDuration = videoEnd - videoStart;
} }
const titleUrlSlug = sanitizeTitle(title); const titleUrlSlug = sanitizeTitle(title);
return ( const listGroupItem = (
<Link passHref href="/[id]/[vslug]" as={`/${id}/${titleUrlSlug}`}> <ListGroup.Item action>
<ListGroup.Item action> <Media>
<Media> <Image
<Image className={['mr-3', style.thumbnail].join(' ')}
className={['mr-3', style.thumbnail].join(' ')} src={
src={getThumbnailURL(thumbnailServerURL, id, fileName, 90 * 1000, { fileName
width: 96, ? getThumbnailURL(thumbnailServerURL, id, fileName, 90 * 1000, {
})} width: 96,
srcSet={[96, 96 * 2, 96 * 3] })
.map((width) => [ : hourglassImage
getThumbnailURL(thumbnailServerURL, id, fileName, 90 * 1000, { }
srcSet={[96, 96 * 2, 96 * 3]
.map((width) => [
fileName
? getThumbnailURL(thumbnailServerURL, id, fileName, 90 * 1000, {
width, width,
}), })
`${width}w`, : hourglassImage,
]) `${width}w`,
.map((item) => item.join(' ')) ])
.join(', ')} .map((item) => item.join(' '))
alt={title} .join(', ')}
/> alt={title}
<Media.Body> />
<h5 className="mt-0 mb-3">{title}</h5> <Media.Body>
<p> <h5 className="mt-0 mb-3">{title}</h5>
{displayDuration !== null ? ( <p>
<span> {!fileName ? (
<FontAwesomeIcon icon="clock" /> <span>
{' '} <FontAwesomeIcon icon="hourglass" />
<FormattedDuration {' '}
seconds={displayDuration} Coming up
format="{hours} {minutes} {seconds}" </span>
unitDisplay="short" ) : ''}
/> {displayDuration !== null ? (
</span> <span>
) : ( <FontAwesomeIcon icon="clock" />
'' {' '}
)} <FormattedDuration
</p> seconds={displayDuration}
</Media.Body> format="{hours} {minutes} {seconds}"
</Media> unitDisplay="short"
</ListGroup.Item> />
</Link> </span>
) : ''}
</p>
</Media.Body>
</Media>
</ListGroup.Item>
); );
if (fileName) {
return (
<Link passHref href="/[id]/[vslug]" as={`/${id}/${titleUrlSlug}`}>
{listGroupItem}
</Link>
);
}
return listGroupItem;
} }

View File

@ -0,0 +1,102 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="160"
height="90"
viewBox="0 0 42.333332 23.812501"
version="1.1"
id="svg8"
inkscape:version="1.0.1 (3bc2e813f5, 2020-09-07)"
sodipodi:docname="hourglass.svg">
<defs
id="defs2">
<style
id="style10">
.vi-primary {
fill: #FF6E6E;
}
.vi-primary, .vi-accent {
fill-rule: evenodd;
}
.vi-accent {
fill: #0C0058;
}
</style>
<filter
style="color-interpolation-filters:sRGB;"
inkscape:label="Greyscale"
id="filter52">
<feColorMatrix
values="0.21 0.72 0.072 0 0 0.21 0.72 0.072 0 0 0.21 0.72 0.072 0 0 0 0 0 1 0 "
id="feColorMatrix50"
result="fbSourceGraphic" />
<feColorMatrix
result="fbSourceGraphicAlpha"
in="fbSourceGraphic"
values="0 0 0 -1 0 0 0 0 -1 0 0 0 0 -1 0 0 0 0 1 0"
id="feColorMatrix54" />
<feColorMatrix
id="feColorMatrix56"
values="0.21 0.72 0.072 9.12248 0 0.21 0.72 0.072 9.12248 0 0.21 0.72 0.072 9.12248 0 0 0 0 1 0 "
in="fbSourceGraphic" />
</filter>
</defs>
<sodipodi:namedview
id="base"
pagecolor="#4d4d4d"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:zoom="5.5367125"
inkscape:cx="72.85483"
inkscape:cy="49.015886"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
inkscape:document-rotation="0"
showgrid="false"
units="px"
inkscape:window-width="1920"
inkscape:window-height="1018"
inkscape:window-x="0"
inkscape:window-y="0"
inkscape:window-maximized="1" />
<metadata
id="metadata5">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1">
<g
id="g26"
transform="matrix(0.42698088,-0.42532421,0.43308484,0.4314045,-0.36410666,11.911521)"
style="filter:url(#filter52)">
<path
class="vi-primary"
d="m 35.79,35.83 v 4.177 H 38 V 43 H 10 v -2.993 h 2.211 V 35.83 c 0,0 1.927,-9.357 9.789,-10.83 V 23 C 14.137,21.527 12.211,12.17 12.211,12.17 V 7.993 H 10 V 5 h 28 v 2.993 h -2.21 v 4.177 c 0,0 -1.927,9.357 -9.79,10.83 v 2 c 7.863,1.473 9.79,10.83 9.79,10.83 z"
id="path14" />
<path
class="vi-accent"
d="M 12.211,40 V 37 H 35.79 v 3 z m 0,-29 V 8 H 35.79 v 3 z"
id="path16" />
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -6,12 +6,13 @@ import {
} from '@fortawesome/fontawesome-svg-core'; } from '@fortawesome/fontawesome-svg-core';
import { import {
faClock, faClock,
faCopy,
faDownload, faDownload,
faHourglass,
faLanguage,
faLightbulb,
faSearch, faSearch,
faShare, faShare,
faLightbulb,
faCopy,
faLanguage,
} from '@fortawesome/free-solid-svg-icons'; } from '@fortawesome/free-solid-svg-icons';
import { faLightbulb as farLightbulb } from '@fortawesome/free-regular-svg-icons'; import { faLightbulb as farLightbulb } from '@fortawesome/free-regular-svg-icons';
import { faTwitch as fabTwitch } from '@fortawesome/free-brands-svg-icons'; import { faTwitch as fabTwitch } from '@fortawesome/free-brands-svg-icons';
@ -50,15 +51,16 @@ import withSession from '../util/session';
fontawesomeSvgCoreConfig.autoAddCss = false; fontawesomeSvgCoreConfig.autoAddCss = false;
library.add( library.add(
fabTwitch,
faClock, faClock,
faCopy, faCopy,
faDownload, faDownload,
faHourglass,
faLanguage, faLanguage,
faSearch,
faShare,
fabTwitch,
faLightbulb, faLightbulb,
farLightbulb, farLightbulb,
faSearch,
faShare,
); );
Router.events.on('routeChangeStart', (url) => { Router.events.on('routeChangeStart', (url) => {