1
1
<script setup lang="ts">
2
- import { NEllipsis , NFlex , NSkeleton , NTag } from ' naive-ui' ;
2
+ import { NEllipsis , NFlex , NProgress , NSkeleton , NTag } from ' naive-ui' ;
3
3
4
4
import { computed , defineProps , type PropType , toRefs } from ' vue' ;
5
5
6
6
import PosterPlaceholder from ' ~/assets/images/poster-placholder.webp' ;
7
7
import { type ListScrollItem } from ' ~/models/list-scroll.model' ;
8
8
9
+ import { useShowStore } from ' ~/stores/data/show.store' ;
9
10
import { useI18n } from ' ~/utils' ;
11
+ import { deCapitalise } from ' ~/utils/string.utils' ;
10
12
11
13
const i18n = useI18n (' list-item-panel' );
12
14
@@ -28,6 +30,11 @@ const props = defineProps({
28
30
type: Boolean ,
29
31
required: false ,
30
32
},
33
+ showProgress: {
34
+ type: Boolean ,
35
+ required: false ,
36
+ default: false ,
37
+ },
31
38
});
32
39
33
40
const { item, hideDate } = toRefs (props );
@@ -36,9 +43,9 @@ const type = computed(() =>
36
43
item .value .type ? i18n (item .value .type , ' common' , ' media' , ' type' ) : item .value .type ,
37
44
);
38
45
39
- const title = computed (() => item .value .title );
46
+ const title = computed (() => deCapitalise ( item .value .title ) );
40
47
41
- const content = computed (() => item .value .content );
48
+ const content = computed (() => deCapitalise ( item .value .content ) );
42
49
43
50
const date = computed (() => {
44
51
if (hideDate .value ) return ;
@@ -56,6 +63,17 @@ const tags = computed(
56
63
return { ... tag , label: i18n (tag .label , ... tag .i18n ) };
57
64
}),
58
65
);
66
+
67
+ const { getShowProgress } = useShowStore ();
68
+
69
+ const progress = computed (() => {
70
+ if (item ?.value ?.progress ) return item .value .progress ;
71
+ if (item ?.value ?.progressRef ) return item .value .progressRef .value ;
72
+ if (! item ?.value ?.getProgressQuery ) return ;
73
+ const id = item .value .getProgressQuery ();
74
+ if (! id ) return ;
75
+ return getShowProgress (id ).value ;
76
+ });
59
77
</script >
60
78
61
79
<template >
@@ -99,6 +117,19 @@ const tags = computed(
99
117
</NTag >
100
118
</template >
101
119
</NFlex >
120
+ <NProgress
121
+ v-if =" showProgress"
122
+ :data-percentage =" progress?.percentage"
123
+ :data-last =" progress?.last_episode"
124
+ :data-next =" progress?.next_episode"
125
+ class =" progress"
126
+ :theme-overrides =" {
127
+ railHeight: 'var(--rail-height)',
128
+ }"
129
+ :percentage =" progress?.percentage ?? 0"
130
+ :show-indicator =" false"
131
+ color =" var(--trakt-red-dark)"
132
+ />
102
133
</NFlex >
103
134
</template >
104
135
@@ -136,5 +167,11 @@ const tags = computed(
136
167
width : fit-content ;
137
168
}
138
169
}
170
+
171
+ .progress {
172
+ margin-top : 0.75rem ;
173
+
174
+ --rail-height : 4px ;
175
+ }
139
176
}
140
177
</style >
0 commit comments