| @@ -1,21 +1,13 @@ |
| 1 | <script setup lang="ts"> |
1 | <script setup lang="ts"> |
| 2 | import { |
2 | import { |
| 3 | Globe, |
| |
| 4 | List, |
| |
| 5 | LocateOff, |
| |
| 6 | Regex, |
| |
| 7 | Settings, |
3 | Settings, |
| 8 | TextAlignStart, |
| |
| 9 | X |
4 | X |
| 10 | } from 'lucide-vue-next' |
5 | } from 'lucide-vue-next' |
| 11 | import { ref } from 'vue' |
6 | import { ref } from 'vue' |
| 12 | import { searchMode, showDetailedList } from '../../searchState' |
| |
| 13 | import type { SearchSortMode } from '../../searchState' |
| |
| 14 | |
7 | |
| 15 | defineProps<{ |
8 | defineProps<{ |
| 16 | filterText: string |
9 | filterText: string |
| 17 | searchLoading: boolean |
10 | searchLoading: boolean |
| 18 | disableDetailedView: boolean |
| |
| 19 | showSettingsPopup: boolean |
11 | showSettingsPopup: boolean |
| 20 | buttonText: string |
12 | buttonText: string |
| 21 | disableReset: boolean |
13 | disableReset: boolean |
| @@ -26,7 +18,6 @@ defineProps<{ |
| 26 | |
18 | |
| 27 | const emit = defineEmits<{ |
19 | const emit = defineEmits<{ |
| 28 | 'update:filterText': [value: string] |
20 | 'update:filterText': [value: string] |
| 29 | cycleSearchMode: [] |
| |
| 30 | resetSearch: [] |
21 | resetSearch: [] |
| 31 | searchBarClick: [event: PointerEvent] |
22 | searchBarClick: [event: PointerEvent] |
| 32 | toggleSettings: [] |
23 | toggleSettings: [] |
| @@ -37,29 +28,6 @@ const searchInput = ref<HTMLInputElement>() |
| 37 | const settingsButtonRef = ref<HTMLButtonElement>() |
28 | const settingsButtonRef = ref<HTMLButtonElement>() |
| 38 | |
29 | |
| 39 | defineExpose({ searchInput, settingsButtonRef }) |
30 | defineExpose({ searchInput, settingsButtonRef }) |
| 40 | |
| |
| 41 | function onViewDetailClick() { |
| |
| 42 | showDetailedList.value = true |
| |
| 43 | } |
| |
| 44 | |
| |
| 45 | function onViewListClick() { |
| |
| 46 | showDetailedList.value = false |
| |
| 47 | } |
| |
| 48 | |
| |
| 49 | function onExactClick() { |
| |
| 50 | if (searchMode.value === 'exact') emit('cycleSearchMode') |
| |
| 51 | else searchMode.value = 'exact' as SearchSortMode |
| |
| 52 | } |
| |
| 53 | |
| |
| 54 | function onFuzzyClick() { |
| |
| 55 | if (searchMode.value === 'fuzzy') emit('cycleSearchMode') |
| |
| 56 | else searchMode.value = 'fuzzy' as SearchSortMode |
| |
| 57 | } |
| |
| 58 | |
| |
| 59 | function onUrlClick() { |
| |
| 60 | if (searchMode.value === 'url') emit('cycleSearchMode') |
| |
| 61 | else searchMode.value = 'url' as SearchSortMode |
| |
| 62 | } |
| |
| 63 | </script> |
31 | </script> |
| 64 | |
32 | |
| 65 | <template> |
33 | <template> |
| @@ -118,58 +86,8 @@ function onUrlClick() { |
| 118 | alt="Bubba loading" |
86 | alt="Bubba loading" |
| 119 | /> |
87 | /> |
| 120 | </button> |
88 | </button> |
| 121 | <div |
89 | |
| 122 | v-if="!disableDetailedView && searchMode !== 'url'" |
90 | |
| 123 | class="view-group toolbar-group" |
| |
| 124 | > |
| |
| 125 | <button |
| |
| 126 | type="button" |
| |
| 127 | class="mode-btn" |
| |
| 128 | :class="{ 'mode-active': showDetailedList }" |
| |
| 129 | title="Detail view (Consumes more RAM)" |
| |
| 130 | @click="onViewDetailClick" |
| |
| 131 | > |
| |
| 132 | <TextAlignStart :size="18" stroke-width="2" /> |
| |
| 133 | </button> |
| |
| 134 | <button |
| |
| 135 | type="button" |
| |
| 136 | class="mode-btn" |
| |
| 137 | :class="{ 'mode-active': !showDetailedList }" |
| |
| 138 | title="List view (Consumes less RAM)" |
| |
| 139 | @click="onViewListClick" |
| |
| 140 | > |
| |
| 141 | <List :size="18" stroke-width="2" /> |
| |
| 142 | </button> |
| |
| 143 | </div> |
| |
| 144 | <div class="search-mode-group toolbar-group"> |
| |
| 145 | <button |
| |
| 146 | type="button" |
| |
| 147 | class="mode-btn" |
| |
| 148 | :class="{ 'mode-active': searchMode === 'exact' }" |
| |
| 149 | title="Exact search" |
| |
| 150 | @click="onExactClick" |
| |
| 151 | > |
| |
| 152 | <Regex :size="18" stroke-width="2" /> |
| |
| 153 | </button> |
| |
| 154 | <button |
| |
| 155 | type="button" |
| |
| 156 | class="mode-btn" |
| |
| 157 | :class="{ 'mode-active': searchMode === 'fuzzy' }" |
| |
| 158 | title="Fuzzy search" |
| |
| 159 | @click="onFuzzyClick" |
| |
| 160 | > |
| |
| 161 | <LocateOff :size="18" stroke-width="2" /> |
| |
| 162 | </button> |
| |
| 163 | <button |
| |
| 164 | type="button" |
| |
| 165 | class="mode-btn" |
| |
| 166 | :class="{ 'mode-active': searchMode === 'url' }" |
| |
| 167 | title="URL search" |
| |
| 168 | @click="onUrlClick" |
| |
| 169 | > |
| |
| 170 | <Globe :size="18" stroke-width="2" /> |
| |
| 171 | </button> |
| |
| 172 | </div> |
| |
| 173 | <button |
91 | <button |
| 174 | ref="settingsButtonRef" |
92 | ref="settingsButtonRef" |
| 175 | type="button" |
93 | type="button" |
| @@ -291,8 +209,7 @@ function onUrlClick() { |
| 291 | padding: 8px; |
209 | padding: 8px; |
| 292 | } |
210 | } |
| 293 | |
211 | |
| 294 | .search-actions button:not([disabled]):hover, |
212 | .search-actions button:not([disabled]):hover { |
| 295 | .toggle-layout-button.detailed-list { |
| |
| 296 | color: var(--vp-c-brand-1); |
213 | color: var(--vp-c-brand-1); |
| 297 | } |
214 | } |
| 298 | |
215 | |
| @@ -300,14 +217,7 @@ function onUrlClick() { |
| 300 | opacity: 0.37; |
217 | opacity: 0.37; |
| 301 | } |
218 | } |
| 302 | |
219 | |
| 303 | .toolbar-group + .toolbar-group { |
| |
| 304 | margin-left: 6px; |
| |
| 305 | } |
| |
| 306 | |
220 | |
| 307 | .search-mode-group, |
| |
| 308 | .view-group { |
| |
| 309 | display: none; |
| |
| 310 | } |
| |
| 311 | |
221 | |
| 312 | .mode-btn { |
222 | .mode-btn { |
| 313 | display: flex; |
223 | display: flex; |
| @@ -322,10 +232,6 @@ function onUrlClick() { |
| 322 | border-radius: 0; |
232 | border-radius: 0; |
| 323 | } |
233 | } |
| 324 | |
234 | |
| 325 | .mode-btn + .mode-btn { |
| |
| 326 | border-left: 1px solid var(--vp-c-divider); |
| |
| 327 | } |
| |
| 328 | |
| |
| 329 | .mode-btn:hover { |
235 | .mode-btn:hover { |
| 330 | color: var(--vp-c-text-1); |
236 | color: var(--vp-c-text-1); |
| 331 | background: var(--vp-c-default-soft); |
237 | background: var(--vp-c-default-soft); |
| @@ -336,11 +242,7 @@ function onUrlClick() { |
| 336 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); |
242 | background: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); |
| 337 | } |
243 | } |
| 338 | |
244 | |
| 339 | .exact-match-button.exact-match-active { |
245 | |
| 340 | color: var(--vp-c-brand-1); |
| |
| 341 | background-color: color-mix(in srgb, var(--vp-c-brand-1) 10%, transparent); |
| |
| 342 | border-radius: 4px; |
| |
| 343 | } |
| |
| 344 | |
246 | |
| 345 | .search-actions .settings-toggle-btn, |
247 | .search-actions .settings-toggle-btn, |
| 346 | .search-actions .clear-button { |
248 | .search-actions .clear-button { |
| @@ -393,13 +295,16 @@ html.effects-disabled .clear-button:active { |
| 393 | display: none; |
295 | display: none; |
| 394 | align-items: center; |
296 | align-items: center; |
| 395 | justify-content: center; |
297 | justify-content: center; |
| 396 | padding: 0; |
298 | padding: 8px; |
| 397 | border: none; |
299 | border: none; |
| 398 | background: transparent; |
300 | background: transparent; |
| 399 | color: var(--vp-c-text-1); |
301 | color: var(--vp-c-text-1); |
| 400 | cursor: pointer; |
302 | cursor: pointer; |
| 401 | width: 24px; |
303 | transition: color 0.15s; |
| 402 | height: 24px; |
304 | } |
| |
305 | |
| |
306 | .back-button:hover { |
| |
307 | color: var(--vp-c-brand-1); |
| 403 | } |
308 | } |
| 404 | |
309 | |
| 405 | @media (max-width: 767px) { |
310 | @media (max-width: 767px) { |