From 8c04bf245cf5482bcbd2cb2ce8d7f3ea5edde401 Mon Sep 17 00:00:00 2001 From: Jesse Chan Date: Wed, 26 May 2021 22:37:02 +0800 Subject: [PATCH] TorrentGeneralInfo: add "Last Activity" field --- .../TorrentGeneralInfo.tsx | 24 +++++++++++++++++++ client/src/javascript/i18n/strings/en.json | 4 +++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx index 1502e26b..be935ad8 100644 --- a/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx +++ b/client/src/javascript/components/modals/torrent-details-modal/TorrentGeneralInfo.tsx @@ -132,6 +132,30 @@ const TorrentGeneralInfo: FC = observer(() => { /> + + + + + + {(() => { + if (torrent.dateActive === 0) { + return VALUE_NOT_AVAILABLE; + } + + if (torrent.dateActive === -1) { + return i18n._('torrents.details.general.date.active.now'); + } + + return i18n.date(new Date(torrent.dateActive * 1000), { + year: 'numeric', + month: 'long', + day: '2-digit', + hour: 'numeric', + minute: 'numeric', + }); + })()} + + diff --git a/client/src/javascript/i18n/strings/en.json b/client/src/javascript/i18n/strings/en.json index aed3eb45..ce61946c 100644 --- a/client/src/javascript/i18n/strings/en.json +++ b/client/src/javascript/i18n/strings/en.json @@ -278,6 +278,8 @@ "torrents.details.files.loading": "Loading file detail...", "torrents.details.general.comment": "Comment", "torrents.details.general.connected": "{connected} connected of {total}", + "torrents.details.general.date.active": "Last Activity", + "torrents.details.general.date.active.now": "Now", "torrents.details.general.date.added": "Added", "torrents.details.general.date.created": "Created", "torrents.details.general.date.finished": "Finished", @@ -386,4 +388,4 @@ "unit.time.second": "s", "unit.time.week": "wk", "unit.time.year": "yr" -} +} \ No newline at end of file