mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
Naomi comment websockets increase slow mode time to 5 seconds fix to prevent duplicate comments update livestream details fix channel pin electron boom fix rebase prune unused icons updating meme updating meme update livestream for naomi fix rebase DigitalCashNetwork remove electroboom pin Slavguns Joel So he can edit his claims add streamTypes param to claimTilesDiscover so following section can search for all types of content fix typo update meme fixes publish page fixes pending fix notifications fix comments finally fix claim preview no mature for simplesite Revert "no mature for simplesite" This reverts commit 9f89242d85e0cacf44cbf0a683bebbe50840c466. fix livestream preview click no mature on simple site try fixing invite page crash probably needs more changes.
87 lines
2.9 KiB
JavaScript
87 lines
2.9 KiB
JavaScript
// @flow
|
|
import * as ICONS from 'constants/icons';
|
|
import * as MODALS from 'constants/modal_types';
|
|
import React from 'react';
|
|
import classnames from 'classnames';
|
|
import { formatCredits } from 'lbry-redux';
|
|
import MarkdownPreview from 'component/common/markdown-preview';
|
|
import ClaimTags from 'component/claimTags';
|
|
import Button from 'component/button';
|
|
import LbcSymbol from 'component/common/lbc-symbol';
|
|
import FileDetails from 'component/fileDetails';
|
|
import FileValues from 'component/fileValues';
|
|
|
|
type Props = {
|
|
uri: string,
|
|
claim: StreamClaim,
|
|
metadata: StreamMetadata,
|
|
user: ?any,
|
|
tags: any,
|
|
pendingAmount: number,
|
|
doOpenModal: (id: string, {}) => void,
|
|
claimIsMine: boolean,
|
|
};
|
|
|
|
function FileDescription(props: Props) {
|
|
const { uri, claim, metadata, pendingAmount, doOpenModal, claimIsMine } = props;
|
|
const [expanded, setExpanded] = React.useState(false);
|
|
const [showCreditDetails, setShowCreditDetails] = React.useState(false);
|
|
const amount = parseFloat(claim.amount) + parseFloat(pendingAmount || claim.meta.support_amount);
|
|
const formattedAmount = formatCredits(amount, 2, true);
|
|
const hasSupport = claim && claim.meta && claim.meta.support_amount && Number(claim.meta.support_amount) > 0;
|
|
|
|
if (!claim || !metadata) {
|
|
return <span className="empty">{__('Empty claim or metadata info.')}</span>;
|
|
}
|
|
|
|
const { description } = metadata;
|
|
|
|
return (
|
|
<div>
|
|
<div
|
|
className={classnames({
|
|
'media__info-text--contracted': !expanded,
|
|
'media__info-text--expanded': expanded,
|
|
'media__info-text--fade': !expanded,
|
|
})}
|
|
>
|
|
{description && <MarkdownPreview className="markdown-preview--description" content={description} simpleLinks />}
|
|
<ClaimTags uri={uri} type="large" />
|
|
<FileDetails uri={uri} />
|
|
</div>
|
|
|
|
<div className="card__bottom-actions">
|
|
{expanded ? (
|
|
<Button button="link" label={__('Less')} onClick={() => setExpanded(!expanded)} />
|
|
) : (
|
|
<Button button="link" label={__('More')} onClick={() => setExpanded(!expanded)} />
|
|
)}
|
|
|
|
<div className="section__actions--no-margin">
|
|
{claimIsMine && hasSupport && (
|
|
<Button
|
|
button="link"
|
|
className="expandable__button"
|
|
icon={ICONS.UNLOCK}
|
|
aria-label={__('Unlock tips')}
|
|
onClick={() => {
|
|
doOpenModal(MODALS.LIQUIDATE_SUPPORTS, { uri });
|
|
}}
|
|
/>
|
|
)}
|
|
<Button button="link" onClick={() => setShowCreditDetails(!showCreditDetails)}>
|
|
<LbcSymbol postfix={showCreditDetails ? __('Hide') : formattedAmount} />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
|
|
{showCreditDetails && (
|
|
<div className="section">
|
|
<FileValues uri={uri} />
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|
|
|
|
export default FileDescription;
|