Code format
This commit is contained in:
@@ -1,12 +1,9 @@
|
||||
<script lang="ts">
|
||||
import { type Food, FoodService } from '$lib/database/food'
|
||||
import { toast } from 'svelte-sonner'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import type { Err } from '$lib/types'
|
||||
import { foodStore } from '$lib/store/foodStore'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
let item: Food = {
|
||||
food: '',
|
||||
amount: 0,
|
||||
|
@@ -1,80 +1,86 @@
|
||||
<script lang="ts">
|
||||
import { appWindow } from '@tauri-apps/api/window'
|
||||
import { faXmark, faWindowMinimize } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import Fa from 'svelte-fa'
|
||||
import { link } from 'svelte-spa-router'
|
||||
import { Button } from '$components/ui/button'
|
||||
import { Sun, Moon } from 'lucide-svelte'
|
||||
import { toggleMode } from 'mode-watcher'
|
||||
import { cn } from '$lib/utils'
|
||||
import { appWindow } from '@tauri-apps/api/window'
|
||||
import { faWindowMinimize, faXmark } from '@fortawesome/free-solid-svg-icons'
|
||||
import { faGithub } from '@fortawesome/free-brands-svg-icons'
|
||||
import Fa from 'svelte-fa'
|
||||
import { link, location } from 'svelte-spa-router'
|
||||
import { Button } from '$components/ui/button'
|
||||
import { Moon, Sun } from 'lucide-svelte'
|
||||
import { toggleMode } from 'mode-watcher'
|
||||
import { cn } from '$lib/utils'
|
||||
import { dbStateStore } from '$lib/store/dbState'
|
||||
import { DBService } from '$lib/database'
|
||||
|
||||
import { location } from 'svelte-spa-router'
|
||||
import { dbStateStore } from '$lib/store/dbState'
|
||||
import { DBService } from '$lib/database'
|
||||
Fa
|
||||
|
||||
// You can structure your links however you'd like, but I like to keep them in an array of objects
|
||||
type Link = {
|
||||
label: string
|
||||
href: string
|
||||
}
|
||||
const links: Link[] = [
|
||||
{
|
||||
label: 'Home',
|
||||
href: '/'
|
||||
},
|
||||
]
|
||||
// You can structure your links however you'd like, but I like to keep them in an array of objects
|
||||
type Link = {
|
||||
label: string
|
||||
href: string
|
||||
}
|
||||
const links: Link[] = [
|
||||
{
|
||||
label: 'Home',
|
||||
href: '/'
|
||||
},
|
||||
{
|
||||
label: 'Daily',
|
||||
href: '/daily'
|
||||
}
|
||||
]
|
||||
</script>
|
||||
|
||||
<header
|
||||
data-tauri-drag-region
|
||||
class="flex h-14 items-center justify-between bg-base-100 shadow-lg sticky top-0 z-50 border-b
|
||||
data-tauri-drag-region
|
||||
class="flex h-14 items-center justify-between bg-base-100 shadow-lg sticky top-0 z-50 border-b
|
||||
border-border/40 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60"
|
||||
>
|
||||
<Button on:click={toggleMode} size="icon" variant="outline" class="ml-2">
|
||||
<Sun
|
||||
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
||||
/>
|
||||
<Moon
|
||||
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
||||
/>
|
||||
<span class="sr-only">Toggle theme</span>
|
||||
</Button>
|
||||
<Button on:click={toggleMode} size="icon" variant="outline" class="ml-2">
|
||||
<Sun
|
||||
class="h-[1.2rem] w-[1.2rem] rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0"
|
||||
/>
|
||||
<Moon
|
||||
class="absolute h-[1.2rem] w-[1.2rem] rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100"
|
||||
/>
|
||||
<span class="sr-only">Toggle theme</span>
|
||||
</Button>
|
||||
|
||||
<nav
|
||||
class="flex space-x-4 text-xl font-bold select-none"
|
||||
on:dragstart|preventDefault
|
||||
>
|
||||
<div class:text-amber-500="{$dbStateStore.transacting}" on:click={DBService.Begin} class="cursor-pointer">T</div>
|
||||
<div class:text-emerald-600={$dbStateStore.transacting} on:click={DBService.Commit} class="cursor-pointer">C</div>
|
||||
<div class:text-red-700={$dbStateStore.transacting} on:click={DBService.Rollback} class="cursor-pointer">R</div>
|
||||
{#each links as { href, label }}
|
||||
<a
|
||||
use:link
|
||||
{href}
|
||||
class={cn(
|
||||
<nav
|
||||
class="flex space-x-4 text-xl font-bold select-none"
|
||||
on:dragstart|preventDefault
|
||||
>
|
||||
<div class:text-amber-500="{$dbStateStore.transacting}" on:click={DBService.Begin} class="cursor-pointer">T
|
||||
</div>
|
||||
<div class:text-emerald-600={$dbStateStore.transacting} on:click={DBService.Commit} class="cursor-pointer">C
|
||||
</div>
|
||||
<div class:text-red-700={$dbStateStore.transacting} on:click={DBService.Rollback} class="cursor-pointer">R</div>
|
||||
{#each links as { href, label }}
|
||||
<a
|
||||
use:link
|
||||
{href}
|
||||
class={cn(
|
||||
'transition-colors hover:text-foreground/80',
|
||||
href === $location ? '' : 'text-foreground/60'
|
||||
)}>{label}</a
|
||||
>
|
||||
{/each}
|
||||
</nav>
|
||||
>
|
||||
{/each}
|
||||
</nav>
|
||||
|
||||
<div class="flex h-full [&>*]:px-2 [&>*]:transition-all">
|
||||
<a
|
||||
on:dragstart|preventDefault
|
||||
target="_blank"
|
||||
href="https://github.com/Fractal-Tess/Svelte-Tauri"
|
||||
class="flex items-center hover:text-secondary"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<Fa icon={faGithub} size="lg" />
|
||||
</a>
|
||||
<button on:click={appWindow.minimize} class="text-xl hover:text-secondary">
|
||||
<Fa icon={faWindowMinimize} />
|
||||
</button>
|
||||
<button on:click={appWindow.close} class="text-2xl hover:text-secondary">
|
||||
<Fa icon={faXmark} />
|
||||
</button>
|
||||
</div>
|
||||
<div class="flex h-full [&>*]:px-2 [&>*]:transition-all">
|
||||
<a
|
||||
on:dragstart|preventDefault
|
||||
target="_blank"
|
||||
href="https://github.com/Fractal-Tess/Svelte-Tauri"
|
||||
class="flex items-center hover:text-secondary"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
<Fa icon={faGithub} size="lg" />
|
||||
</a>
|
||||
<button on:click={appWindow.minimize} class="text-xl hover:text-secondary">
|
||||
<Fa icon={faWindowMinimize} />
|
||||
</button>
|
||||
<button on:click={appWindow.close} class="text-2xl hover:text-secondary">
|
||||
<Fa icon={faXmark} />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
Reference in New Issue
Block a user