-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(web): search box #7397
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ad62f95
refactor search suggestion handling
danieldietzler 60c025e
chore: open api
danieldietzler f0421d7
revert server changes
danieldietzler ffef819
chore: open api
danieldietzler 2d94b2c
update location filters
michelheusschen 741b493
location filter cleanup
michelheusschen fc53922
refactor people filter
michelheusschen e485386
refactor camera filter
michelheusschen da85fb2
refactor display filter
michelheusschen 758216c
cleanup
michelheusschen File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
web/src/lib/components/shared-components/search-bar/search-camera-section.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<script lang="ts" context="module"> | ||
export interface SearchCameraFilter { | ||
make?: string; | ||
model?: string; | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { SearchSuggestionType, getSearchSuggestions } from '@immich/sdk'; | ||
import Combobox, { toComboBoxOptions } from '../combobox.svelte'; | ||
|
||
export let filters: SearchCameraFilter; | ||
|
||
let makes: string[] = []; | ||
let models: string[] = []; | ||
|
||
$: makeFilter = filters.make; | ||
$: modelFilter = filters.model; | ||
$: updateMakes(modelFilter); | ||
$: updateModels(makeFilter); | ||
|
||
async function updateMakes(model?: string) { | ||
makes = await getSearchSuggestions({ | ||
$type: SearchSuggestionType.CameraMake, | ||
model, | ||
}); | ||
} | ||
|
||
async function updateModels(make?: string) { | ||
models = await getSearchSuggestions({ | ||
$type: SearchSuggestionType.CameraModel, | ||
make, | ||
}); | ||
} | ||
</script> | ||
|
||
<div id="camera-selection"> | ||
<p class="immich-form-label">CAMERA</p> | ||
|
||
<div class="grid grid-cols-[repeat(auto-fit,minmax(10rem,1fr))] gap-5 mt-1"> | ||
<div class="w-full"> | ||
<label class="text-sm text-black dark:text-white" for="search-camera-make">Make</label> | ||
<Combobox | ||
id="search-camera-make" | ||
options={toComboBoxOptions(makes)} | ||
selectedOption={makeFilter ? { label: makeFilter, value: makeFilter } : undefined} | ||
on:select={({ detail }) => (filters.make = detail?.value)} | ||
placeholder="Search camera make..." | ||
/> | ||
</div> | ||
|
||
<div class="w-full"> | ||
<label class="text-sm text-black dark:text-white" for="search-camera-model">Model</label> | ||
<Combobox | ||
id="search-camera-model" | ||
options={toComboBoxOptions(models)} | ||
selectedOption={modelFilter ? { label: modelFilter, value: modelFilter } : undefined} | ||
on:select={({ detail }) => (filters.model = detail?.value)} | ||
placeholder="Search camera model..." | ||
/> | ||
</div> | ||
</div> | ||
</div> |
37 changes: 37 additions & 0 deletions
37
web/src/lib/components/shared-components/search-bar/search-date-section.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<script lang="ts" context="module"> | ||
export interface SearchDateFilter { | ||
takenBefore?: string; | ||
takenAfter?: string; | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
export let filters: SearchDateFilter; | ||
</script> | ||
|
||
<div id="date-range-selection" class="grid grid-cols-[repeat(auto-fit,minmax(10rem,1fr))] gap-5"> | ||
<label class="immich-form-label" for="start-date"> | ||
<span>START DATE</span> | ||
<input | ||
class="immich-form-input w-full mt-1 hover:cursor-pointer" | ||
type="date" | ||
id="start-date" | ||
name="start-date" | ||
max={filters.takenBefore} | ||
bind:value={filters.takenAfter} | ||
/> | ||
</label> | ||
|
||
<label class="immich-form-label" for="end-date"> | ||
<span>END DATE</span> | ||
<input | ||
class="immich-form-input w-full mt-1 hover:cursor-pointer" | ||
type="date" | ||
id="end-date" | ||
name="end-date" | ||
placeholder="" | ||
min={filters.takenAfter} | ||
bind:value={filters.takenBefore} | ||
/> | ||
</label> | ||
</div> |
32 changes: 32 additions & 0 deletions
32
web/src/lib/components/shared-components/search-bar/search-display-section.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<script lang="ts" context="module"> | ||
export interface SearchDisplayFilters { | ||
isNotInAlbum?: boolean; | ||
isArchive?: boolean; | ||
isFavorite?: boolean; | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
export let filters: SearchDisplayFilters; | ||
</script> | ||
|
||
<div id="display-options-selection" class="text-sm"> | ||
<p class="immich-form-label">DISPLAY OPTIONS</p> | ||
|
||
<div class="flex flex-wrap gap-x-5 gap-y-2 mt-1"> | ||
<label class="flex items-center gap-2"> | ||
<input type="checkbox" class="size-5 flex-shrink-0" bind:checked={filters.isNotInAlbum} /> | ||
<span class="pt-1">Not in any album</span> | ||
</label> | ||
|
||
<label class="flex items-center gap-2"> | ||
<input type="checkbox" class="size-5 flex-shrink-0" bind:checked={filters.isArchive} /> | ||
<span class="pt-1">Archive</span> | ||
</label> | ||
|
||
<label class="flex items-center gap-2"> | ||
<input type="checkbox" class="size-5 flex-shrink-0" bind:checked={filters.isFavorite} /> | ||
<span class="pt-1">Favorite</span> | ||
</label> | ||
</div> | ||
</div> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will have to be updated when #7382 is merged since it's calling an
async
function without error handling. I see the same in other files below