@@ -3,16 +3,19 @@ import { NFlex, NIcon, NInput, NSelect, type SelectOption } from 'naive-ui';
3
3
4
4
import { type Component , computed , defineProps , h , ref } from ' vue' ;
5
5
6
+ import ButtonLinkExternal from ' ~/components/common/buttons/ButtonLinkExternal.vue' ;
6
7
import NavbarPageSizeSelect from ' ~/components/common/navbar/NavbarPageSizeSelect.vue' ;
7
8
import IconLoop from ' ~/components/icons/IconLoop.vue' ;
8
9
10
+ import { ResolveExternalLinks } from ' ~/settings/external.links' ;
9
11
import {
10
12
type ListEntity ,
11
13
ListType ,
12
14
useListsStore ,
13
15
useListsStoreRefs ,
14
16
useListStoreRefs ,
15
17
} from ' ~/stores/data/list.store' ;
18
+ import { useUserSettingsStoreRefs } from ' ~/stores/settings/user.store' ;
16
19
import { useI18n } from ' ~/utils' ;
17
20
import { useDebouncedSearch , watchUserChange } from ' ~/utils/store.utils' ;
18
21
@@ -23,6 +26,23 @@ const { pageSize, searchList } = useListStoreRefs();
23
26
const { listsLoading, lists, activeList } = useListsStoreRefs ();
24
27
const { fetchLists, clearState, getIcon } = useListsStore ();
25
28
29
+ const { user } = useUserSettingsStoreRefs ();
30
+
31
+ const external = computed (() => {
32
+ switch (activeList .value .type ) {
33
+ case ListType .Watchlist :
34
+ return ResolveExternalLinks .trakt .watchlist (user .value );
35
+ case ListType .Favorites :
36
+ return ResolveExternalLinks .trakt .favorites (user .value );
37
+ case ListType .Collection :
38
+ return ResolveExternalLinks .trakt .collection (user .value , activeList .value .scope );
39
+ case ListType .List :
40
+ return ResolveExternalLinks .trakt .list (user .value , activeList .value .name );
41
+ default :
42
+ return ' ' ;
43
+ }
44
+ });
45
+
26
46
type ListOption = SelectOption & { source: ListEntity ; icon: Component };
27
47
const listOptions = computed <ListOption []>(() =>
28
48
lists .value .map ((list , i ) => ({
@@ -109,6 +129,7 @@ const renderTag = ({ option }: { option: SelectOption }) => option.label?.toStri
109
129
</template >
110
130
</NInput >
111
131
<NavbarPageSizeSelect v-model:page-size =" pageSize" :parent-element =" parentElement" />
132
+ <ButtonLinkExternal :href =" external" :label =" i18n('list', 'common', 'link')" />
112
133
</NFlex >
113
134
</template >
114
135
@@ -118,7 +139,7 @@ const renderTag = ({ option }: { option: SelectOption }) => option.label?.toStri
118
139
padding : 0 0.5rem ;
119
140
120
141
.list-select {
121
- flex : 0 1 40 % ;
142
+ flex : 0 1 33 % ;
122
143
}
123
144
124
145
.search-input {
0 commit comments