diff --git a/package.json b/package.json
index d883a98..0188e7a 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "paper-cost",
- "version": "1.4.0",
+ "version": "1.7.0",
"private": true,
"scripts": {
"dev": "vite dev",
@@ -12,24 +12,22 @@
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"test:ui": "playwright test",
"test:unit": "vitest",
- "lint": "prettier --plugin-search-dir . --check .",
- "format": "prettier --plugin-search-dir . --write ."
+ "lint": "prettier --check .",
+ "format": "prettier --write ."
},
"devDependencies": {
"@iconify/svelte": "^4.0.2",
"@playwright/test": "^1.46.1",
- "@sveltejs/adapter-auto": "^3.0.0",
"@sveltejs/adapter-vercel": "^5.4.1",
- "@sveltejs/kit": "^2.0.0",
- "@sveltejs/vite-plugin-svelte": "^3.0.0",
+ "@sveltejs/kit": "^2.7.2",
+ "@sveltejs/vite-plugin-svelte": "^4.0.0",
"@types/mixpanel-browser": "^2.49.0",
"@types/node": "^22.5.0",
"autoprefixer": "^10.4.14",
"dotenv": "^16.4.5",
"postcss": "^8.4.27",
- "prettier": "^2.8.0",
- "prettier-plugin-svelte": "^2.10.1",
- "svelte": "^4.0.5",
+ "prettier": "^3.3.3",
+ "prettier-plugin-svelte": "^3.2.7",
"svelte-check": "^3.4.3",
"tailwindcss": "^3.3.3",
"tslib": "^2.4.1",
@@ -44,8 +42,8 @@
"@supabase/supabase-js": "^2.44.3",
"dayjs": "^1.11.11",
"mixpanel-browser": "^2.55.1",
+ "svelte": "^5.1.0",
"svelte-persisted-store": "^0.11.0",
- "svelte-sonner": "^0.3.27",
- "tippy.js": "^6.3.7"
+ "svelte-sonner": "^0.3.27"
}
}
diff --git a/src/lib/elements/About.svelte b/src/lib/elements/About.svelte
index ff6b073..c56dbba 100644
--- a/src/lib/elements/About.svelte
+++ b/src/lib/elements/About.svelte
@@ -1,7 +1,8 @@
diff --git a/src/lib/elements/Button.svelte b/src/lib/elements/Button.svelte
index d8f9d56..cc6eb8e 100644
--- a/src/lib/elements/Button.svelte
+++ b/src/lib/elements/Button.svelte
@@ -1,14 +1,16 @@
diff --git a/src/lib/elements/Footer.svelte b/src/lib/elements/Footer.svelte
index c4c47fa..01d3dbb 100644
--- a/src/lib/elements/Footer.svelte
+++ b/src/lib/elements/Footer.svelte
@@ -5,9 +5,13 @@
import { enhance } from '$app/forms'
import mixpanel from '$lib/utils/mixpanel'
- export let showSettings = false
- export let showAbout = false
- export let loading = false
+ type FooterProp = { showSettings: boolean; showAbout: boolean; loading: boolean }
+
+ let {
+ showSettings = $bindable(),
+ showAbout = $bindable(),
+ loading = $bindable()
+ }: FooterProp = $props()
const navItems = [
{ href: '/', label: 'Home', icon: 'clarity:home-line' },
@@ -34,7 +38,7 @@
{label}
{/each}
-
-
+
{#if !isLoading}
{#if data.histories.length}
{#each sortedByCreatedAt(data.histories) as cost}
- handleDelete(e.detail)} />
+ handleDelete(id)} />
{/each}
{:else}
diff --git a/src/routes/(app)/history/[id]/+page.svelte b/src/routes/(app)/history/[id]/+page.svelte
index b2fe73c..f27b29b 100644
--- a/src/routes/(app)/history/[id]/+page.svelte
+++ b/src/routes/(app)/history/[id]/+page.svelte
@@ -3,11 +3,11 @@
import Result from '$lib/elements/Result.svelte'
import dayjs from 'dayjs'
import { calculateCost, type CostHistoryType } from '$lib/utils/services'
- import Icon from '@iconify/svelte'
+ import SingleLine from '$lib/elements/SingleLine.svelte'
- export let data
+ const { data } = $props()
- let history: CostHistoryType | null = data.history
+ let history: CostHistoryType | null = $state(data.history)
@@ -16,7 +16,8 @@
Cost Details
-
+
+
{#if history}
@@ -33,15 +34,15 @@
{#if history.papers.length}
- {#each history.papers as { length, width, thickness, rate, id }}
+ {#each history.papers as { length, width, thickness, rate, id }, i}
-
-
-
-
+
+
+
+
= {calculateCost({ length, width, thickness, rate, id }).toFixed(2)}
diff --git a/src/routes/(app)/history/trash/+page.svelte b/src/routes/(app)/history/trash/+page.svelte
index 98de136..269ad9f 100644
--- a/src/routes/(app)/history/trash/+page.svelte
+++ b/src/routes/(app)/history/trash/+page.svelte
@@ -7,9 +7,11 @@
import Icon from '@iconify/svelte'
import mixpanel from '$lib/utils/mixpanel'
import { toast } from 'svelte-sonner'
+ import SingleLine from '$lib/elements/SingleLine.svelte'
- export let data
- let isLoading = false
+ let { data } = $props()
+
+ let isLoading = $state(false)
mixpanel.track_pageview({
url: '/history/trash'
@@ -51,7 +53,8 @@
{data.histories.length}
-
+
+
handleRestore(e.detail)}
- on:delete={(e) => handleDelete(e.detail)}
+ onrestore={(id) => handleRestore(id)}
+ ondelete={(id) => handleDelete(id)}
/>
{/each}
@@ -74,7 +77,7 @@
diff --git a/src/routes/+error.svelte b/src/routes/+error.svelte
index 062aa44..be92c76 100644
--- a/src/routes/+error.svelte
+++ b/src/routes/+error.svelte
@@ -1,8 +1,9 @@
-
@@ -10,7 +11,7 @@
-
+
Something went error
Back to home
diff --git a/src/routes/auth/+layout.svelte b/src/routes/auth/+layout.svelte
index a371db5..dfb3921 100644
--- a/src/routes/auth/+layout.svelte
+++ b/src/routes/auth/+layout.svelte
@@ -2,6 +2,8 @@
import '$lib/app.css'
import BrandTitle from '$lib/elements/BrandTitle.svelte'
import '@fontsource/jost'
+
+ let { children } = $props()
@@ -11,9 +13,9 @@
+ >
-
+ {@render children()}
diff --git a/src/routes/auth/login/+page.svelte b/src/routes/auth/login/+page.svelte
index d1d0e20..4e6d81d 100644
--- a/src/routes/auth/login/+page.svelte
+++ b/src/routes/auth/login/+page.svelte
@@ -3,16 +3,15 @@
import Button from '$lib/elements/Button.svelte'
import FullPageLoader from '$lib/elements/FullPageLoader.svelte'
import Input from '$lib/elements/Input.svelte'
+ import SingleLine from '$lib/elements/SingleLine.svelte'
import { redirect } from '@sveltejs/kit'
- export let data
- export let form
+ let { data, form } = $props()
- $: ({ supabase } = data)
+ const { supabase } = $derived(data)
- let email = form?.email || ''
- let password = ''
- let loading = false
+ let email = $derived(form?.email || '')
+ let loading = $state(false)
const handleOAuthLogin = async () => {
const { data, error } = await supabase.auth.signInWithOAuth({
@@ -34,7 +33,7 @@
Login
-
+
@@ -66,7 +65,6 @@
required
type="password"
name="password"
- bind:value={password}
classNames="!w-full text-center font-bold"
placeholder="*******"
/>
diff --git a/src/routes/auth/signup/+page.svelte b/src/routes/auth/signup/+page.svelte
index f88fb99..0d9b238 100644
--- a/src/routes/auth/signup/+page.svelte
+++ b/src/routes/auth/signup/+page.svelte
@@ -1,11 +1,11 @@
@@ -14,7 +14,7 @@
Signup
-
+
@@ -35,7 +35,6 @@
required
type="password"
name="password"
- bind:value={password}
classNames="!w-full text-center font-bold"
placeholder="*******"
/>