mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(web): preserve search text (#12531)
This commit is contained in:
parent
6674d67abe
commit
710cbd694b
2 changed files with 19 additions and 36 deletions
|
|
@ -2,46 +2,25 @@
|
|||
import RadioButton from '$lib/components/elements/radio-button.svelte';
|
||||
import { t } from 'svelte-i18n';
|
||||
|
||||
export let filename: string | undefined;
|
||||
export let context: string | undefined;
|
||||
|
||||
enum TextSearchOptions {
|
||||
Context = 'context',
|
||||
Filename = 'filename',
|
||||
}
|
||||
|
||||
let selectedOption = filename ? TextSearchOptions.Filename : TextSearchOptions.Context;
|
||||
|
||||
$: {
|
||||
if (selectedOption === TextSearchOptions.Context) {
|
||||
filename = undefined;
|
||||
} else {
|
||||
context = undefined;
|
||||
}
|
||||
}
|
||||
export let query: string | undefined;
|
||||
export let queryType: 'smart' | 'metadata' = 'smart';
|
||||
</script>
|
||||
|
||||
<fieldset>
|
||||
<legend class="immich-form-label">{$t('search_type')}</legend>
|
||||
<div class="flex flex-wrap gap-x-5 gap-y-2 mt-1 mb-2">
|
||||
<RadioButton
|
||||
name="query-type"
|
||||
id="context-radio"
|
||||
bind:group={selectedOption}
|
||||
label={$t('context')}
|
||||
value={TextSearchOptions.Context}
|
||||
/>
|
||||
<RadioButton name="query-type" id="context-radio" label={$t('context')} bind:group={queryType} value="smart" />
|
||||
<RadioButton
|
||||
name="query-type"
|
||||
id="file-name-radio"
|
||||
bind:group={selectedOption}
|
||||
label={$t('file_name_or_extension')}
|
||||
value={TextSearchOptions.Filename}
|
||||
bind:group={queryType}
|
||||
value="metadata"
|
||||
/>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
{#if selectedOption === TextSearchOptions.Context}
|
||||
{#if queryType === 'smart'}
|
||||
<label for="context-input" class="immich-form-label">{$t('search_by_context')}</label>
|
||||
<input
|
||||
class="immich-form-input hover:cursor-text w-full !mt-1"
|
||||
|
|
@ -49,7 +28,7 @@
|
|||
id="context-input"
|
||||
name="context"
|
||||
placeholder={$t('sunrise_on_the_beach')}
|
||||
bind:value={context}
|
||||
bind:value={query}
|
||||
/>
|
||||
{:else}
|
||||
<label for="file-name-input" class="immich-form-label">{$t('search_by_filename')}</label>
|
||||
|
|
@ -59,7 +38,7 @@
|
|||
id="file-name-input"
|
||||
name="file-name"
|
||||
placeholder={$t('search_by_filename_example')}
|
||||
bind:value={filename}
|
||||
bind:value={query}
|
||||
aria-labelledby="file-name-label"
|
||||
/>
|
||||
{/if}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue