TorrentGeneralInfo: add "Finished" field

This commit is contained in:
Jesse Chan
2021-05-17 21:59:59 +08:00
parent 5f3144416d
commit bf95600e47
2 changed files with 24 additions and 17 deletions
@@ -22,21 +22,11 @@ const TorrentGeneralInfo: FC = observer(() => {
return null;
}
const torrent = TorrentStore.torrents[UIStore?.activeModal?.hash];
const torrent = TorrentStore.torrents[UIStore.activeModal.hash];
if (torrent == null) {
return null;
}
let dateAdded = null;
if (torrent.dateAdded) {
dateAdded = new Date(torrent.dateAdded * 1000);
}
let creation = null;
if (torrent.dateCreated) {
creation = new Date(torrent.dateCreated * 1000);
}
const VALUE_NOT_AVAILABLE = (
<span className="not-available">
<Trans id="torrents.details.general.none" />
@@ -57,14 +47,14 @@ const TorrentGeneralInfo: FC = observer(() => {
<Trans id="torrents.details.general.date.added" />
</td>
<td className="torrent-details__detail__value">
{dateAdded
? `${i18n.date(dateAdded, {
{torrent.dateAdded > 0
? i18n.date(new Date(torrent.dateAdded * 1000), {
year: 'numeric',
month: 'long',
day: '2-digit',
hour: 'numeric',
minute: 'numeric',
})}`
})
: VALUE_NOT_AVAILABLE}
</td>
</tr>
@@ -87,6 +77,22 @@ const TorrentGeneralInfo: FC = observer(() => {
<Trans id="torrents.details.general.heading.transfer" />
</td>
</tr>
<tr className="torrent-details__detail torrent-details__detail--dateFinished">
<td className="torrent-details__detail__label">
<Trans id="torrents.details.general.date.finished" />
</td>
<td className="torrent-details__detail__value">
{torrent.dateFinished > 0
? i18n.date(new Date(torrent.dateFinished * 1000), {
year: 'numeric',
month: 'long',
day: '2-digit',
hour: 'numeric',
minute: 'numeric',
})
: VALUE_NOT_AVAILABLE}
</td>
</tr>
<tr className="torrent-details__detail torrent-details__detail--downloaded">
<td className="torrent-details__detail__label">
<Trans id="torrents.details.general.downloaded" />
@@ -136,14 +142,14 @@ const TorrentGeneralInfo: FC = observer(() => {
<Trans id="torrents.details.general.date.created" />
</td>
<td className="torrent-details__detail__value">
{creation
? `${i18n.date(creation, {
{torrent.dateCreated > 0
? i18n.date(new Date(torrent.dateCreated * 1000), {
year: 'numeric',
month: 'long',
day: '2-digit',
hour: 'numeric',
minute: 'numeric',
})}`
})
: VALUE_NOT_AVAILABLE}
</td>
</tr>
@@ -280,6 +280,7 @@
"torrents.details.general.connected": "{connected} connected of {total}",
"torrents.details.general.date.added": "Added",
"torrents.details.general.date.created": "Creation Date",
"torrents.details.general.date.finished": "Finished",
"torrents.details.general.downloaded": "Downloaded",
"torrents.details.general.free.disk.space": "Free Disk Space",
"torrents.details.general.hash": "Hash",