2020-01-31 17:43:14 +01:00
|
|
|
// @flow
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import React from 'react';
|
|
|
|
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">
|
2022-02-11 19:50:55 +01:00
|
|
|
<div className="claim-preview__repost-ribbon">
|
|
|
|
<Icon icon={ICONS.REPOST} size={12} />
|
|
|
|
<br />
|
|
|
|
<span>{repostUrl}</span>
|
|
|
|
</div>
|
2020-12-22 16:16:39 +01:00
|
|
|
</span>
|
|
|
|
);
|
|
|
|
}
|
2021-01-13 16:44:44 +01:00
|
|
|
|
|
|
|
if (repostUrl && !repostChannelUrl) {
|
|
|
|
return (
|
|
|
|
<div className="claim-preview__repost-author">
|
2022-02-18 11:51:48 +01:00
|
|
|
<div className="claim-preview__repost-ribbon">
|
|
|
|
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
|
|
|
|
<br />
|
|
|
|
{__('Anonymous')}
|
|
|
|
</div>
|
2021-01-13 16:44:44 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
if (!repostUrl) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2020-01-31 17:43:14 +01:00
|
|
|
return (
|
|
|
|
<div className="claim-preview__repost-author">
|
2022-02-11 19:50:55 +01:00
|
|
|
<div className="claim-preview__repost-ribbon">
|
|
|
|
<Icon icon={ICONS.REPOST} size={10} className="claim-preview__repost-icon" />
|
|
|
|
<br />
|
2022-02-25 15:04:23 +01:00
|
|
|
<UriIndicator link uri={repostChannelUrl} showAtSign />
|
2022-02-11 19:50:55 +01:00
|
|
|
</div>
|
2020-01-31 17:43:14 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
export default ClaimRepostAuthor;
|