migrate component

This commit is contained in:
vcoppe
2025-11-11 17:30:06 +01:00
parent b09a1fdcb7
commit 0f7f64fb2f

View File

@@ -9,18 +9,23 @@
import { fileActions } from '$lib/logic/file-actions'; import { fileActions } from '$lib/logic/file-actions';
import { selection } from '$lib/logic/selection'; import { selection } from '$lib/logic/selection';
export let poi: PopupItem<any>; let {
poi,
}: {
poi: PopupItem<any>;
} = $props();
let tags: { [key: string]: string } = {}; let tags: Record<string, string> = $derived(poi ? JSON.parse(poi.item.tags) : {});
let name = ''; let name = $derived.by(() => {
$: if (poi) { if (poi) {
tags = JSON.parse(poi.item.tags); if (tags.name !== undefined && tags.name !== '') {
if (tags.name !== undefined && tags.name !== '') { return tags.name;
name = tags.name; } else {
} else { return i18n._(`layers.label.${poi.item.query}`);
name = i18n._(`layers.label.${poi.item.query}`); }
} }
} return '';
});
function addToFile() { function addToFile() {
const desc = Object.entries(tags) const desc = Object.entries(tags)
@@ -74,7 +79,7 @@
<ScrollArea class="flex flex-col max-h-[30dvh]"> <ScrollArea class="flex flex-col max-h-[30dvh]">
{#if tags.image || tags['image:0']} {#if tags.image || tags['image:0']}
<div class="w-full rounded-md overflow-clip my-2 max-w-96 mx-auto"> <div class="w-full rounded-md overflow-clip my-2 max-w-96 mx-auto">
<!-- svelte-ignore a11y-missing-attribute --> <!-- svelte-ignore a11y_missing_attribute -->
<img src={tags.image ?? tags['image:0']} /> <img src={tags.image ?? tags['image:0']} />
</div> </div>
{/if} {/if}