diff --git a/apps/mana/apps/web/src/lib/components/dashboard/widgets/CreditsWidget.svelte b/apps/mana/apps/web/src/lib/components/dashboard/widgets/CreditsWidget.svelte index dbce0ec69..c26558c04 100644 --- a/apps/mana/apps/web/src/lib/components/dashboard/widgets/CreditsWidget.svelte +++ b/apps/mana/apps/web/src/lib/components/dashboard/widgets/CreditsWidget.svelte @@ -9,23 +9,23 @@ import WidgetSkeleton from '../WidgetSkeleton.svelte'; import WidgetError from '../WidgetError.svelte'; - let state = $state<'loading' | 'success' | 'error'>('loading'); + let loadState = $state<'loading' | 'success' | 'error'>('loading'); let data = $state(null); let error = $state(null); let retrying = $state(false); async function load() { - if (!data) state = 'loading'; + if (!data) loadState = 'loading'; retrying = true; try { const balance = await creditsService.getBalance(); data = balance; - state = 'success'; + loadState = 'success'; } catch (e) { if (!data) { error = e instanceof Error ? e.message : 'Failed to load credits'; - state = 'error'; + loadState = 'error'; } } finally { retrying = false; @@ -45,9 +45,9 @@ {$_('dashboard.widgets.credits.title')} - {#if state === 'loading'} + {#if loadState === 'loading'} - {:else if state === 'error'} + {:else if loadState === 'error'} {:else if data}
diff --git a/apps/mana/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte b/apps/mana/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte index 3c9eafb2a..384bc373d 100644 --- a/apps/mana/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte +++ b/apps/mana/apps/web/src/lib/components/dashboard/widgets/TasksTodayWidget.svelte @@ -152,14 +152,9 @@ {/if}
- {#if task.dueTime || getSubtaskProgress(task)} + {#if getSubtaskProgress(task)}
- {#if task.dueTime} - {task.dueTime} - {/if} - {#if getSubtaskProgress(task)} - {getSubtaskProgress(task)} - {/if} + {getSubtaskProgress(task)}
{/if} diff --git a/apps/mana/apps/web/src/lib/components/dashboard/widgets/TransactionsWidget.svelte b/apps/mana/apps/web/src/lib/components/dashboard/widgets/TransactionsWidget.svelte index 9a8b1fc07..29e3a4f6e 100644 --- a/apps/mana/apps/web/src/lib/components/dashboard/widgets/TransactionsWidget.svelte +++ b/apps/mana/apps/web/src/lib/components/dashboard/widgets/TransactionsWidget.svelte @@ -9,22 +9,22 @@ import WidgetSkeleton from '../WidgetSkeleton.svelte'; import WidgetError from '../WidgetError.svelte'; - let state = $state<'loading' | 'success' | 'error'>('loading'); + let loadState = $state<'loading' | 'success' | 'error'>('loading'); let data = $state([]); let error = $state(null); let retrying = $state(false); async function load() { - state = 'loading'; + loadState = 'loading'; retrying = true; try { const transactions = await creditsService.getTransactions(5); data = transactions; - state = 'success'; + loadState = 'success'; } catch (e) { error = e instanceof Error ? e.message : 'Failed to load transactions'; - state = 'error'; + loadState = 'error'; } finally { retrying = false; } @@ -63,9 +63,9 @@ - {#if state === 'loading'} + {#if loadState === 'loading'} - {:else if state === 'error'} + {:else if loadState === 'error'} {:else if data.length === 0}

diff --git a/apps/mana/apps/web/src/lib/modules/skilltree/components/StatsOverview.svelte b/apps/mana/apps/web/src/lib/modules/skilltree/components/StatsOverview.svelte index ddd89b6c3..c8c482bce 100644 --- a/apps/mana/apps/web/src/lib/modules/skilltree/components/StatsOverview.svelte +++ b/apps/mana/apps/web/src/lib/modules/skilltree/components/StatsOverview.svelte @@ -3,23 +3,17 @@ import { buildAchievementStatus, getAchievementStats } from '../stores/achievements.svelte'; import { Trophy, Lightning, Target, Fire, Medal } from '@mana/shared-icons'; - // Reactive live queries + // Reactive live queries — useLiveQueryWithDefault wraps Dexie's + // liveQuery and exposes a `.value` getter backed by $state, so we + // just read it inside $derived without manual subscribe plumbing. const allSkills = useAllSkills(); const allActivities = useAllActivities(); const allAchievementsRaw = useAllAchievements(); - let skills = $state([]); - let activities = $state([]); - let achievementsRaw = $state([]); - - $effect(() => { - allSkills.subscribe((v) => (skills = v ?? [])); - allActivities.subscribe((v) => (activities = v ?? [])); - allAchievementsRaw.subscribe((v) => (achievementsRaw = v ?? [])); - }); - - const userStats = $derived(computeUserStats(skills, activities)); - const achievementStats = $derived(getAchievementStats(buildAchievementStatus(achievementsRaw))); + const userStats = $derived(computeUserStats(allSkills.value, allActivities.value)); + const achievementStats = $derived( + getAchievementStats(buildAchievementStatus(allAchievementsRaw.value)) + );

diff --git a/apps/mana/apps/web/src/routes/(app)/api-keys/+page.svelte b/apps/mana/apps/web/src/routes/(app)/api-keys/+page.svelte index 5e4b12dab..02345a6a7 100644 --- a/apps/mana/apps/web/src/routes/(app)/api-keys/+page.svelte +++ b/apps/mana/apps/web/src/routes/(app)/api-keys/+page.svelte @@ -15,7 +15,9 @@ let creating = $state(false); let newKeyName = $state(''); let newKeyScopes = $state<{ stt: boolean; tts: boolean }>({ stt: true, tts: true }); - let newKeyRateLimit = $state(60); + // Stored as string because the shared component binds to a + // string value; we parseInt at submit time. + let newKeyRateLimit = $state('60'); let createdKey = $state(null); let copied = $state(false); @@ -62,21 +64,17 @@ const result = await apiKeysService.create({ name: newKeyName.trim(), scopes, - rateLimitRequests: newKeyRateLimit, + rateLimitRequests: parseInt(newKeyRateLimit, 10) || 60, }); if (result.error) { error = result.error; } else if (result.data) { createdKey = result.data; - // Add to list (without the secret key) - apiKeys = [ - ...apiKeys, - { - ...result.data, - key: undefined as unknown as string, // Remove secret from local state - }, - ]; + // Add to list — strip the secret `key` field that only appears on + // creation responses, so the local list matches the ApiKey shape. + const { key: _omit, ...withoutSecret } = result.data; + apiKeys = [...apiKeys, withoutSecret]; } creating = false; @@ -110,7 +108,7 @@ createdKey = null; newKeyName = ''; newKeyScopes = { stt: true, tts: true }; - newKeyRateLimit = 60; + newKeyRateLimit = '60'; copied = false; } @@ -186,8 +184,8 @@
{key.name} - {key.scopes.join(', ')} - {key.rateLimitRequests}/min + {key.scopes.join(', ')} + {key.rateLimitRequests}/min