diff --git a/pages/Transaction.tsx b/pages/Transaction.tsx index 8ee19dd..ee9918e 100644 --- a/pages/Transaction.tsx +++ b/pages/Transaction.tsx @@ -24,11 +24,11 @@ type Boostagram = { name: string; podcast: string; url: string; - episode?: string; - itemID?: string; - ts?: string; + episode?: string | number; + itemID?: string | number; + ts?: string | number; message?: string; - sender_id: string; + sender_id: string | number; sender_name: string; time: string; action: string; @@ -204,40 +204,30 @@ function TransactionDetailRow(props: { } function PodcastingInfo({ boost }: { boost: Boostagram }) { + const renderDetail = (title: string, content: any) => { + if (content === 0 || !!content) { + return ; + } + return null; + }; return ( <> - {boost.message && ( - - )} - {boost.podcast && ( - - )} - {boost.episode && ( - - )} - {boost.action && ( - - )} - {boost.ts && ( - - )} - {boost.value_msat_total && ( - - )} - {boost.sender_name && ( - - )} - {boost.app_name && ( - + {renderDetail("Message", boost.message)} + {renderDetail("Podcast", boost.podcast)} + {renderDetail("Episode", boost.episode)} + {renderDetail("Action", boost.action)} + {renderDetail("Timestamp", boost.ts)} + {renderDetail( + "Total amount", + boost.value_msat_total + ? Math.floor(boost.value_msat_total / 1000) + + (Math.floor(boost.value_msat_total / 1000) === 1 + ? " sat" + : " sats") + : null, )} + {renderDetail("Sender", boost.sender_name)} + {renderDetail("App", boost.app_name)} ); } - -export default PodcastingInfo;