From f826a95f6e98b36841a87389590a65e79877fc7d Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Tue, 25 Jul 2023 00:57:15 +0200 Subject: [PATCH] Add published date and author to news on the explore screen in web UI (#26155) --- .../features/explore/components/story.jsx | 14 +++++-- .../mastodon/features/explore/links.jsx | 5 ++- .../styles/mastodon/components.scss | 41 +++++++++++++++---- 3 files changed, 47 insertions(+), 13 deletions(-) diff --git a/app/javascript/mastodon/features/explore/components/story.jsx b/app/javascript/mastodon/features/explore/components/story.jsx index 42b65e7dcc22ef..92eb41cff81509 100644 --- a/app/javascript/mastodon/features/explore/components/story.jsx +++ b/app/javascript/mastodon/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 'mastodon/components/blurhash'; import { accountsCountRenderer } from 'mastodon/components/hashtag'; +import { RelativeTimestamp } from 'mastodon/components/relative_timestamp'; import { ShortNumber } from 'mastodon/components/short_number'; import { Skeleton } from 'mastodon/components/skeleton'; @@ -15,9 +18,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 = { @@ -27,16 +33,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/mastodon/features/explore/links.jsx b/app/javascript/mastodon/features/explore/links.jsx index 6f402decbfa9a5..489ab6dd616e1d 100644 --- a/app/javascript/mastodon/features/explore/links.jsx +++ b/app/javascript/mastodon/features/explore/links.jsx @@ -55,13 +55,16 @@ class Links extends PureComponent {
{banner} - {isLoading ? () : links.map(link => ( + {isLoading ? () : links.map((link, i) => (