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