Only display fields that aren't empty (post trim)

master
Drew DeVault 2017-09-08 16:54:51 +09:00
parent 7065a635b1
commit f21215bc67
1 changed files with 11 additions and 4 deletions

View File

@ -341,14 +341,21 @@ class AddTorrent extends Component {
<CardTitle>{magnet && "Magnet link" || file.name}</CardTitle>
<CardText>
<dl style={{marginBottom: "0"}}>
{Object.keys(details).map(key =>
torrent[key] && (
{Object.keys(details).map(key => {
const val = torrent[key];
if (!val) {
return null;
}
if (typeof val === "string" && !val.trim()) {
return null;
}
return (
<div>
<dt>{key}</dt>
<dd>{details[key](torrent[key])}</dd>
</div>
)
)}
);
})}
</dl>
</CardText>
</CardBlock>