diff --git a/src/lib/components/ConnectionIndicator.svelte b/src/lib/components/ConnectionIndicator.svelte index 3e283f8..dd7e5c9 100644 --- a/src/lib/components/ConnectionIndicator.svelte +++ b/src/lib/components/ConnectionIndicator.svelte @@ -3,7 +3,6 @@ import { Icon } from '@steeze-ui/svelte-icon'; import { Wifi } from '@steeze-ui/heroicons'; - import { socket } from '../../store'; import { onMount } from 'svelte'; let connectionState: ConnectionState = 'connecting'; diff --git a/src/lib/components/HolomemGacha.svelte b/src/lib/components/HolomemGacha.svelte index 48ae929..64416cc 100644 --- a/src/lib/components/HolomemGacha.svelte +++ b/src/lib/components/HolomemGacha.svelte @@ -3,7 +3,7 @@ import { fade } from 'svelte/transition'; import { GACHA_STATE, type GachaState, type Holomem } from '../../custom'; import { holomemGachaPool } from '../../const'; - import { nickname } from '../../store'; + import { nickname } from '$lib/stores/userinfo'; let gachaState: GachaState = GACHA_STATE.NOT_PLAYED; let result: Holomem; diff --git a/src/store.ts b/src/lib/stores/toasts.ts similarity index 53% rename from src/store.ts rename to src/lib/stores/toasts.ts index f2823eb..f460892 100644 --- a/src/store.ts +++ b/src/lib/stores/toasts.ts @@ -1,11 +1,6 @@ -import type { Channel, Socket } from 'phoenix'; import { writable } from 'svelte/store'; -import type { Toast } from './custom'; +import type { Toast } from '../../custom'; -export const nickname = writable('anonymous'); -export const userToken = writable(null); -export const socket = writable(null); -export const notificationsChannel = writable(null); export const toastStore = writable(null); /** diff --git a/src/lib/stores/userinfo.ts b/src/lib/stores/userinfo.ts new file mode 100644 index 0000000..834b48e --- /dev/null +++ b/src/lib/stores/userinfo.ts @@ -0,0 +1,7 @@ +import { generateNickname } from 'hololive-nick-gen'; +import { persisted } from 'svelte-persisted-store'; +import { writable } from 'svelte/store'; + +// export const nickname = writable('anonymous'); +export const nickname = persisted('nickname', generateNickname()); +export const userToken = writable(null); diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 5c5acf1..527a530 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,14 +1,8 @@