mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-12-01 12:26:19 -05:00
Creating background process that fetches comments for Videos that do not yet have comments.
Displaying star for Uploader's comments, heart for favorited comments. Adding wrolpi help files desktop shortcut to rpi image. Using zim file names as FileGroup.title. Removing accidental output commit.
This commit is contained in:
parent
df849ffb42
commit
758ff8e810
14 changed files with 263 additions and 127 deletions
|
|
@ -1653,3 +1653,11 @@ export function getParentDirectory(filePath) {
|
|||
|
||||
return parentDirectory;
|
||||
}
|
||||
|
||||
export function MultilineText({text, ...props}) {
|
||||
return <div {...props}>
|
||||
{text.split('\n').map((line, index, array) =>
|
||||
index === array.length - 1 ? line : <p>{line}</p>
|
||||
)}
|
||||
</div>
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {
|
|||
humanFileSize,
|
||||
humanNumber,
|
||||
isoDatetimeToString,
|
||||
MultilineText,
|
||||
PageContainer,
|
||||
PreviewPath,
|
||||
useTitle
|
||||
|
|
@ -99,20 +100,33 @@ const NoComments = ({video}) => {
|
|||
const VideoComment = ({comment, children}) => {
|
||||
const {t} = React.useContext(ThemeContext);
|
||||
|
||||
const favoriteComment = <Icon name='heart'/>;
|
||||
const likesCount = <React.Fragment>
|
||||
<Icon name='thumbs up'/> {comment['like_count']}
|
||||
</React.Fragment>;
|
||||
const {is_favorited, like_count, author, timestamp, text, author_is_uploader} = comment;
|
||||
|
||||
// Author comments and favorited comments are important.
|
||||
let specialIcon = null;
|
||||
if (author_is_uploader) {
|
||||
specialIcon = <Icon name='star' color='green'/>;
|
||||
} else if (is_favorited) {
|
||||
specialIcon = <Icon name='heart' color='red'/>;
|
||||
}
|
||||
|
||||
const dateElm = <div {...t}>{isoDatetimeToString(timestamp * 1000)}</div>;
|
||||
const likesElm = like_count && <div {...t}>
|
||||
<Icon name='thumbs up'/>{comment['like_count']}
|
||||
</div>;
|
||||
|
||||
return <Comment>
|
||||
<Comment.Content>
|
||||
<Comment.Author as='a'><span {...t}>{comment['author']}</span></Comment.Author>
|
||||
<Comment.Author as='a'>
|
||||
<span {...t}>{specialIcon}{author}</span>
|
||||
</Comment.Author>
|
||||
<Comment.Metadata>
|
||||
<div {...t}>{comment['is_favorited'] && favoriteComment}</div>
|
||||
<div {...t}>{isoDatetimeToString(comment['timestamp'] * 1000)}</div>
|
||||
<div {...t}>{comment['like_count'] && likesCount}</div>
|
||||
{dateElm}
|
||||
{likesElm}
|
||||
</Comment.Metadata>
|
||||
<Comment.Text {...t}>{comment['text']}</Comment.Text>
|
||||
<Comment.Text {...t}>
|
||||
<MultilineText text={text} style={{marginLeft: '0.5em'}}/>
|
||||
</Comment.Text>
|
||||
</Comment.Content>
|
||||
{children && !_.isEmpty(children) &&
|
||||
<CommentGroup>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue