import {Grid, Panel, Placeholder} from "./ui";
import React from "react";
import {encodeMediaPath, FileIcon, findPosterPath, PreviewLink} from "./Common";
import {Link} from "react-router";
import _ from "lodash";
import {FileRowTagIcon} from "./Files";
export const HeadlineText = ({headline, openTag = '', closeTag = ''}) => {
if (headline) {
headline = headline.replaceAll('', openTag);
headline = headline.replaceAll('', closeTag);
headline = headline.replaceAll('\n', '
');
// FTS headlines use ... tags which we will restyle.
return
}
}
const FileHeadline = ({file, to}) => {
const {title, name, title_headline, b_headline, c_headline, d_headline} = file;
let poster;
const posterPath = findPosterPath(file);
if (posterPath) {
const posterUrl = posterPath ? `/media/${encodeMediaPath(posterPath)}` : null;
poster =
;
} else {
poster = ;
}
let header = title || name;
if (title_headline) {
header = ;
}
if (to) {
header =
}
let body = No highlights available.
;
if (b_headline || c_headline || d_headline) {
body = <>
>;
}
return
{poster}
{header}
{body}
}
export const Headlines = ({results}) => {
if (results === null || results === undefined) {
return
} else if (results && results.length === 0) {
return No results!
}
let headlines = [];
for (let i = 0; i < results.length; i++) {
const result = results[i];
const {model, data, video} = result;
if (model === 'video' && !_.isEmpty(video)) {
const video_url = `/videos/${result.id}`;
headlines = [...headlines, ];
} else if (model === 'archive' && !_.isEmpty(data)) {
headlines = [...headlines, ];
} else {
headlines = [...headlines, ];
}
}
return <>
{headlines}
>
}