Compare commits
2 Commits
f5fc85596d
...
3674ba396e
| Author | SHA1 | Date |
|---|---|---|
|
|
3674ba396e | |
|
|
fbae56760b |
|
|
@ -1 +1 @@
|
|||
1.2.25
|
||||
1.2.26
|
||||
|
|
@ -17,6 +17,15 @@
|
|||
|
||||
let open = $state(false);
|
||||
let container: HTMLDivElement;
|
||||
let button: HTMLButtonElement;
|
||||
let openUp = $state(false);
|
||||
|
||||
function calcDirection() {
|
||||
if (!button) return;
|
||||
const rect = button.getBoundingClientRect();
|
||||
const spaceBelow = window.innerHeight - rect.bottom;
|
||||
openUp = spaceBelow < 260; // less than max-h-60 (240px) + margin
|
||||
}
|
||||
|
||||
const selected = $derived(options.find(o => o.value === value) ?? options[0]);
|
||||
|
||||
|
|
@ -35,16 +44,17 @@
|
|||
|
||||
<div bind:this={container} class="relative {cls}">
|
||||
<button
|
||||
bind:this={button}
|
||||
type="button"
|
||||
class="flex w-full items-center justify-between gap-2 rounded border border-border bg-white/10 px-3 py-2 text-sm text-white hover:bg-white/15 focus:border-accent focus:outline-none"
|
||||
onclick={() => open = !open}
|
||||
onclick={() => { calcDirection(); open = !open; }}
|
||||
>
|
||||
<span class="truncate">{selected?.label ?? ''}</span>
|
||||
<ChevronDown size={14} class="flex-shrink-0 text-muted transition-transform {open ? 'rotate-180' : ''}" />
|
||||
</button>
|
||||
|
||||
{#if open}
|
||||
<div class="absolute left-0 top-full z-50 mt-1 min-w-full rounded-lg border border-border bg-surface shadow-xl py-1 max-h-60 overflow-y-auto">
|
||||
<div class="absolute left-0 z-50 min-w-full rounded-lg border border-border bg-surface shadow-xl py-1 max-h-60 overflow-y-auto {openUp ? 'bottom-full mb-1' : 'top-full mt-1'}">
|
||||
{#each options as opt}
|
||||
<button
|
||||
type="button"
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@
|
|||
const p = familyPersons.find(fp => fp.id === personId);
|
||||
if (!p) return personId;
|
||||
const meta = p.meta as { abbreviation?: string; fullName?: string } | null;
|
||||
return meta?.abbreviation ?? meta?.fullName ?? p.name;
|
||||
return meta?.abbreviation ?? meta?.fullName ?? p.name.replace(/^Person /, '');
|
||||
}
|
||||
|
||||
let notesValue = $state('');
|
||||
|
|
@ -462,7 +462,7 @@
|
|||
{#if familyPersons.length > persons.length}
|
||||
<DarkSelect
|
||||
value=""
|
||||
options={[{ value: '', label: '+ Person hinzufügen' }, ...familyPersons.filter(fp => !persons.some(ap => ap.personId === fp.id)).map(fp => ({ value: fp.id, label: fp.name }))]}
|
||||
options={[{ value: '', label: '+ Person hinzufügen' }, ...familyPersons.filter(fp => !persons.some(ap => ap.personId === fp.id)).map(fp => ({ value: fp.id, label: personName(fp.id) }))]}
|
||||
onchange={(v) => { if (v) addPerson(v); }}
|
||||
/>
|
||||
{/if}
|
||||
|
|
|
|||
|
|
@ -79,18 +79,20 @@
|
|||
</script>
|
||||
|
||||
<div class="mx-auto max-w-2xl p-4">
|
||||
<div class="flex items-center justify-between mb-4">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-white">Gegenstände</h1>
|
||||
<p class="text-muted text-sm">{filteredAssets.length} Gegenstand{filteredAssets.length !== 1 ? 'stände' : ''}</p>
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<button class="btn-ghost flex items-center gap-1.5 text-sm" onclick={() => goto('/inventory/capture/photo')}>
|
||||
<Camera size={15} /> Fotografieren
|
||||
</button>
|
||||
<button class="btn-primary flex items-center gap-1.5 text-sm" onclick={() => showAdd = true}>
|
||||
<Plus size={15} /> Manuell
|
||||
</button>
|
||||
<div class="mb-4">
|
||||
<div class="flex items-start justify-between gap-2">
|
||||
<div>
|
||||
<h1 class="text-2xl font-bold text-white">Gegenstände</h1>
|
||||
<p class="text-muted text-sm">{filteredAssets.length} Gegenstand{filteredAssets.length !== 1 ? 'stände' : ''}</p>
|
||||
</div>
|
||||
<div class="flex gap-2 flex-shrink-0">
|
||||
<button class="btn-ghost flex items-center gap-1.5 text-sm" onclick={() => goto('/inventory/capture/photo')}>
|
||||
<Camera size={15} /> <span class="hidden sm:inline">Fotografieren</span>
|
||||
</button>
|
||||
<button class="btn-primary flex items-center gap-1.5 text-sm" onclick={() => showAdd = true}>
|
||||
<Plus size={15} /> <span class="hidden sm:inline">Manuell</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue