@@ -11,6 +11,8 @@ import {
11
11
type ShowProgressTypes ,
12
12
} from ' ~/models/list-scroll.model' ;
13
13
14
+ import { ProgressType } from ' ~/models/progress-type.model' ;
15
+ import { useExtensionSettingsStoreRefs } from ' ~/stores/settings/extension.store' ;
14
16
import { useI18n } from ' ~/utils/i18n.utils' ;
15
17
16
18
const props = defineProps ({
@@ -31,16 +33,32 @@ const props = defineProps({
31
33
32
34
const { progress, type, disabled } = toRefs (props );
33
35
36
+ const { progressType } = useExtensionSettingsStoreRefs ();
37
+
34
38
const percentage = computed (() => {
35
39
if (! progress ?.value ) return ;
40
+ if (
41
+ progressType .value === ProgressType .Season &&
42
+ ' lastAired' in progress .value &&
43
+ progress .value ?.lastAired
44
+ ) {
45
+ return Math .round (progress .value .lastAired .percentage );
46
+ }
36
47
if (! (' percentage' in progress .value )) return ;
37
48
return Math .round (progress .value ?.percentage );
38
49
});
39
50
40
51
const remaining = computed (() => {
41
52
if (! progress ?.value ) return ;
42
- if (! (' aired' in progress .value )) return ;
43
53
if (! progress .value .completed ) return ;
54
+ if (
55
+ progressType .value === ProgressType .Season &&
56
+ ' lastAired' in progress .value &&
57
+ progress .value ?.lastAired
58
+ ) {
59
+ return progress .value .lastAired .aired - progress .value .lastAired .completed ;
60
+ }
61
+ if (! (' aired' in progress .value )) return ;
44
62
return progress .value .aired - progress .value .completed ;
45
63
});
46
64
@@ -51,6 +69,32 @@ const isCount = computed(() => {
51
69
return typeof progress .value ?.aired === ' number' ;
52
70
});
53
71
72
+ const completed = computed (() => {
73
+ if (! progress ?.value ) return ' -' ;
74
+ if (
75
+ progressType .value === ProgressType .Season &&
76
+ ' lastAired' in progress .value &&
77
+ progress .value ?.lastAired
78
+ ) {
79
+ return progress .value .lastAired .completed ;
80
+ }
81
+ if (! (' completed' in progress .value )) return ' -' ;
82
+ return progress .value .completed ;
83
+ });
84
+
85
+ const aired = computed (() => {
86
+ if (! progress ?.value ) return ' -' ;
87
+ if (
88
+ progressType .value === ProgressType .Season &&
89
+ ' lastAired' in progress .value &&
90
+ progress .value ?.lastAired
91
+ ) {
92
+ return progress .value .lastAired .aired ;
93
+ }
94
+ if (! (' aired' in progress .value )) return ' -' ;
95
+ return progress .value .aired ;
96
+ });
97
+
54
98
const i18n = useI18n (' common' , ' tooltip' , ' progress' );
55
99
</script >
56
100
@@ -63,9 +107,9 @@ const i18n = useI18n('common', 'tooltip', 'progress');
63
107
<slot name =" label" >
64
108
<NFlex v-if =" progress && isCount" vertical align =" flex-end" >
65
109
<div v-if =" 'aired' in progress" >
66
- <span class =" metric" >{{ progress?. completed ?? '-' }}</span >
110
+ <span class =" metric" >{{ completed }}</span >
67
111
<span > / </span >
68
- <span class =" metric" >{{ progress?. aired ?? '-' }}</span >
112
+ <span class =" metric" >{{ aired }}</span >
69
113
<span >  ; </span >
70
114
<span >{{ i18n('episodes') }}</span >
71
115
</div >
0 commit comments