2024-02-28 22:39:53 +01:00
|
|
|
<script lang="ts">
|
|
|
|
|
import { updateAlbumInfo } from '@immich/sdk';
|
|
|
|
|
import { handleError } from '$lib/utils/handle-error';
|
2024-06-01 12:47:14 -05:00
|
|
|
import AutogrowTextarea from '$lib/components/shared-components/autogrow-textarea.svelte';
|
2024-02-28 22:39:53 +01:00
|
|
|
|
|
|
|
|
export let id: string;
|
|
|
|
|
export let description: string;
|
|
|
|
|
export let isOwned: boolean;
|
|
|
|
|
|
2024-06-01 12:47:14 -05:00
|
|
|
const handleUpdateDescription = async (newDescription: string) => {
|
2024-02-28 22:39:53 +01:00
|
|
|
try {
|
|
|
|
|
await updateAlbumInfo({
|
|
|
|
|
id,
|
|
|
|
|
updateAlbumDto: {
|
|
|
|
|
description: newDescription,
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} catch (error) {
|
|
|
|
|
handleError(error, 'Error updating album description');
|
|
|
|
|
}
|
|
|
|
|
description = newDescription;
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
{#if isOwned}
|
2024-06-01 12:47:14 -05:00
|
|
|
<AutogrowTextarea
|
|
|
|
|
content={description}
|
|
|
|
|
class="w-full mt-2 text-black dark:text-white border-b-2 border-transparent border-gray-500 bg-transparent text-base outline-none transition-all focus:border-b-2 focus:border-immich-primary disabled:border-none dark:focus:border-immich-dark-primary hover:border-gray-400"
|
|
|
|
|
onContentUpdate={handleUpdateDescription}
|
2024-04-05 21:19:26 +02:00
|
|
|
placeholder="Add a description"
|
2024-02-28 22:39:53 +01:00
|
|
|
/>
|
|
|
|
|
{:else if description}
|
|
|
|
|
<p class="break-words whitespace-pre-line w-full text-black dark:text-white text-base">
|
|
|
|
|
{description}
|
|
|
|
|
</p>
|
|
|
|
|
{/if}
|