Skip to content

High performance self-hosted photo and video management solution.

fix(web): wrap long album title (#27012)

Jason Rasmussen86311e3cfeac
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9d47ba73f8..4826666b24 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -747,8 +747,8 @@ importers:
specifier: workspace:*
version: link:../open-api/typescript-sdk
'@immich/ui':
- specifier: ^0.64.0
+ specifier: ^0.65.3
'@mapbox/mapbox-gl-rtl-text':
specifier: 0.3.0
version: 0.3.0
@@ -3035,8 +3035,8 @@ packages:
peerDependencies:
svelte: ^5.0.0
- '@immich/[email protected]':
- resolution: {integrity: sha512-jbPN1x9KAAcW18h4RO7skbFYjkR4Lg+mEVjSDzsPC2NBNzSi4IA0PIHhFEwnD5dk4OS7+UjRG8m5/QTyotrm4A==}
+ '@immich/[email protected]':
+ resolution: {integrity: sha512-jMXzCzMNTcCdWXt9IUP7GkALE5oEvPQk/jCOuI2bfxsxCZFzMkUfUS+AV83Vg1vQ6l+g39PbKSPKBEzv125ATQ==}
peerDependencies:
svelte: ^5.0.0
@@ -14955,7 +14955,7 @@ snapshots:
node-emoji: 2.2.0
svelte: 5.53.7
dependencies:
'@immich/svelte-markdown-preprocess': 0.2.1([email protected])
'@internationalized/date': 3.10.0
diff --git a/web/package.json b/web/package.json
index 847d75a21a..3311db6acd 100644
--- a/web/package.json
+++ b/web/package.json
@@ -27,7 +27,7 @@
"@formatjs/icu-messageformat-parser": "^3.0.0",
"@immich/justified-layout-wasm": "^0.4.3",
"@immich/sdk": "workspace:*",
- "@immich/ui": "^0.64.0",
+ "@immich/ui": "^0.65.3",
"@mapbox/mapbox-gl-rtl-text": "0.3.0",
"@mdi/js": "^7.4.47",
"@photo-sphere-viewer/core": "^5.14.0",
diff --git a/web/src/lib/components/album-page/album-description.svelte b/web/src/lib/components/album-page/album-description.svelte
index 481e110fb0..9443392456 100644
--- a/web/src/lib/components/album-page/album-description.svelte
+++ b/web/src/lib/components/album-page/album-description.svelte
@@ -33,13 +33,11 @@
{#if isOwned}
<Textarea
bind:value={description}
- class="outline-none border-b max-h-32 border-transparent pl-0 bg-transparent ring-0 focus:ring-0 resize-none focus:border-b-2 focus:border-immich-primary dark:focus:border-immich-dark-primary dark:bg-transparent"
- rows={1}
- grow
- shape="rectangle"
+ variant="ghost"
onfocusout={handleFocusOut}
placeholder={$t('add_a_description')}
data-testid="autogrow-textarea"
+ class="max-h-32"
{@attach fromAction(shortcut, () => ({
shortcut: { key: 'Enter', ctrl: true },
onShortcut: (e) => e.currentTarget.blur(),
diff --git a/web/src/lib/components/album-page/album-title.svelte b/web/src/lib/components/album-page/album-title.svelte
index 1ded91dcd4..fb0de34e70 100644
--- a/web/src/lib/components/album-page/album-title.svelte
+++ b/web/src/lib/components/album-page/album-title.svelte
@@ -3,59 +3,56 @@
import { eventManager } from '$lib/managers/event-manager.svelte';
import { handleError } from '$lib/utils/handle-error';
import { updateAlbumInfo } from '@immich/sdk';
+ import { Textarea } from '@immich/ui';
import { t } from 'svelte-i18n';
- import { tv } from 'tailwind-variants';
+ import { fromAction } from 'svelte/attachments';
- interface Props {
+ type Props = {
id: string;
albumName: string;
isOwned: boolean;
onUpdate: (albumName: string) => void;
- }
+ };
let { id, albumName = $bindable(), isOwned, onUpdate }: Props = $props();
let newAlbumName = $derived(albumName);
- const handleUpdateName = async () => {
+ const handleUpdate = async () => {
+ newAlbumName = newAlbumName.replaceAll('\n', ' ').trim();
+
if (newAlbumName === albumName) {
return;
}
try {
- const response = await updateAlbumInfo({
- id,
- updateAlbumDto: {
- albumName: newAlbumName,
- },
- });
+ const response = await updateAlbumInfo({ id, updateAlbumDto: { albumName: newAlbumName } });
({ albumName } = response);
eventManager.emit('AlbumUpdate', response);
onUpdate(albumName);
} catch (error) {
handleError(error, $t('errors.unable_to_save_album'));
- return;
}
};
- const styles = tv({
- base: 'w-[99%] mb-2 border-b-2 border-transparent text-2xl md:text-4xl lg:text-6xl text-primary outline-none transition-all focus:border-b-2 focus:border-immich-primary focus:outline-none bg-light dark:focus:border-immich-dark-primary dark:focus:bg-immich-dark-gray placeholder:text-primary/90',
- variants: {
- isOwned: {
- true: 'hover:border-gray-400',
- false: 'hover:border-transparent',
- },
- },
- });
+ const textClasses = 'text-2xl lg:text-6xl text-primary';
</script>
-<input
- use:shortcut={{ shortcut: { key: 'Enter' }, onShortcut: (e) => e.currentTarget.blur() }}
- onblur={handleUpdateName}
- class={styles({ isOwned })}
- type="text"
- bind:value={newAlbumName}
- disabled={!isOwned}
- title={$t('edit_title')}
- placeholder={$t('add_a_title')}
-/>
+<div class="mb-2">
+ {#if isOwned}
+ <Textarea
+ bind:value={newAlbumName}
+ variant="ghost"
+ title={$t('edit_title')}
+ onblur={handleUpdate}
+ placeholder={$t('add_a_title')}
+ class={textClasses}
+ {@attach fromAction(shortcut, () => ({
+ shortcut: { key: 'Enter' },
+ onShortcut: (event) => event.currentTarget.blur(),
+ }))}
+ />
+ {:else}
+ <div class={textClasses}>{newAlbumName}</div>
+ {/if}
+</div>