2020-01-31 17:43:14 +01:00
|
|
|
// @flow
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import React from 'react';
|
|
|
|
import I18nMessage from 'component/i18nMessage';
|
|
|
|
import UriIndicator from 'component/uriIndicator';
|
|
|
|
import Icon from 'component/common/icon';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
claim: ?Claim,
|
2020-12-22 16:16:39 +01:00
|
|
|
short: boolean,
|
2020-01-31 17:43:14 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
function ClaimRepostAuthor(props: Props) {
|
2020-12-22 16:16:39 +01:00
|
|
|
const { claim, short } = props;
|
2020-01-31 17:43:14 +01:00
|
|
|
const repostChannelUrl = claim && claim.repost_channel_url;
|
2020-12-22 16:16:39 +01:00
|
|
|
const repostUrl = claim && claim.repost_url;
|
2020-01-31 17:43:14 +01:00
|
|
|
|
2021-01-13 16:44:44 +01:00
|
|
|
if (short && repostUrl) {
|
2020-12-22 16:16:39 +01:00
|
|
|
return (
|
|
|
|
<span className="claim-preview__repost-author">
|
2021-01-13 16:44:44 +01:00
|
|
|
<Icon icon={ICONS.REPOST} size={12} />
|
2020-12-22 16:16:39 +01:00
|
|
|
<span>{repostUrl}</span>
|
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
2021-01-13 16:44:44 +01:00
|
|
|
|
|
|
|
if (repostUrl && !repostChannelUrl) {
|
|
|
|
return (
|
|
|
|
<div className="claim-preview__repost-author">
|
|
|
|
<Icon icon={ICONS.REPOST} size={10} />
|
|
|
|
<span>
|
2021-01-20 12:00:15 +01:00
|
|
|
<I18nMessage
|
|
|
|
tokens={{
|
|
|
|
anonymous: <strong>{__('Anonymous --[used in <%anonymous% Reposted>]--')}</strong>,
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
%anonymous% Reposted
|
|
|
|
</I18nMessage>
|
2021-01-13 16:44:44 +01:00
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!repostUrl) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-01-31 17:43:14 +01:00
|
|
|
return (
|
|
|
|
<div className="claim-preview__repost-author">
|
2021-02-16 22:09:20 +01:00
|
|
|
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
|
2020-01-31 17:43:14 +01:00
|
|
|
<I18nMessage tokens={{ repost_channel_link: <UriIndicator link uri={repostChannelUrl} /> }}>
|
|
|
|
%repost_channel_link% reposted
|
|
|
|
</I18nMessage>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ClaimRepostAuthor;
|