update: hooks, web

This commit is contained in:
Vick Scarlet
2026-08-16 20:06:16 +08:00
committed by 神戸小鳥
parent 2f91709d1e
commit 322f775796
67 changed files with 2339 additions and 2243 deletions
+24
View File
@@ -0,0 +1,24 @@
import { useCallback } from 'react'
import { atom, useSetAtom, useAtomValue } from 'jotai'
import type { PullOptions } from '@remake/core'
export interface Config {
pick: number
pull: PullOptions
points: number
allocate: number
mode: number
}
export const configAtom = atom<Config | null>(null)
export const useConfigInject = () => {
const setConfig = useSetAtom(configAtom)
return useCallback((config: Config) => setConfig(config), [setConfig])
}
export const useConfig = () => {
const config = useAtomValue(configAtom)
if (!config) throw new Error('Game config is not set')
return config
}