@@ -11,17 +11,15 @@ import { computed, type PropType, toRefs } from 'vue';
11
11
12
12
import type { RatingItem } from ' ~/models/rating.model' ;
13
13
14
- import IconIMDb from ' ~/components/icons/IconIMDb.vue' ;
15
- import IconMyAnimeList from ' ~/components/icons/IconMyAnimeList.vue' ;
16
- import IconSimkl from ' ~/components/icons/IconSimkl.vue' ;
17
- import IconTrakt from ' ~/components/icons/IconTrakt.vue' ;
18
14
import PanelStatistics from ' ~/components/views/panel/PanelStatistics.vue' ;
19
15
import { ResolveExternalLinks } from ' ~/settings/external.links' ;
20
16
import { useRatingsStore } from ' ~/stores/data/ratings.store' ;
21
17
22
18
import { useShowStore } from ' ~/stores/data/show.store' ;
19
+ import { useSimklStore } from ' ~/stores/data/simkl.store' ;
23
20
import { useExtensionSettingsStoreRefs } from ' ~/stores/settings/extension.store' ;
24
21
import { useI18n } from ' ~/utils/i18n.utils' ;
22
+ import { DataSource } from ' ~/utils/icon.utils' ;
25
23
26
24
const i18n = useI18n (' panel' , ' statistics' );
27
25
@@ -146,36 +144,46 @@ const rating = computed(() => {
146
144
return show ?.value ?.rating ;
147
145
});
148
146
149
- const ratings = computed <RatingItem []>(
150
- () =>
151
- [
152
- {
153
- name: i18n (' trakt' , ' common' , ' source' , ' name' ),
154
- icon: IconTrakt ,
155
- rating: {
156
- votes: votes .value ,
157
- rating: rating .value ,
158
- url: ratingUrl .value ,
159
- loading: ratingLoading .value ,
160
- },
161
- },
162
- {
163
- name: i18n (' simkl' , ' common' , ' source' , ' name' ),
164
- icon: IconSimkl ,
165
- rating: { votes: 125846 , rating: 5.2 },
166
- },
167
- {
168
- name: i18n (' mal' , ' common' , ' source' , ' name' ),
169
- icon: IconMyAnimeList ,
170
- rating: { votes: 250 , rating: 2.45 },
171
- },
172
- {
173
- name: i18n (' imdb' , ' common' , ' source' , ' name' ),
174
- icon: IconIMDb ,
175
- rating: { votes: 326579 , rating: 8.45 },
147
+ const { getShowOrAnime, getShowOrAnimeLoading } = useSimklStore ();
148
+
149
+ const simklShow = computed (() => {
150
+ if (! show ?.value ?.ids ?.imdb ) return ;
151
+ return getShowOrAnime (show .value .ids .imdb ).value ;
152
+ });
153
+
154
+ const simklShowLoading = computed (() => {
155
+ if (! show ?.value ?.ids ?.imdb ) return ;
156
+ return getShowOrAnimeLoading (show .value .ids .imdb ).value ;
157
+ });
158
+
159
+ const ratings = computed <RatingItem []>(() => {
160
+ const _ratings: RatingItem [] = [];
161
+ _ratings .push ({
162
+ name: i18n (' trakt' , ' common' , ' source' , ' name' ),
163
+ icon: DataSource .Trakt ,
164
+ rating: {
165
+ votes: votes .value ,
166
+ rating: rating .value ,
167
+ url: ratingUrl .value ,
168
+ loading: ratingLoading .value ,
169
+ },
170
+ });
171
+ if (! simklShow .value ?.ratings ) return _ratings ;
172
+ if (mode .value !== ' show' ) return _ratings ;
173
+ Object .entries (simklShow .value .ratings ).forEach (([key , value ]) => {
174
+ _ratings .push ({
175
+ name: i18n (key , ' common' , ' source' , ' name' ),
176
+ icon: key ,
177
+ rating: {
178
+ votes: value .votes ,
179
+ rating: value .rating ,
180
+ loading: simklShowLoading .value ,
176
181
},
177
- ] satisfies RatingItem [],
178
- );
182
+ });
183
+ });
184
+
185
+ return _ratings ;
186
+ });
179
187
180
188
const onScoreEdit = async (_score : TraktSyncRatingValue ) => {
181
189
if (! show ?.value ?.ids ?.trakt ) return ;
0 commit comments