// @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 'util/format-credits'; 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, expandOverride: boolean, }; function FileDescription(props: Props) { const { uri, claim, metadata, pendingAmount, doOpenModal, claimIsMine, expandOverride } = 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 {__('Empty claim or metadata info.')}; } const { description } = metadata; return (
{description && }
{!expandOverride && ( <> {expanded ? (
{showCreditDetails && (
)} ); } export default FileDescription;