mirror of
https://github.com/immich-app/immich.git
synced 2025-05-31 20:25:32 -04:00
feat: better library rename UX (#16837)
This commit is contained in:
parent
72a7be26c0
commit
2d7a94ce23
@ -1,9 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '../elements/buttons/button.svelte';
|
import { Button } from '@immich/ui';
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
|
||||||
import { mdiFolderRemove } from '@mdi/js';
|
import { mdiFolderRemove } from '@mdi/js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
exclusionPattern: string;
|
exclusionPattern: string;
|
||||||
@ -67,10 +67,12 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
{#snippet stickyBottom()}
|
||||||
<Button color="gray" fullwidth onclick={onCancel}>{$t('cancel')}</Button>
|
<Button shape="round" color="secondary" fullWidth onclick={onCancel}>{$t('cancel')}</Button>
|
||||||
{#if isEditing}
|
{#if isEditing}
|
||||||
<Button color="red" fullwidth onclick={onDelete}>{$t('delete')}</Button>
|
<Button shape="round" color="danger" fullWidth onclick={onDelete}>{$t('delete')}</Button>
|
||||||
{/if}
|
{/if}
|
||||||
<Button type="submit" disabled={!canSubmit} fullwidth form="add-exclusion-pattern-form">{submitText}</Button>
|
<Button shape="round" type="submit" disabled={!canSubmit} fullWidth form="add-exclusion-pattern-form"
|
||||||
|
>{submitText}</Button
|
||||||
|
>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</FullScreenModal>
|
</FullScreenModal>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '../elements/buttons/button.svelte';
|
import { Button } from '@immich/ui';
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
||||||
import { mdiFolderSync } from '@mdi/js';
|
import { mdiFolderSync } from '@mdi/js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
@ -63,10 +63,12 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
{#snippet stickyBottom()}
|
||||||
<Button color="gray" fullwidth onclick={onCancel}>{cancelText}</Button>
|
<Button shape="round" color="secondary" fullWidth onclick={onCancel}>{cancelText}</Button>
|
||||||
{#if isEditing}
|
{#if isEditing}
|
||||||
<Button color="red" fullwidth onclick={onDelete}>{$t('delete')}</Button>
|
<Button shape="round" color="danger" fullWidth onclick={onDelete}>{$t('delete')}</Button>
|
||||||
{/if}
|
{/if}
|
||||||
<Button type="submit" disabled={!canSubmit} fullwidth form="library-import-path-form">{submitText}</Button>
|
<Button shape="round" type="submit" disabled={!canSubmit} fullWidth form="library-import-path-form"
|
||||||
|
>{submitText}</Button
|
||||||
|
>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</FullScreenModal>
|
</FullScreenModal>
|
||||||
|
@ -1,15 +1,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { onMount } from 'svelte';
|
|
||||||
import { handleError } from '../../utils/handle-error';
|
|
||||||
import Button from '../elements/buttons/button.svelte';
|
|
||||||
import LibraryImportPathForm from './library-import-path-form.svelte';
|
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
|
||||||
import { mdiAlertOutline, mdiCheckCircleOutline, mdiPencilOutline, mdiRefresh } from '@mdi/js';
|
|
||||||
import { validate, type LibraryResponseDto } from '@immich/sdk';
|
|
||||||
import type { ValidateLibraryImportPathResponseDto } from '@immich/sdk';
|
|
||||||
import { NotificationType, notificationController } from '../shared-components/notification/notification';
|
|
||||||
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
import CircleIconButton from '$lib/components/elements/buttons/circle-icon-button.svelte';
|
||||||
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
|
import type { ValidateLibraryImportPathResponseDto } from '@immich/sdk';
|
||||||
|
import { validate, type LibraryResponseDto } from '@immich/sdk';
|
||||||
|
import { Button } from '@immich/ui';
|
||||||
|
import { mdiAlertOutline, mdiCheckCircleOutline, mdiPencilOutline, mdiRefresh } from '@mdi/js';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
import { handleError } from '../../utils/handle-error';
|
||||||
|
import { NotificationType, notificationController } from '../shared-components/notification/notification';
|
||||||
|
import LibraryImportPathForm from './library-import-path-form.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
library: LibraryResponseDto;
|
library: LibraryResponseDto;
|
||||||
@ -228,27 +228,21 @@
|
|||||||
{$t('admin.no_paths_added')}
|
{$t('admin.no_paths_added')}
|
||||||
{/if}</td
|
{/if}</td
|
||||||
>
|
>
|
||||||
<td class="w-1/5 text-ellipsis px-4 text-sm"
|
<td class="w-1/5 text-ellipsis px-4 text-sm">
|
||||||
><Button
|
<Button shape="round" size="small" onclick={() => (addImportPath = true)}>{$t('add_path')}</Button>
|
||||||
type="button"
|
</td>
|
||||||
size="sm"
|
|
||||||
onclick={() => {
|
|
||||||
addImportPath = true;
|
|
||||||
}}>{$t('add_path')}</Button
|
|
||||||
></td
|
|
||||||
>
|
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
<div class="flex justify-between w-full">
|
<div class="flex justify-between w-full">
|
||||||
<div class="justify-end gap-2">
|
<div class="justify-end gap-2">
|
||||||
<Button size="sm" color="gray" onclick={() => revalidate()}
|
<Button shape="round" leadingIcon={mdiRefresh} size="small" color="secondary" onclick={() => revalidate()}
|
||||||
><Icon path={mdiRefresh} size={20} />{$t('validate')}</Button
|
>{$t('validate')}</Button
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="justify-end gap-2">
|
<div class="flex justify-end gap-2">
|
||||||
<Button size="sm" color="gray" onclick={onCancel}>{$t('cancel')}</Button>
|
<Button shape="round" size="small" color="secondary" onclick={onCancel}>{$t('cancel')}</Button>
|
||||||
<Button size="sm" type="submit">{$t('save')}</Button>
|
<Button shape="round" size="small" type="submit">{$t('save')}</Button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import FullScreenModal from '$lib/components/shared-components/full-screen-modal.svelte';
|
||||||
import type { LibraryResponseDto } from '@immich/sdk';
|
import type { LibraryResponseDto } from '@immich/sdk';
|
||||||
import Button from '../elements/buttons/button.svelte';
|
import { Button, Field, Input } from '@immich/ui';
|
||||||
|
import { mdiRenameOutline } from '@mdi/js';
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@ -9,21 +11,25 @@
|
|||||||
onSubmit: (library: Partial<LibraryResponseDto>) => void;
|
onSubmit: (library: Partial<LibraryResponseDto>) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { library = $bindable(), onCancel, onSubmit }: Props = $props();
|
let { library, onCancel, onSubmit }: Props = $props();
|
||||||
|
|
||||||
|
let newName = $state(library.name);
|
||||||
|
|
||||||
const onsubmit = (event: Event) => {
|
const onsubmit = (event: Event) => {
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
onSubmit({ ...library });
|
onSubmit({ ...library, name: newName });
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<form {onsubmit} autocomplete="off" class="m-4 flex flex-col gap-2">
|
<form {onsubmit} autocomplete="off">
|
||||||
<div class="flex flex-col gap-2">
|
<FullScreenModal icon={mdiRenameOutline} title={$t('rename')} onClose={onCancel}>
|
||||||
<label class="immich-form-label" for="path">{$t('name')}</label>
|
<Field label={$t('name')}>
|
||||||
<input class="immich-form-input" id="name" name="name" type="text" bind:value={library.name} />
|
<Input bind:value={newName} />
|
||||||
</div>
|
</Field>
|
||||||
<div class="flex w-full justify-end gap-2 pt-2">
|
|
||||||
<Button size="sm" color="gray" onclick={onCancel}>{$t('cancel')}</Button>
|
{#snippet stickyBottom()}
|
||||||
<Button size="sm" type="submit">{$t('save')}</Button>
|
<Button shape="round" fullWidth color="secondary" onclick={onCancel}>{$t('cancel')}</Button>
|
||||||
</div>
|
<Button shape="round" fullWidth type="submit">{$t('save')}</Button>
|
||||||
|
{/snippet}
|
||||||
|
</FullScreenModal>
|
||||||
</form>
|
</form>
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Button from '../elements/buttons/button.svelte';
|
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
||||||
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
import { user } from '$lib/stores/user.store';
|
||||||
|
import { searchUsersAdmin } from '@immich/sdk';
|
||||||
|
import { Button } from '@immich/ui';
|
||||||
import { mdiFolderSync } from '@mdi/js';
|
import { mdiFolderSync } from '@mdi/js';
|
||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { searchUsersAdmin } from '@immich/sdk';
|
|
||||||
import { user } from '$lib/stores/user.store';
|
|
||||||
import SettingSelect from '$lib/components/shared-components/settings/setting-select.svelte';
|
|
||||||
import { t } from 'svelte-i18n';
|
import { t } from 'svelte-i18n';
|
||||||
|
import FullScreenModal from '../shared-components/full-screen-modal.svelte';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
onCancel: () => void;
|
onCancel: () => void;
|
||||||
@ -38,7 +38,7 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
{#snippet stickyBottom()}
|
{#snippet stickyBottom()}
|
||||||
<Button color="gray" fullwidth onclick={onCancel}>{$t('cancel')}</Button>
|
<Button shape="round" color="secondary" fullWidth onclick={onCancel}>{$t('cancel')}</Button>
|
||||||
<Button type="submit" fullwidth form="select-library-owner-form">{$t('create')}</Button>
|
<Button shape="round" type="submit" fullWidth form="select-library-owner-form">{$t('create')}</Button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</FullScreenModal>
|
</FullScreenModal>
|
||||||
|
@ -357,12 +357,6 @@
|
|||||||
</ButtonContextMenu>
|
</ButtonContextMenu>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{#if renameLibrary === index}
|
|
||||||
<!-- svelte-ignore node_invalid_placement_ssr -->
|
|
||||||
<div transition:slide={{ duration: 250 }}>
|
|
||||||
<LibraryRenameForm {library} onSubmit={handleUpdate} onCancel={() => (renameLibrary = undefined)} />
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#if editImportPaths === index}
|
{#if editImportPaths === index}
|
||||||
<!-- svelte-ignore node_invalid_placement_ssr -->
|
<!-- svelte-ignore node_invalid_placement_ssr -->
|
||||||
<div transition:slide={{ duration: 250 }}>
|
<div transition:slide={{ duration: 250 }}>
|
||||||
@ -394,3 +388,11 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</UserPageLayout>
|
</UserPageLayout>
|
||||||
|
|
||||||
|
{#if renameLibrary !== undefined}
|
||||||
|
<LibraryRenameForm
|
||||||
|
library={libraries[renameLibrary]}
|
||||||
|
onSubmit={handleUpdate}
|
||||||
|
onCancel={() => (renameLibrary = undefined)}
|
||||||
|
/>
|
||||||
|
{/if}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user