mirror of
https://github.com/immich-app/immich.git
synced 2025-12-22 17:24:56 +03:00
* style: better responsiveness on album and shared album pages * revert right margin changes --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
45 lines
1.3 KiB
Svelte
45 lines
1.3 KiB
Svelte
<script lang="ts">
|
|
import { updateAlbumInfo } from '@immich/sdk';
|
|
import { handleError } from '$lib/utils/handle-error';
|
|
import { shortcut } from '$lib/actions/shortcut';
|
|
import { t } from 'svelte-i18n';
|
|
|
|
export let id: string;
|
|
export let albumName: string;
|
|
export let isOwned: boolean;
|
|
|
|
$: newAlbumName = albumName;
|
|
|
|
const handleUpdateName = async () => {
|
|
if (newAlbumName === albumName) {
|
|
return;
|
|
}
|
|
|
|
try {
|
|
await updateAlbumInfo({
|
|
id,
|
|
updateAlbumDto: {
|
|
albumName: newAlbumName,
|
|
},
|
|
});
|
|
} catch (error) {
|
|
handleError(error, $t('errors.unable_to_save_album'));
|
|
return;
|
|
}
|
|
albumName = newAlbumName;
|
|
};
|
|
</script>
|
|
|
|
<input
|
|
use:shortcut={{ shortcut: { key: 'Enter' }, onShortcut: (e) => e.currentTarget.blur() }}
|
|
on:blur={handleUpdateName}
|
|
class="w-[99%] mb-2 border-b-2 border-transparent text-2xl md:text-4xl lg:text-6xl text-immich-primary outline-none transition-all dark:text-immich-dark-primary {isOwned
|
|
? 'hover:border-gray-400'
|
|
: 'hover:border-transparent'} bg-immich-bg focus:border-b-2 focus:border-immich-primary focus:outline-none dark:bg-immich-dark-bg dark:focus:border-immich-dark-primary dark:focus:bg-immich-dark-gray"
|
|
type="text"
|
|
bind:value={newAlbumName}
|
|
disabled={!isOwned}
|
|
title={$t('edit_title')}
|
|
placeholder={$t('add_a_title')}
|
|
/>
|