1
1
<script setup lang="ts">
2
2
import { deCapitalise } from ' @dvcol/common-utils/common/string' ;
3
-
4
- import {
5
- TraktRatingType ,
6
- type TraktSyncRatingValue ,
7
- } from ' @dvcol/trakt-http-client/models' ;
8
3
import { NFlex , NSkeleton } from ' naive-ui' ;
9
4
import { computed , onMounted , toRefs , watch } from ' vue' ;
10
5
11
6
import TitleLink from ' ~/components/common/buttons/TitleLink.vue' ;
12
7
import MoviePanelButtons from ' ~/components/views/panel/MoviePanelButtons.vue' ;
13
8
import MoviePanelDetails from ' ~/components/views/panel/MoviePanelDetails.vue' ;
14
9
import MoviePanelOverview from ' ~/components/views/panel/MoviePanelOverview.vue' ;
10
+ import PanelMovieStatistics from ' ~/components/views/panel/PanelMovieStatistics.vue' ;
15
11
import PanelPoster from ' ~/components/views/panel/PanelPoster.vue' ;
16
- import PanelStatistics from ' ~/components/views/panel/PanelStatistics.vue' ;
17
12
import {
18
13
PanelButtonsOption ,
19
14
type PanelButtonsOptions ,
@@ -30,10 +25,8 @@ import {
30
25
useListStore ,
31
26
} from ' ~/stores/data/list.store' ;
32
27
import { useMovieStore , useMovieStoreRefs } from ' ~/stores/data/movie.store' ;
33
- import { useRatingsStore } from ' ~/stores/data/ratings.store' ;
34
28
import { useWatchingStore , useWatchingStoreRefs } from ' ~/stores/data/watching.store' ;
35
29
import { useExtensionSettingsStoreRefs } from ' ~/stores/settings/extension.store' ;
36
- import { useLinksStore } from ' ~/stores/settings/links.store' ;
37
30
import { useI18n } from ' ~/utils/i18n.utils' ;
38
31
import {
39
32
isWatchingMovie ,
@@ -103,7 +96,7 @@ const {
103
96
fetchAll,
104
97
} = useListStore ();
105
98
106
- const { loadLists, loadListsPageSize, enableRatings } = useExtensionSettingsStoreRefs ();
99
+ const { loadLists, loadListsPageSize } = useExtensionSettingsStoreRefs ();
107
100
108
101
const shouldFetchLists = computed (() => {
109
102
if (! myLists .value ?.length ) return false ;
@@ -256,48 +249,8 @@ const onCheckin = async (cancel: boolean) => {
256
249
await fetchMovieWatched (true );
257
250
};
258
251
259
- const { openTab } = useLinksStore ();
260
-
261
- const { loadRatings, getRatings, getLoading, addRating, removeRating } =
262
- useRatingsStore ();
263
-
264
- const scoreLoading = computed (() => getLoading (TraktRatingType .Movies ));
265
-
266
- const score = computed (() => {
267
- if (! movieId .value ) return ;
268
- return getRatings (TraktRatingType .Movies , movieId .value );
269
- });
270
-
271
- const ratingUrl = computed (() => {
272
- if (! movie .value ?.ids ?.slug ) return ;
273
- return ResolveExternalLinks .trakt .item ({
274
- type: ' movies' ,
275
- slug: movie .value .ids .slug ,
276
- suffix: ' /stats' ,
277
- });
278
- });
279
-
280
- const onScoreEdit = async (_score : TraktSyncRatingValue ) => {
281
- if (! movie .value ?.ids ?.trakt ) return ;
282
- return (_score ? addRating : removeRating )(TraktRatingType .Movies , {
283
- movies: [
284
- {
285
- ids: movie .value .ids ,
286
- rating: _score ,
287
- },
288
- ],
289
- });
290
- };
291
-
292
252
onMounted (() => {
293
- watch (
294
- movieId ,
295
- id => {
296
- fetchMovie (id );
297
- if (enableRatings .value ) loadRatings (TraktRatingType .Movies , id );
298
- },
299
- { immediate: true },
300
- );
253
+ watch (movieId , id => fetchMovie (id ), { immediate: true });
301
254
fetchMovieWatched ();
302
255
fetchMovieCollected ();
303
256
@@ -321,7 +274,6 @@ onMounted(() => {
321
274
class =" show-title"
322
275
:href =" titleUrl"
323
276
:title =" i18n('open_in_trakt', 'common', 'tooltip')"
324
- @on-click =" openTab"
325
277
>
326
278
{{ title }}
327
279
</TitleLink >
@@ -332,17 +284,9 @@ onMounted(() => {
332
284
round
333
285
/>
334
286
335
- <PanelStatistics
336
- :rating =" movie?.rating"
337
- :votes =" movie?.votes"
338
- :score =" score?.rating"
339
- :loading-score =" scoreLoading"
340
- :loading-rating =" movieLoading"
341
- :url =" ratingUrl"
342
- @on-score-edit =" onScoreEdit"
343
- >
344
- <PanelPoster :tmdb =" movie?.ids.tmdb" mode =" movie" />
345
- </PanelStatistics >
287
+ <PanelMovieStatistics :movie =" movie" :movie-loading =" movieLoading" >
288
+ <PanelPoster :tmdb =" movie?.ids.tmdb" mode =" movie" :link =" titleUrl" />
289
+ </PanelMovieStatistics >
346
290
347
291
<MoviePanelDetails
348
292
:movie =" movie"
0 commit comments