This commit is contained in:
+2
-1
@@ -3,7 +3,8 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<!-- <meta name="viewport" content="width=device-width, initial-scale=1" /> -->
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<meta name="text-scale" content="scale" />
|
<meta name="text-scale" content="scale" />
|
||||||
%sveltekit.head%
|
%sveltekit.head%
|
||||||
</head>
|
</head>
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
// src/i18n.js
|
// src/i18n.js
|
||||||
import { getLocaleFromNavigator, init, register } from "svelte-i18n";
|
import { getLocaleFromNavigator, init, register } from "svelte-i18n";
|
||||||
|
|
||||||
|
// instant load
|
||||||
|
register("fb", () => Promise.resolve({}));
|
||||||
|
|
||||||
register("en", () => import("$lib/locales/en.json"));
|
register("en", () => import("$lib/locales/en.json"));
|
||||||
register("th", () => import("$lib/locales/th.json"));
|
register("th", () => import("$lib/locales/th.json"));
|
||||||
|
|
||||||
|
|||||||
+14
-1
@@ -5,5 +5,18 @@
|
|||||||
"scan": "Scan",
|
"scan": "Scan",
|
||||||
"guide": "Guide",
|
"guide": "Guide",
|
||||||
"settings": "Settings"
|
"settings": "Settings"
|
||||||
|
},
|
||||||
|
"brand": "HotFridge",
|
||||||
|
"message": {
|
||||||
|
"about_to_expire": "{count} items in your fridge is about to expire!"
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"view": "View"
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
"food": "Food"
|
||||||
|
},
|
||||||
|
"unit": {
|
||||||
|
"item": "{count} items"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,5 +5,18 @@
|
|||||||
"scan": "สแกน",
|
"scan": "สแกน",
|
||||||
"guide": "ไกด์",
|
"guide": "ไกด์",
|
||||||
"settings": "การตั้งค่า"
|
"settings": "การตั้งค่า"
|
||||||
|
},
|
||||||
|
"brand": "HotFridge",
|
||||||
|
"message": {
|
||||||
|
"about_to_expire": "มีอาหาร {count} รายการกำลังจะหมดอายุ"
|
||||||
|
},
|
||||||
|
"button": {
|
||||||
|
"view": "ดู"
|
||||||
|
},
|
||||||
|
"label": {
|
||||||
|
"food": "อาหาร"
|
||||||
|
},
|
||||||
|
"unit": {
|
||||||
|
"item": "{count} รายการ"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
import "../i18n";
|
import "../i18n";
|
||||||
import { ModeWatcher } from "mode-watcher";
|
import { ModeWatcher } from "mode-watcher";
|
||||||
import favicon from "$lib/assets/favicon.svg";
|
import favicon from "$lib/assets/favicon.svg";
|
||||||
import { isLoading } from "svelte-i18n";
|
|
||||||
import { pwaInfo } from "virtual:pwa-info";
|
import { pwaInfo } from "virtual:pwa-info";
|
||||||
import { onMount } from "svelte";
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
@@ -39,8 +38,4 @@
|
|||||||
{@html webManifestLink}
|
{@html webManifestLink}
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
<ModeWatcher />
|
<ModeWatcher />
|
||||||
{#if $isLoading}
|
{@render children()}
|
||||||
Loading
|
|
||||||
{:else}
|
|
||||||
{@render children()}
|
|
||||||
{/if}
|
|
||||||
|
|||||||
@@ -1 +1,8 @@
|
|||||||
hello world
|
<script lang="ts">
|
||||||
|
import { goto } from "$app/navigation";
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
goto("/app/home");
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|||||||
@@ -1,9 +1,39 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
import { locale, locales } from "svelte-i18n";
|
import favicon from "$lib/assets/favicon.svg";
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import SaladIcon from "@lucide/svelte/icons/salad";
|
||||||
|
import Warning from "./warning.svelte";
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<select bind:value={$locale}>
|
<div class="flex gap-1 p-3 border-b items-center">
|
||||||
{#each $locales as locale}
|
<img src={favicon} alt="icon" class="size-5" />
|
||||||
<option value={locale}>{locale}</option>
|
<span class="font-bold">{$_("brand")}</span>
|
||||||
{/each}
|
<div class="border-l-2 h-6"></div>
|
||||||
</select>
|
<span>{$_("nav.home")}</span>
|
||||||
|
</div>
|
||||||
|
<Warning message={$_("message.about_to_expire", { values: { count: 10 } })} />
|
||||||
|
|
||||||
|
<div class="grid grid-cols-3 p-1 gap-1">
|
||||||
|
<div class="p-2 border bg-card rounded-lg flex gap-1 items-center">
|
||||||
|
<SaladIcon />
|
||||||
|
<div class="flex flex-col leading-none">
|
||||||
|
<span class="font-bold">{$_("label.food")}</span>
|
||||||
|
<span>{$_("unit.item", { values: { count: 57 } })}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-2 border bg-card rounded-lg flex gap-1 items-center">
|
||||||
|
<SaladIcon />
|
||||||
|
<div class="flex flex-col leading-none">
|
||||||
|
<span class="font-bold">{$_("label.food")}</span>
|
||||||
|
<span>{$_("unit.item", { values: { count: 57 } })}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="p-2 border bg-card rounded-lg flex gap-1 items-center">
|
||||||
|
<SaladIcon />
|
||||||
|
<div class="flex flex-col leading-none">
|
||||||
|
<span class="font-bold">{$_("label.food")}</span>
|
||||||
|
<span>{$_("unit.item", { values: { count: 57 } })}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
...something else to put down here...
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Dismiss from "@lucide/svelte/icons/x";
|
||||||
|
import MessageCircleWarning from "@lucide/svelte/icons/message-circle-warning";
|
||||||
|
|
||||||
|
const {
|
||||||
|
message,
|
||||||
|
onDismiss,
|
||||||
|
onClick,
|
||||||
|
}: {
|
||||||
|
message: string;
|
||||||
|
onDismiss?: () => void;
|
||||||
|
onClick?: (ev: MouseEvent) => void;
|
||||||
|
} = $props();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-wrap gap-1 p-3 py-2 border-b items-center bg-orange-300 dark:bg-orange-800 justify-between"
|
||||||
|
onclick={onClick}
|
||||||
|
onkeydown={(event: KeyboardEvent) => {
|
||||||
|
if (event.key === "Enter" || event.key === " ") {
|
||||||
|
event.preventDefault(); // Prevent page scrolling on Space
|
||||||
|
// Activate
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
role="button"
|
||||||
|
tabindex="0 "
|
||||||
|
>
|
||||||
|
<div class="flex gap-1 items-center">
|
||||||
|
<MessageCircleWarning class="size-5 mb-0.5" />
|
||||||
|
{message}
|
||||||
|
</div>
|
||||||
|
<button
|
||||||
|
class="font-bold"
|
||||||
|
onclick={(ev) => {
|
||||||
|
ev.stopPropagation();
|
||||||
|
onDismiss?.();
|
||||||
|
}}
|
||||||
|
type="button"
|
||||||
|
>
|
||||||
|
<Dismiss class="size-5" />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
+118
-112
@@ -1,4 +1,4 @@
|
|||||||
@import 'tailwindcss';
|
@import "tailwindcss";
|
||||||
@import "tw-animate-css";
|
@import "tw-animate-css";
|
||||||
@import "shadcn-svelte/tailwind.css";
|
@import "shadcn-svelte/tailwind.css";
|
||||||
@import "@fontsource-variable/inter";
|
@import "@fontsource-variable/inter";
|
||||||
@@ -6,127 +6,127 @@
|
|||||||
@custom-variant dark (&:is(.dark *));
|
@custom-variant dark (&:is(.dark *));
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--background: oklch(1 0 0);
|
--background: oklch(1 0 0);
|
||||||
--foreground: oklch(0.145 0 0);
|
--foreground: oklch(0.145 0 0);
|
||||||
--card: oklch(1 0 0);
|
--card: oklch(1 0 0);
|
||||||
--card-foreground: oklch(0.145 0 0);
|
--card-foreground: oklch(0.145 0 0);
|
||||||
--popover: oklch(1 0 0);
|
--popover: oklch(1 0 0);
|
||||||
--popover-foreground: oklch(0.145 0 0);
|
--popover-foreground: oklch(0.145 0 0);
|
||||||
--primary: oklch(0.205 0 0);
|
--primary: oklch(0.205 0 0);
|
||||||
--primary-foreground: oklch(0.985 0 0);
|
--primary-foreground: oklch(0.985 0 0);
|
||||||
--secondary: oklch(0.97 0 0);
|
--secondary: oklch(0.97 0 0);
|
||||||
--secondary-foreground: oklch(0.205 0 0);
|
--secondary-foreground: oklch(0.205 0 0);
|
||||||
--muted: oklch(0.97 0 0);
|
--muted: oklch(0.97 0 0);
|
||||||
--muted-foreground: oklch(0.556 0 0);
|
--muted-foreground: oklch(0.556 0 0);
|
||||||
--accent: oklch(0.97 0 0);
|
--accent: oklch(0.97 0 0);
|
||||||
--accent-foreground: oklch(0.205 0 0);
|
--accent-foreground: oklch(0.205 0 0);
|
||||||
--destructive: oklch(0.577 0.245 27.325);
|
--destructive: oklch(0.577 0.245 27.325);
|
||||||
--border: oklch(0.922 0 0);
|
--border: oklch(0.922 0 0);
|
||||||
--input: oklch(0.922 0 0);
|
--input: oklch(0.922 0 0);
|
||||||
--ring: oklch(0.708 0 0);
|
--ring: oklch(0.708 0 0);
|
||||||
--chart-1: oklch(0.87 0 0);
|
--chart-1: oklch(0.87 0 0);
|
||||||
--chart-2: oklch(0.556 0 0);
|
--chart-2: oklch(0.556 0 0);
|
||||||
--chart-3: oklch(0.439 0 0);
|
--chart-3: oklch(0.439 0 0);
|
||||||
--chart-4: oklch(0.371 0 0);
|
--chart-4: oklch(0.371 0 0);
|
||||||
--chart-5: oklch(0.269 0 0);
|
--chart-5: oklch(0.269 0 0);
|
||||||
--radius: 0.625rem;
|
--radius: 0.625rem;
|
||||||
--sidebar: oklch(0.985 0 0);
|
--sidebar: oklch(0.985 0 0);
|
||||||
--sidebar-foreground: oklch(0.145 0 0);
|
--sidebar-foreground: oklch(0.145 0 0);
|
||||||
--sidebar-primary: oklch(0.205 0 0);
|
--sidebar-primary: oklch(0.205 0 0);
|
||||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-accent: oklch(0.97 0 0);
|
--sidebar-accent: oklch(0.97 0 0);
|
||||||
--sidebar-accent-foreground: oklch(0.205 0 0);
|
--sidebar-accent-foreground: oklch(0.205 0 0);
|
||||||
--sidebar-border: oklch(0.922 0 0);
|
--sidebar-border: oklch(0.922 0 0);
|
||||||
--sidebar-ring: oklch(0.708 0 0);
|
--sidebar-ring: oklch(0.708 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
.dark {
|
.dark {
|
||||||
--background: oklch(0.145 0 0);
|
--background: oklch(0.145 0 0);
|
||||||
--foreground: oklch(0.985 0 0);
|
--foreground: oklch(0.985 0 0);
|
||||||
--card: oklch(0.205 0 0);
|
--card: oklch(0.205 0 0);
|
||||||
--card-foreground: oklch(0.985 0 0);
|
--card-foreground: oklch(0.985 0 0);
|
||||||
--popover: oklch(0.205 0 0);
|
--popover: oklch(0.205 0 0);
|
||||||
--popover-foreground: oklch(0.985 0 0);
|
--popover-foreground: oklch(0.985 0 0);
|
||||||
--primary: oklch(0.922 0 0);
|
--primary: oklch(0.922 0 0);
|
||||||
--primary-foreground: oklch(0.205 0 0);
|
--primary-foreground: oklch(0.205 0 0);
|
||||||
--secondary: oklch(0.269 0 0);
|
--secondary: oklch(0.269 0 0);
|
||||||
--secondary-foreground: oklch(0.985 0 0);
|
--secondary-foreground: oklch(0.985 0 0);
|
||||||
--muted: oklch(0.269 0 0);
|
--muted: oklch(0.269 0 0);
|
||||||
--muted-foreground: oklch(0.708 0 0);
|
--muted-foreground: oklch(0.708 0 0);
|
||||||
--accent: oklch(0.269 0 0);
|
--accent: oklch(0.269 0 0);
|
||||||
--accent-foreground: oklch(0.985 0 0);
|
--accent-foreground: oklch(0.985 0 0);
|
||||||
--destructive: oklch(0.704 0.191 22.216);
|
--destructive: oklch(0.704 0.191 22.216);
|
||||||
--border: oklch(1 0 0 / 10%);
|
--border: oklch(1 0 0 / 10%);
|
||||||
--input: oklch(1 0 0 / 15%);
|
--input: oklch(1 0 0 / 15%);
|
||||||
--ring: oklch(0.556 0 0);
|
--ring: oklch(0.556 0 0);
|
||||||
--chart-1: oklch(0.87 0 0);
|
--chart-1: oklch(0.87 0 0);
|
||||||
--chart-2: oklch(0.556 0 0);
|
--chart-2: oklch(0.556 0 0);
|
||||||
--chart-3: oklch(0.439 0 0);
|
--chart-3: oklch(0.439 0 0);
|
||||||
--chart-4: oklch(0.371 0 0);
|
--chart-4: oklch(0.371 0 0);
|
||||||
--chart-5: oklch(0.269 0 0);
|
--chart-5: oklch(0.269 0 0);
|
||||||
--sidebar: oklch(0.205 0 0);
|
--sidebar: oklch(0.205 0 0);
|
||||||
--sidebar-foreground: oklch(0.985 0 0);
|
--sidebar-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-primary: oklch(0.488 0.243 264.376);
|
--sidebar-primary: oklch(0.488 0.243 264.376);
|
||||||
--sidebar-primary-foreground: oklch(0.985 0 0);
|
--sidebar-primary-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-accent: oklch(0.269 0 0);
|
--sidebar-accent: oklch(0.269 0 0);
|
||||||
--sidebar-accent-foreground: oklch(0.985 0 0);
|
--sidebar-accent-foreground: oklch(0.985 0 0);
|
||||||
--sidebar-border: oklch(1 0 0 / 10%);
|
--sidebar-border: oklch(1 0 0 / 10%);
|
||||||
--sidebar-ring: oklch(0.556 0 0);
|
--sidebar-ring: oklch(0.556 0 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@theme inline {
|
@theme inline {
|
||||||
--font-sans: 'Inter Variable', sans-serif;
|
--font-sans: "Inter Variable", sans-serif;
|
||||||
--color-sidebar-ring: var(--sidebar-ring);
|
--color-sidebar-ring: var(--sidebar-ring);
|
||||||
--color-sidebar-border: var(--sidebar-border);
|
--color-sidebar-border: var(--sidebar-border);
|
||||||
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
||||||
--color-sidebar-accent: var(--sidebar-accent);
|
--color-sidebar-accent: var(--sidebar-accent);
|
||||||
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
||||||
--color-sidebar-primary: var(--sidebar-primary);
|
--color-sidebar-primary: var(--sidebar-primary);
|
||||||
--color-sidebar-foreground: var(--sidebar-foreground);
|
--color-sidebar-foreground: var(--sidebar-foreground);
|
||||||
--color-sidebar: var(--sidebar);
|
--color-sidebar: var(--sidebar);
|
||||||
--color-chart-5: var(--chart-5);
|
--color-chart-5: var(--chart-5);
|
||||||
--color-chart-4: var(--chart-4);
|
--color-chart-4: var(--chart-4);
|
||||||
--color-chart-3: var(--chart-3);
|
--color-chart-3: var(--chart-3);
|
||||||
--color-chart-2: var(--chart-2);
|
--color-chart-2: var(--chart-2);
|
||||||
--color-chart-1: var(--chart-1);
|
--color-chart-1: var(--chart-1);
|
||||||
--color-ring: var(--ring);
|
--color-ring: var(--ring);
|
||||||
--color-input: var(--input);
|
--color-input: var(--input);
|
||||||
--color-border: var(--border);
|
--color-border: var(--border);
|
||||||
--color-destructive: var(--destructive);
|
--color-destructive: var(--destructive);
|
||||||
--color-accent-foreground: var(--accent-foreground);
|
--color-accent-foreground: var(--accent-foreground);
|
||||||
--color-accent: var(--accent);
|
--color-accent: var(--accent);
|
||||||
--color-muted-foreground: var(--muted-foreground);
|
--color-muted-foreground: var(--muted-foreground);
|
||||||
--color-muted: var(--muted);
|
--color-muted: var(--muted);
|
||||||
--color-secondary-foreground: var(--secondary-foreground);
|
--color-secondary-foreground: var(--secondary-foreground);
|
||||||
--color-secondary: var(--secondary);
|
--color-secondary: var(--secondary);
|
||||||
--color-primary-foreground: var(--primary-foreground);
|
--color-primary-foreground: var(--primary-foreground);
|
||||||
--color-primary: var(--primary);
|
--color-primary: var(--primary);
|
||||||
--color-popover-foreground: var(--popover-foreground);
|
--color-popover-foreground: var(--popover-foreground);
|
||||||
--color-popover: var(--popover);
|
--color-popover: var(--popover);
|
||||||
--color-card-foreground: var(--card-foreground);
|
--color-card-foreground: var(--card-foreground);
|
||||||
--color-card: var(--card);
|
--color-card: var(--card);
|
||||||
--color-foreground: var(--foreground);
|
--color-foreground: var(--foreground);
|
||||||
--color-background: var(--background);
|
--color-background: var(--background);
|
||||||
--radius-sm: calc(var(--radius) * 0.6);
|
--radius-sm: calc(var(--radius) * 0.6);
|
||||||
--radius-md: calc(var(--radius) * 0.8);
|
--radius-md: calc(var(--radius) * 0.8);
|
||||||
--radius-lg: var(--radius);
|
--radius-lg: var(--radius);
|
||||||
--radius-xl: calc(var(--radius) * 1.4);
|
--radius-xl: calc(var(--radius) * 1.4);
|
||||||
--radius-2xl: calc(var(--radius) * 1.8);
|
--radius-2xl: calc(var(--radius) * 1.8);
|
||||||
--radius-3xl: calc(var(--radius) * 2.2);
|
--radius-3xl: calc(var(--radius) * 2.2);
|
||||||
--radius-4xl: calc(var(--radius) * 2.6);
|
--radius-4xl: calc(var(--radius) * 2.6);
|
||||||
--font-google-sans: "Google Sans", sans-serif;
|
--font-google-sans: "Google Sans", sans-serif;
|
||||||
}
|
}
|
||||||
|
|
||||||
@layer base {
|
@layer base {
|
||||||
* {
|
* {
|
||||||
@apply border-border outline-ring/50;
|
@apply border-border outline-ring/50;
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
@apply bg-background text-foreground;
|
@apply bg-background text-foreground;
|
||||||
}
|
}
|
||||||
html {
|
html {
|
||||||
@apply font-sans;
|
@apply font-sans;
|
||||||
}
|
}
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "Google Sans";
|
font-family: "Google Sans";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
@@ -137,3 +137,9 @@
|
|||||||
url("/fonts/google_sans.woff2") format("woff2");
|
url("/fonts/google_sans.woff2") format("woff2");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
/* Allows scrolling but disables pinch-zoom and double-tap zoom */
|
||||||
|
touch-action: pan-x pan-y;
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user