diff --git a/src/components/TorrentDetail/Tabs/Info.vue b/src/components/TorrentDetail/Tabs/Info.vue index a65da52b..52daf2a8 100644 --- a/src/components/TorrentDetail/Tabs/Info.vue +++ b/src/components/TorrentDetail/Tabs/Info.vue @@ -44,6 +44,15 @@ {{ torrent.size | getDataUnit(1) }} + + + {{ $t("torrent.timeActive") | titleCase }} + + + {{ torrent.time_active }} + {{ `(${$t("torrent.seededFor")} ${torrent.seeding_time})` }} + + {{ $t('torrent.downloaded') | titleCase }} diff --git a/src/lang/en.js b/src/lang/en.js index 22897c66..edf0a3c3 100644 --- a/src/lang/en.js +++ b/src/lang/en.js @@ -57,7 +57,9 @@ const locale = { created: 'created by', comments: 'comments', uploadedSession: 'Uploaded Session', - torrentTitle: 'Torrent Title' + torrentTitle: 'Torrent Title', + timeActive: 'Time Active', + seededFor: 'seeded for' }, /** Navbar */ navbar: { diff --git a/src/models/Torrent.js b/src/models/Torrent.js index ba4874cb..d81ee9cd 100644 --- a/src/models/Torrent.js +++ b/src/models/Torrent.js @@ -1,3 +1,8 @@ +import dayjs from 'dayjs' +import duration from 'dayjs/plugin/duration' + +dayjs.extend(duration) + export default class Torrent { constructor(data) { this.name = data.name @@ -32,6 +37,8 @@ export default class Torrent { this.availability = Math.round(data.availability * 100) / 100 this.forced = data.state.includes('forced') this.magnet = data.magnet_uri + this.time_active = dayjs.duration(data.time_active, 'seconds').format('D[d] H[h] m[m] s[s]') + this.seeding_time = data.seeding_time > 0 ? dayjs.duration(data.seeding_time, 'seconds').format('D[d] H[h] m[m] s[s]') : null Object.freeze(this) }