|
24 | 24 | <script lang="ts">
|
25 | 25 | import Button from '$lib/components/elements/buttons/button.svelte';
|
26 | 26 | import { AssetTypeEnum, type SmartSearchDto, type MetadataSearchDto } from '@immich/sdk';
|
27 |
| - import { createEventDispatcher } from 'svelte'; |
28 |
| - import { fly } from 'svelte/transition'; |
29 | 27 | import SearchPeopleSection from './search-people-section.svelte';
|
30 | 28 | import SearchLocationSection from './search-location-section.svelte';
|
31 | 29 | import SearchCameraSection, { type SearchCameraFilter } from './search-camera-section.svelte';
|
|
35 | 33 | import SearchDisplaySection from './search-display-section.svelte';
|
36 | 34 | import SearchTextSection from './search-text-section.svelte';
|
37 | 35 | import { t } from 'svelte-i18n';
|
| 36 | + import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte'; |
| 37 | + import { mdiTune } from '@mdi/js'; |
| 38 | + import { generateId } from '$lib/utils/generate-id'; |
38 | 39 |
|
39 | 40 | export let searchQuery: MetadataSearchDto | SmartSearchDto;
|
| 41 | + export let onClose: () => void; |
| 42 | + export let onSearch: (search: SmartSearchDto | MetadataSearchDto) => void; |
40 | 43 |
|
41 | 44 | const parseOptionalDate = (dateString?: string) => (dateString ? parseUtcDate(dateString) : undefined);
|
42 | 45 | const toStartOfDayDate = (dateString: string) => parseUtcDate(dateString)?.startOf('day').toISODate() || undefined;
|
43 |
| - const dispatch = createEventDispatcher<{ search: SmartSearchDto | MetadataSearchDto }>(); |
| 46 | + const formId = generateId(); |
44 | 47 |
|
45 | 48 | // combobox and all the search components have terrible support for value | null so we use empty string instead.
|
46 | 49 | function withNullAsUndefined<T>(value: T | null) {
|
|
113 | 116 | type,
|
114 | 117 | };
|
115 | 118 |
|
116 |
| - dispatch('search', payload); |
| 119 | + onSearch(payload); |
117 | 120 | };
|
118 | 121 | </script>
|
119 | 122 |
|
120 |
| -<div |
121 |
| - transition:fly={{ y: 25, duration: 250 }} |
122 |
| - class="absolute w-full rounded-b-3xl border-2 border-t-0 border-gray-200 bg-white shadow-2xl dark:border-gray-700 dark:bg-immich-dark-gray dark:text-gray-300" |
123 |
| -> |
124 |
| - <form |
125 |
| - id="search-filter-form" |
126 |
| - autocomplete="off" |
127 |
| - on:submit|preventDefault={search} |
128 |
| - on:reset|preventDefault={resetForm} |
129 |
| - > |
130 |
| - <div class="px-4 sm:px-6 py-4 space-y-10 max-h-[calc(100dvh-12rem)] overflow-y-auto immich-scrollbar" tabindex="-1"> |
| 123 | +<FullScreenModal icon={mdiTune} width="wide" title={$t('search_options')} {onClose}> |
| 124 | + <form id={formId} autocomplete="off" on:submit|preventDefault={search} on:reset|preventDefault={resetForm}> |
| 125 | + <div class="space-y-10 pb-10" tabindex="-1"> |
131 | 126 | <!-- PEOPLE -->
|
132 | 127 | <SearchPeopleSection bind:selectedPeople={filter.personIds} />
|
133 | 128 |
|
|
143 | 138 | <!-- DATE RANGE -->
|
144 | 139 | <SearchDateSection bind:filters={filter.date} />
|
145 | 140 |
|
146 |
| - <div class="grid md:grid-cols-2 gap-x-5 gap-y-8"> |
| 141 | + <div class="grid md:grid-cols-2 gap-x-5 gap-y-10"> |
147 | 142 | <!-- MEDIA TYPE -->
|
148 | 143 | <SearchMediaSection bind:filteredMedia={filter.mediaType} />
|
149 | 144 |
|
150 | 145 | <!-- DISPLAY OPTIONS -->
|
151 | 146 | <SearchDisplaySection bind:filters={filter.display} />
|
152 | 147 | </div>
|
153 | 148 | </div>
|
154 |
| - |
155 |
| - <div |
156 |
| - id="button-row" |
157 |
| - class="flex justify-end gap-4 border-t dark:border-gray-800 dark:bg-immich-dark-gray px-4 sm:py-6 py-4 mt-2 rounded-b-3xl" |
158 |
| - > |
159 |
| - <Button type="reset" color="gray">{$t('clear_all')}</Button> |
160 |
| - <Button type="submit">{$t('search')}</Button> |
161 |
| - </div> |
162 | 149 | </form>
|
163 |
| -</div> |
| 150 | + |
| 151 | + <svelte:fragment slot="sticky-bottom"> |
| 152 | + <Button type="reset" color="gray" fullwidth form={formId}>{$t('clear_all')}</Button> |
| 153 | + <Button type="submit" fullwidth form={formId}>{$t('search')}</Button> |
| 154 | + </svelte:fragment> |
| 155 | +</FullScreenModal> |
0 commit comments