@@ -4,13 +4,15 @@ import { computed, type PropType, toRefs } from 'vue';
4
4
import type { TagLink } from ' ~/models/tag.model' ;
5
5
import type { TraktApiIds } from ' ~/models/trakt/trakt-id.model' ;
6
6
7
+ import IconExternalLinkRounded from ' ~/components/icons/IconExternalLinkRounded.vue' ;
7
8
import IconIMDb from ' ~/components/icons/IconIMDb.vue' ;
8
9
import IconTMDb from ' ~/components/icons/IconTMDb.vue' ;
9
10
import IconTVDb from ' ~/components/icons/IconTVDb.vue' ;
10
11
import IconTrakt from ' ~/components/icons/IconTrakt.vue' ;
11
12
import PanelDetail from ' ~/components/views/panel/PanelDetail.vue' ;
12
13
13
14
import { ResolveExternalLinks } from ' ~/settings/external.links' ;
15
+ import { resolveLinkUrl , useLinksStore } from ' ~/stores/settings/links.store' ;
14
16
import { useI18n } from ' ~/utils' ;
15
17
16
18
const props = defineProps ({
@@ -31,9 +33,17 @@ const props = defineProps({
31
33
type: Number ,
32
34
required: false ,
33
35
},
36
+ alias: {
37
+ type: String ,
38
+ required: false ,
39
+ },
40
+ title: {
41
+ type: String ,
42
+ required: false ,
43
+ },
34
44
});
35
45
36
- const { ids, mode, season, episode } = toRefs (props );
46
+ const { ids, mode, season, episode, alias, title } = toRefs (props );
37
47
38
48
const i18n = useI18n (' panel' , ' detail' );
39
49
@@ -46,6 +56,24 @@ const labelKey = computed(() => {
46
56
};
47
57
});
48
58
59
+ const { getLinks } = useLinksStore ();
60
+
61
+ const customLinksTemplate = getLinks (mode );
62
+ const customLinks = computed (() => {
63
+ if (! customLinksTemplate .value ) return ;
64
+ return customLinksTemplate .value .map (link => ({
65
+ ... link ,
66
+ url: resolveLinkUrl (link .url , {
67
+ ... ids ?.value ,
68
+ alias: alias ?.value ,
69
+ season: season ?.value ,
70
+ episode: episode ?.value ,
71
+ title: title ?.value ,
72
+ }),
73
+ icon: IconExternalLinkRounded ,
74
+ }));
75
+ });
76
+
49
77
const links = computed (() => {
50
78
if (! ids ?.value ) return ;
51
79
const _links: TagLink [] = [];
@@ -112,6 +140,7 @@ const links = computed(() => {
112
140
},
113
141
});
114
142
}
143
+ if (customLinks .value ) _links .push (... customLinks .value );
115
144
return _links ;
116
145
});
117
146
</script >
0 commit comments