Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/missing images #150

Merged
merged 2 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions ui/src/routes/conversations/[id]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@
}
}

function handleOpenImageLightbox(e: PointerEvent, url: string) {
function handleOpenImageLightbox(e: PointerEvent | MouseEvent, url: string) {
const targetImg = e.target as HTMLImageElement;
biggerPicture.open({
items: [
Expand Down Expand Up @@ -382,22 +382,21 @@
{/if}
{#if message.images && message.images.length > 0}
{#each message.images as image}
{#if image.status === 'loaded'}
<!-- svelte-ignore a11y-missing-attribute -->
<div class='relative inline {fromMe && 'text-end'}'>
<div class='flex {fromMe ? 'justify-end' : 'justify-start'}'>
{#if image.status === 'loading' || image.status === 'pending'}
<div class='w-20 h-20 bg-surface-800 mb-2 flex items-center justify-center'>
<SvgIcon icon='spinner' color={$modeCurrent ? '%232e2e2e' : 'white'} size='30' />
</div>
{:else if image.status === 'error'}
<div class='w-20 h-20 bg-surface-500 mb-2 flex items-center justify-center'>
<SvgIcon icon='x' color={$modeCurrent ? '%232e2e2e' : 'white'} size='30' />
</div>
{:else if image.status === 'loaded'}
<button class='inline max-w-2/3 mb-2' on:click={(e) => handleOpenImageLightbox(e, image.dataURL) }>
<img src={image.dataURL} class="object-cover" />
<img src={image.dataURL} alt={image.name} class="object-cover" />
</button>
{/if}
</div>
{:else if image.status === 'loading' || image.status === 'pending'}
<div class='w-20 h-20 bg-tertiary-500 mb-2 flex items-center justify-center'>
<SvgIcon icon='spinner' color={$modeCurrent ? '%232e2e2e' : 'white'} size='30' />
</div>
{:else}
<div class='w-20 h-20 bg-tertiary-500 mb-2 flex items-center justify-center'>
<SvgIcon icon='x' color={$modeCurrent ? '%232e2e2e' : 'white'} size='30' />
</div>
{/if}
{/each}
{/if}
<div class="message font-light break-words w-full {fromMe && 'text-end'}">
Expand Down