Using FilePreview in VideoPlayer.

This commit is contained in:
Roland 2023-02-17 16:30:25 -07:00
parent df79aa13b1
commit b6226a0212
No known key found for this signature in database
GPG key ID: 9D6DBD3ACF11AB93
3 changed files with 23 additions and 4 deletions

View file

@ -151,6 +151,10 @@ export function PreviewLink({file, children, className, ...props}) {
</span>
}
export function PreviewPath({path, mimetype, ...props}) {
return <PreviewLink file={{path, mimetype}} {...props}/>
}
export function RequiredAsterisk() {
return <span style={{color: '#db2828'}}> *</span>
}

View file

@ -94,6 +94,7 @@ export function FilePreviewWrapper({children}) {
React.useEffect(() => {
setPreviewModal(null);
console.log(previewFile);
if (previewFile && !_.isObject(previewFile)) {
console.error(`Unknown previewFile type: ${typeof previewFile}`);
return;

View file

@ -2,7 +2,15 @@ import React, {useContext, useState} from 'react';
import {deleteVideos} from "../api";
import {Link, useNavigate, useParams} from "react-router-dom";
import _ from "lodash";
import {BackButton, humanFileSize, humanNumber, isoDatetimeToString, PageContainer, useTitle} from "./Common";
import {
BackButton,
humanFileSize,
humanNumber,
isoDatetimeToString,
PageContainer,
PreviewPath,
useTitle
} from "./Common";
import {Confirm} from "semantic-ui-react";
import Grid from "semantic-ui-react/dist/commonjs/collections/Grid";
import Container from "semantic-ui-react/dist/commonjs/elements/Container";
@ -136,13 +144,19 @@ function VideoPage({videoFile, prevFile, nextFile, setFavorite, ...props}) {
{videoFileLink(video['video_path'])}
<h4>Info JSON File</h4>
{videoFileLink(video['info_json_path'])}
<PreviewPath
path={video['info_json_path']}
mimetype='application/json'>{video['info_json_path']}</PreviewPath>
<h4>Caption File</h4>
{videoFileLink(video['caption_path'])}
<PreviewPath
path={video['caption_path']}
mimetype='text/'>{video['caption_path']}</PreviewPath>
<h4>Poster File</h4>
{videoFileLink(video['poster_path'])}
<PreviewPath
path={video['poster_path']}
mimetype='image/'>{video['poster_path']}</PreviewPath>
<h4>Directory</h4>
{videoFileLink(videoFile['directory'], true)}