@@ -9,11 +9,18 @@ import type {
9
9
TraktShowExtended ,
10
10
} from ' @dvcol/trakt-http-client/models' ;
11
11
12
+ import type {
13
+ EpisodeProgress ,
14
+ SeasonProgress ,
15
+ ShowProgress ,
16
+ } from ' ~/models/list-scroll.model' ;
17
+
12
18
import TextField from ' ~/components/common/typography/TextField.vue' ;
13
19
import PanelAlias from ' ~/components/views/panel/PanelAlias.vue' ;
14
20
15
21
import PanelLinks from ' ~/components/views/panel/PanelLinks.vue' ;
16
22
import { useLinksStore } from ' ~/stores/settings/links.store' ;
23
+ import { shortTime } from ' ~/utils/date.utils' ;
17
24
import { useI18n } from ' ~/utils/i18n.utils' ;
18
25
19
26
const props = defineProps ({
@@ -34,9 +41,18 @@ const props = defineProps({
34
41
required: false ,
35
42
default: ' episode' ,
36
43
},
44
+ watchedProgress: {
45
+ type: Object as PropType <ShowProgress | SeasonProgress | EpisodeProgress >,
46
+ required: false ,
47
+ },
48
+ collectionProgress: {
49
+ type: Object as PropType <ShowProgress | SeasonProgress | EpisodeProgress >,
50
+ required: false ,
51
+ },
37
52
});
38
53
39
- const { mode, episode, season, show } = toRefs (props );
54
+ const { mode, episode, season, show, watchedProgress, collectionProgress } =
55
+ toRefs (props );
40
56
41
57
const i18n = useI18n (' panel' , ' detail' );
42
58
@@ -65,10 +81,7 @@ const airedDate = computed(() => {
65
81
const airedTime = computed (() => {
66
82
if (! aired .value ) return ;
67
83
if (typeof aired .value === ' string' ) return ' -' ;
68
- return aired .value .toLocaleTimeString (undefined , {
69
- hour: ' 2-digit' ,
70
- minute: ' 2-digit' ,
71
- });
84
+ return shortTime (aired .value );
72
85
});
73
86
74
87
const runtime = computed (() => {
@@ -82,6 +95,26 @@ const runtime = computed(() => {
82
95
return ` ${show .value .runtime } min ` ;
83
96
});
84
97
98
+ const watchedDate = computed (() => {
99
+ if (! watchedProgress ?.value ?.date ) return ;
100
+ return watchedProgress .value .date ;
101
+ });
102
+
103
+ const watchedTime = computed (() => {
104
+ if (! watchedProgress ?.value ?.date ) return ;
105
+ return shortTime (watchedProgress .value .date );
106
+ });
107
+
108
+ const collectionDate = computed (() => {
109
+ if (! collectionProgress ?.value ?.date ) return ;
110
+ return collectionProgress .value .date ;
111
+ });
112
+
113
+ const collectionTime = computed (() => {
114
+ if (! collectionProgress ?.value ?.date ) return ;
115
+ return shortTime (collectionProgress .value .date );
116
+ });
117
+
85
118
const genres = computed (() => {
86
119
if (! show ?.value ) return ;
87
120
return show .value ?.genres ?.map (g => ({ label: capitalizeEachWord (g ) }));
@@ -150,6 +183,29 @@ const title = computed(() =>
150
183
151
184
<template >
152
185
<NFlex size =" large" class =" container" vertical >
186
+ <NFlex vertical size =" large" >
187
+ <!-- Genres -->
188
+ <TextField
189
+ :label =" i18n('genres')"
190
+ :values =" genres"
191
+ :skeleton =" { width: '3rem' }"
192
+ array
193
+ />
194
+
195
+ <!-- links -->
196
+ <PanelLinks
197
+ :ids =" ids"
198
+ :mode =" mode"
199
+ :season =" episode?.season ?? season?.number"
200
+ :episode =" episode?.number"
201
+ :alias =" showAlias"
202
+ :title =" title"
203
+ />
204
+ </NFlex >
205
+
206
+ <!-- Show name alias -->
207
+ <PanelAlias :id =" showId" scope =" show" :placeholder =" showTitle" />
208
+
153
209
<NFlex class =" row" size =" large" >
154
210
<!-- Show Year -->
155
211
<TextField :label =" i18n('year')" :value =" year" :skeleton =" { width: '2.25rem' }" />
@@ -216,26 +272,37 @@ const title = computed(() =>
216
272
/>
217
273
</NFlex >
218
274
219
- <!-- Show name alias -->
220
- <PanelAlias :id =" showId" scope =" show" :placeholder =" showTitle" />
275
+ <NFlex v-if =" watchedDate" class =" row" size =" large" >
276
+ <!-- Watched Date -->
277
+ <TextField
278
+ :label =" i18n('watched')"
279
+ :value =" watchedDate.toLocaleDateString()"
280
+ :skeleton =" { width: '5.125rem' }"
281
+ />
221
282
222
- <NFlex class =" lists" vertical size =" large" >
223
- <!-- Genres -->
283
+ <!-- watched time -->
224
284
<TextField
225
- :label =" i18n('genres')"
226
- :values =" genres"
227
- :skeleton =" { width: '3rem' }"
228
- array
285
+ v-if =" watchedTime"
286
+ :label =" i18n('watched_time')"
287
+ :value =" watchedTime"
288
+ :skeleton =" { width: '5.125rem' }"
289
+ />
290
+ </NFlex >
291
+
292
+ <NFlex v-if =" collectionDate" class =" row" size =" large" >
293
+ <!-- Collection Date -->
294
+ <TextField
295
+ :label =" i18n('collected')"
296
+ :value =" collectionDate.toLocaleDateString()"
297
+ :skeleton =" { width: '5.125rem' }"
229
298
/>
230
299
231
- <!-- links -->
232
- <PanelLinks
233
- :ids =" ids"
234
- :mode =" mode"
235
- :season =" episode?.season ?? season?.number"
236
- :episode =" episode?.number"
237
- :alias =" showAlias"
238
- :title =" title"
300
+ <!-- Collection time -->
301
+ <TextField
302
+ v-if =" collectionTime"
303
+ :label =" i18n('collected_time')"
304
+ :value =" collectionTime"
305
+ :skeleton =" { width: '5.125rem' }"
239
306
/>
240
307
</NFlex >
241
308
</NFlex >
@@ -248,10 +315,6 @@ const title = computed(() =>
248
315
width : 100% ;
249
316
}
250
317
251
- .lists {
252
- margin : 0.25rem 0 0.5rem ;
253
- }
254
-
255
318
@media (width < 700px ) {
256
319
.row {
257
320
gap : 0.75rem 0.5rem !important ;
0 commit comments