feat(ui): Camera-Icon im Header mit Gemini-Config- und Offline-Gate

This commit is contained in:
hsiegeln
2026-04-21 10:48:38 +02:00
parent 47e91de0a1
commit eea5fb7560
2 changed files with 32 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ import { env } from '$env/dynamic/private';
export const load: LayoutServerLoad = () => {
return {
version: env.KOCHWAS_TAG ?? 'dev'
version: env.KOCHWAS_TAG ?? 'dev',
geminiConfigured: Boolean(env.GEMINI_API_KEY)
};
};

View File

@@ -2,7 +2,15 @@
import { onMount } from 'svelte';
import { page } from '$app/stores';
import { goto, afterNavigate } from '$app/navigation';
import { Settings, CookingPot, Utensils, Menu, BookOpen, ArrowLeft } from 'lucide-svelte';
import {
Settings,
CookingPot,
Utensils,
Menu,
BookOpen,
ArrowLeft,
Camera
} from 'lucide-svelte';
import { profileStore } from '$lib/client/profile.svelte';
import { wishlistStore } from '$lib/client/wishlist.svelte';
import { pwaStore } from '$lib/client/pwa.svelte';
@@ -232,6 +240,22 @@
</div>
{/if}
<div class="bar-right">
{#if data.geminiConfigured}
<a
href={network.online ? '/new/from-photo' : ''}
class="nav-link magic-link"
class:disabled={!network.online}
aria-label="Rezept aus Foto erstellen"
title={network.online
? 'Rezept aus Foto erstellen'
: 'Offline — braucht Internet'}
onclick={(e) => {
if (!network.online) e.preventDefault();
}}
>
<Camera size={20} strokeWidth={2} />
</a>
{/if}
<a
href="/wishlist"
class="nav-link wishlist-link"
@@ -537,6 +561,11 @@
.nav-link:hover {
background: #f4f8f5;
}
.nav-link.disabled {
color: #999;
pointer-events: none;
cursor: not-allowed;
}
.badge {
position: absolute;
top: -2px;