2021-03-10 19:34:21 +01:00
|
|
|
// @flow
|
2021-12-16 22:59:13 +01:00
|
|
|
|
2021-03-10 19:34:21 +01:00
|
|
|
import React from 'react';
|
|
|
|
import Card from 'component/common/card';
|
|
|
|
import ClaimPreview from 'component/claimPreview';
|
2021-04-23 21:59:48 +02:00
|
|
|
import { useHistory } from 'react-router';
|
|
|
|
import { formatLbryUrlForWeb } from 'util/url';
|
2021-03-10 19:34:21 +01:00
|
|
|
|
|
|
|
type Props = {
|
2021-12-22 17:12:44 +01:00
|
|
|
title?: string,
|
2021-12-16 22:59:13 +01:00
|
|
|
claimUri: string,
|
2021-03-10 19:34:21 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function LivestreamLink(props: Props) {
|
2021-12-22 17:12:44 +01:00
|
|
|
const { claimUri, title = null } = props;
|
2021-04-23 21:59:48 +02:00
|
|
|
const { push } = useHistory();
|
2021-03-10 19:34:21 +01:00
|
|
|
|
2022-04-21 08:14:48 +02:00
|
|
|
if (!claimUri) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2021-04-23 21:59:48 +02:00
|
|
|
<Card
|
2021-11-05 20:14:00 +01:00
|
|
|
className="livestream__channel-link claim-preview__live"
|
2021-12-22 17:12:44 +01:00
|
|
|
title={title || __('Live stream in progress')}
|
2021-04-23 21:59:48 +02:00
|
|
|
onClick={() => {
|
2021-12-16 22:59:13 +01:00
|
|
|
push(formatLbryUrlForWeb(claimUri));
|
2021-04-23 21:59:48 +02:00
|
|
|
}}
|
|
|
|
>
|
2022-04-21 08:14:48 +02:00
|
|
|
<ClaimPreview uri={claimUri} type="inline" hideMenu />
|
2021-03-30 01:05:18 +02:00
|
|
|
</Card>
|
2021-03-10 19:34:21 +01:00
|
|
|
);
|
|
|
|
}
|