From 450f75b6f7a1c8d39af77abc713363c4ad692f1a Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 25 Jul 2023 00:57:15 +0200 Subject: [PATCH] [Glitch] Add published date and author to news on the explore screen in web UI Port f826a95f6e98b36841a87389590a65e79877fc7d to glitch-soc Signed-off-by: Claire --- .../features/explore/components/story.jsx | 14 +++++-- .../glitch/features/explore/links.jsx | 5 ++- .../glitch/styles/components/explore.scss | 41 +++++++++++++++---- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/app/javascript/flavours/glitch/features/explore/components/story.jsx b/app/javascript/flavours/glitch/features/explore/components/story.jsx index 76eb207acd..9a4a221bca 100644 --- a/app/javascript/flavours/glitch/features/explore/components/story.jsx +++ b/app/javascript/flavours/glitch/features/explore/components/story.jsx @@ -1,10 +1,13 @@ import PropTypes from 'prop-types'; import { PureComponent } from 'react'; +import { FormattedMessage } from 'react-intl'; + import classNames from 'classnames'; import { Blurhash } from 'flavours/glitch/components/blurhash'; import { accountsCountRenderer } from 'flavours/glitch/components/hashtag'; +import { RelativeTimestamp } from 'flavours/glitch/components/relative_timestamp'; import { ShortNumber } from 'flavours/glitch/components/short_number'; import { Skeleton } from 'flavours/glitch/components/skeleton'; @@ -16,9 +19,12 @@ export default class Story extends PureComponent { title: PropTypes.string, lang: PropTypes.string, publisher: PropTypes.string, + publishedAt: PropTypes.string, + author: PropTypes.string, sharedTimes: PropTypes.number, thumbnail: PropTypes.string, blurhash: PropTypes.string, + expanded: PropTypes.bool, }; state = { @@ -28,16 +34,16 @@ export default class Story extends PureComponent { handleImageLoad = () => this.setState({ thumbnailLoaded: true }); render () { - const { url, title, lang, publisher, sharedTimes, thumbnail, blurhash } = this.props; + const { expanded, url, title, lang, publisher, author, publishedAt, sharedTimes, thumbnail, blurhash } = this.props; const { thumbnailLoaded } = this.state; return ( - +
-
{publisher ? publisher : }
+
{publisher ? {publisher} : }{publishedAt && <> · }
{title ? title : }
-
{typeof sharedTimes === 'number' ? : }
+
{author && <>{author} }} /> · }{typeof sharedTimes === 'number' ? : }
diff --git a/app/javascript/flavours/glitch/features/explore/links.jsx b/app/javascript/flavours/glitch/features/explore/links.jsx index 8d360427d5..383f68a8b4 100644 --- a/app/javascript/flavours/glitch/features/explore/links.jsx +++ b/app/javascript/flavours/glitch/features/explore/links.jsx @@ -55,13 +55,16 @@ class Links extends PureComponent {
{banner} - {isLoading ? () : links.map(link => ( + {isLoading ? () : links.map((link, i) => (