mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-17 01:39:39 +02:00
refactor(manacore): use STORAGE_KEYS in all remaining localStorage calls
Replace hardcoded localStorage key strings in +layout.svelte, welcome/+page.svelte, and onboarding store with centralized STORAGE_KEYS constants. Completes the storage-keys refactor. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0519440705
commit
59c8974af8
3 changed files with 10 additions and 6 deletions
|
|
@ -3,7 +3,9 @@
|
|||
* Tracks user onboarding progress and completion status
|
||||
*/
|
||||
|
||||
const STORAGE_KEY = 'manacore-onboarding';
|
||||
import { STORAGE_KEYS } from '$lib/config/storage-keys';
|
||||
|
||||
const STORAGE_KEY = STORAGE_KEYS.ONBOARDING;
|
||||
|
||||
interface OnboardingState {
|
||||
completed: boolean;
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@
|
|||
import { getPillAppItems } from '@manacore/shared-branding';
|
||||
import { onboardingStore } from '$lib/stores/onboarding.svelte';
|
||||
import { OnboardingWizard } from '$lib/components/onboarding';
|
||||
import { STORAGE_KEYS } from '$lib/config/storage-keys';
|
||||
|
||||
let { children }: { children: Snippet } = $props();
|
||||
|
||||
|
|
@ -132,7 +133,7 @@
|
|||
isCollapsed = collapsed;
|
||||
collapsedStore.set(collapsed);
|
||||
if (typeof localStorage !== 'undefined') {
|
||||
localStorage.setItem('manacore-nav-collapsed', String(collapsed));
|
||||
localStorage.setItem(STORAGE_KEYS.NAV_COLLAPSED, String(collapsed));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -181,7 +182,7 @@
|
|||
}
|
||||
|
||||
// Initialize collapsed state from localStorage
|
||||
const savedCollapsed = localStorage.getItem('manacore-nav-collapsed');
|
||||
const savedCollapsed = localStorage.getItem(STORAGE_KEYS.NAV_COLLAPSED);
|
||||
if (savedCollapsed === 'true') {
|
||||
isCollapsed = true;
|
||||
collapsedStore.set(true);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { getAppConfig } from '$lib/config/apps';
|
||||
import type { AppConfig } from '$lib/config/apps';
|
||||
import { STORAGE_KEYS } from '$lib/config/storage-keys';
|
||||
|
||||
let appConfig = $state<AppConfig>();
|
||||
let isFirstTime = $state(true);
|
||||
|
|
@ -15,20 +16,20 @@
|
|||
|
||||
// Check if this is actually a first-time user
|
||||
// You could store this in localStorage or check user profile
|
||||
const hasSeenWelcome = localStorage.getItem('hasSeenWelcome');
|
||||
const hasSeenWelcome = localStorage.getItem(STORAGE_KEYS.HAS_SEEN_WELCOME);
|
||||
isFirstTime = !hasSeenWelcome;
|
||||
});
|
||||
|
||||
function handleContinue() {
|
||||
// Mark that user has seen welcome screen
|
||||
localStorage.setItem('hasSeenWelcome', 'true');
|
||||
localStorage.setItem(STORAGE_KEYS.HAS_SEEN_WELCOME, 'true');
|
||||
|
||||
// Redirect to app's dashboard
|
||||
goto(appConfig?.dashboardRoute || '/dashboard');
|
||||
}
|
||||
|
||||
function handleSkip() {
|
||||
localStorage.setItem('hasSeenWelcome', 'true');
|
||||
localStorage.setItem(STORAGE_KEYS.HAS_SEEN_WELCOME, 'true');
|
||||
goto(appConfig?.dashboardRoute || '/dashboard');
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue