feat(ui): Camera-Icon im Header mit Gemini-Config- und Offline-Gate
This commit is contained in:
@@ -3,6 +3,7 @@ import { env } from '$env/dynamic/private';
|
|||||||
|
|
||||||
export const load: LayoutServerLoad = () => {
|
export const load: LayoutServerLoad = () => {
|
||||||
return {
|
return {
|
||||||
version: env.KOCHWAS_TAG ?? 'dev'
|
version: env.KOCHWAS_TAG ?? 'dev',
|
||||||
|
geminiConfigured: Boolean(env.GEMINI_API_KEY)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -2,7 +2,15 @@
|
|||||||
import { onMount } from 'svelte';
|
import { onMount } from 'svelte';
|
||||||
import { page } from '$app/stores';
|
import { page } from '$app/stores';
|
||||||
import { goto, afterNavigate } from '$app/navigation';
|
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 { profileStore } from '$lib/client/profile.svelte';
|
||||||
import { wishlistStore } from '$lib/client/wishlist.svelte';
|
import { wishlistStore } from '$lib/client/wishlist.svelte';
|
||||||
import { pwaStore } from '$lib/client/pwa.svelte';
|
import { pwaStore } from '$lib/client/pwa.svelte';
|
||||||
@@ -232,6 +240,22 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="bar-right">
|
<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
|
<a
|
||||||
href="/wishlist"
|
href="/wishlist"
|
||||||
class="nav-link wishlist-link"
|
class="nav-link wishlist-link"
|
||||||
@@ -537,6 +561,11 @@
|
|||||||
.nav-link:hover {
|
.nav-link:hover {
|
||||||
background: #f4f8f5;
|
background: #f4f8f5;
|
||||||
}
|
}
|
||||||
|
.nav-link.disabled {
|
||||||
|
color: #999;
|
||||||
|
pointer-events: none;
|
||||||
|
cursor: not-allowed;
|
||||||
|
}
|
||||||
.badge {
|
.badge {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: -2px;
|
top: -2px;
|
||||||
|
|||||||
Reference in New Issue
Block a user