Mercurial
view love/epi/src/atoms/composerAtom.ts @ 273:e02e2036ef84 default tip
add Layer 2 JRPG component system
Add reusable content and window modals, an isolated component sandbox, shared cyberpunk scroll areas, production-safe cache freshness, and server-rendered JRPG panel state.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Sat, 08 Aug 2026 02:08:08 -0700 |
| parents | cf9caa4abc3e |
| children |
line wrap: on
line source
import { atom } from 'jotai'; export type ComposerState = 'idle' | 'sending'; export interface ComposerValue { text: string; state: ComposerState; } export const composerAtom = atom<ComposerValue>({ text: '', state: 'idle', }); export const composerTextAtom = atom( (get) => get(composerAtom).text, (get, set, newText: string) => { set(composerAtom, { ...get(composerAtom), text: newText }); }, ); export const composerStatusAtom = atom( (get) => get(composerAtom).state, (get, set, newState: ComposerState) => { set(composerAtom, { ...get(composerAtom), state: newState }); }, );