lbry-desktop/ui/component/livestreamLink/view.jsx

34 lines
753 B
React
Raw Normal View History

// @flow
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';
type Props = {
title?: string,
claimUri: string,
};
export default function LivestreamLink(props: Props) {
const { claimUri, title = null } = props;
2021-04-23 21:59:48 +02:00
const { push } = useHistory();
if (!claimUri) {
return null;
}
return (
2021-04-23 21:59:48 +02:00
<Card
className="livestream__channel-link claim-preview__live"
title={title || __('Live stream in progress')}
2021-04-23 21:59:48 +02:00
onClick={() => {
push(formatLbryUrlForWeb(claimUri));
2021-04-23 21:59:48 +02:00
}}
>
<ClaimPreview uri={claimUri} type="inline" hideMenu />
2021-03-30 01:05:18 +02:00
</Card>
);
}