@@ -13,6 +13,7 @@ import { type Component, computed, defineProps, h, ref } from 'vue';
13
13
14
14
import type { TraktSearchType } from ' ~/models/trakt/trakt-search.model' ;
15
15
16
+ import NavbarPageSizeSelect from ' ~/components/common/navbar/NavbarPageSizeSelect.vue' ;
16
17
import IconAccount from ' ~/components/icons/IconAccount.vue' ;
17
18
import IconChevronDown from ' ~/components/icons/IconChevronDownSmall.vue' ;
18
19
import IconChevronUp from ' ~/components/icons/IconChevronUpSmall.vue' ;
@@ -22,20 +23,18 @@ import IconMovie from '~/components/icons/IconMovie.vue';
22
23
import IconScreen from ' ~/components/icons/IconScreen.vue' ;
23
24
import IconYoutube from ' ~/components/icons/IconYoutube.vue' ;
24
25
26
+ import { SupportedSearchType , useSearchStoreRefs } from ' ~/stores/data/search.store' ;
25
27
import { useI18n } from ' ~/utils' ;
26
28
import { debounce } from ' ~/utils/debounce.utils' ;
27
29
import { useDebouncedSearch } from ' ~/utils/store.utils' ;
28
30
29
31
const i18n = useI18n (' navbar' , ' search' );
30
32
31
- const DefaultSearchType : TraktSearchType [] = [ ' episode ' , ' show ' , ' movie ' , ' person ' ] ;
33
+ const { search, types, query, pageSize, loading } = useSearchStoreRefs () ;
32
34
33
- const search = ref (' ' );
34
- const escape = ref (false );
35
- const types = ref <TraktSearchType []>(DefaultSearchType );
36
- const typeOptions = ref <TraktSearchType []>(DefaultSearchType );
35
+ const typeOptions = ref <TraktSearchType []>(SupportedSearchType );
37
36
38
- const debouncedSearch = useDebouncedSearch (search );
37
+ const debouncedSearch = useDebouncedSearch (search , 800 );
39
38
40
39
defineProps ({
41
40
parentElement: {
@@ -155,8 +154,7 @@ const hideTooltip = () => {
155
154
placement =" bottom"
156
155
trigger =" focus"
157
156
:show-arrow =" false"
158
- ò
159
- :disabled =" !escape"
157
+ :disabled =" !query"
160
158
:delay =" 100"
161
159
:to =" parentElement"
162
160
@mouseenter =" showTooltip()"
@@ -166,13 +164,15 @@ const hideTooltip = () => {
166
164
<NFlex class =" list" vertical >
167
165
<NFlex v-for =" { key, value } in specials" :key =" key" :cols =" 2" :wrap =" false" >
168
166
<span class =" value" >{{ value }}</span >
169
- <span >{{ i18n(` tooltip_${ key }` ) }}</span >
167
+ <span >{{ i18n(' tooltip_' + key ) }}</span >
170
168
</NFlex >
171
169
</NFlex >
172
170
<template #trigger >
173
171
<NInput
174
172
v-model:value =" debouncedSearch"
175
173
class =" search-input"
174
+ :loading =" loading"
175
+ :disabled =" loading"
176
176
:placeholder =" i18n('search', 'navbar')"
177
177
autosize
178
178
clearable
@@ -184,8 +184,10 @@ const hideTooltip = () => {
184
184
</template >
185
185
</NTooltip >
186
186
187
+ <NavbarPageSizeSelect v-model:page-size =" pageSize" :parent-element =" parentElement" />
187
188
<NSwitch
188
- v-model:value =" escape"
189
+ v-if =" false"
190
+ v-model:value =" query"
189
191
class =" search-switch"
190
192
:theme-overrides =" {
191
193
buttonColor: 'var(--search-switch-button-color)',
0 commit comments