1
0
Fork 0
mirror of https://github.com/immich-app/immich.git synced 2025-01-01 08:31:59 +00:00

fix(web): show description in shared links (#4249)

* chore: rebase

* fix: re-size issue

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
Russell Tan 2024-01-12 12:27:34 -08:00 committed by GitHub
parent df4af025d7
commit 19e9908ee2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,16 +54,20 @@
$: isOwner = $user?.id === asset.ownerId;
$: {
const handleNewAsset = async (newAsset: AssetResponseDto) => {
description = newAsset?.exifInfo?.description || '';
// Get latest description from server
if (asset.id && !api.isSharedLink) {
api.assetApi.getAssetById({ id: asset.id }).then((res) => {
people = res.data?.people || [];
textarea.value = res.data?.exifInfo?.description || '';
autoGrowHeight();
});
if (newAsset.id && !api.isSharedLink) {
const { data } = await api.assetApi.getAssetById({ id: asset.id });
people = data?.people || [];
description = data.exifInfo?.description || '';
textarea.value = description;
autoGrowHeight();
}
}
};
$: handleNewAsset(asset);
$: latlng = (() => {
const lat = asset.exifInfo?.latitude;
@ -192,18 +196,21 @@
</section>
{/if}
<section class="mx-4 mt-10" style:display={!isOwner && textarea?.value == '' ? 'none' : 'block'}>
<textarea
bind:this={textarea}
class="max-h-[500px]
<section class="mx-4 mt-10" style:display={!isOwner && description === '' ? 'none' : 'block'}>
{#if !isOwner || api.isSharedLink}
<span>{description}</span>
{:else}
<textarea
bind:this={textarea}
class="max-h-[500px]
w-full resize-none overflow-hidden border-b border-gray-500 bg-transparent text-base text-black outline-none transition-all focus:border-b-2 focus:border-immich-primary disabled:border-none dark:text-white dark:focus:border-immich-dark-primary"
placeholder={!isOwner ? '' : 'Add a description'}
on:focusin={handleFocusIn}
on:focusout={handleFocusOut}
on:input={autoGrowHeight}
bind:value={description}
disabled={!isOwner}
/>
placeholder={!isOwner ? '' : 'Add a description'}
on:focusin={handleFocusIn}
on:focusout={handleFocusOut}
on:input={autoGrowHeight}
bind:value={description}
/>
{/if}
</section>
{#if !api.isSharedLink && people.length > 0}