Mercurial
comparison love/epi/src/atoms/composerAtom.ts @ 38:cf9caa4abc3e
[Love] FE and BE. Can chat and render images. Also created MCP for powerpoint generations.
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Mon, 01 Dec 2025 20:35:56 -0800 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 37:fb9bcd3145cb | 38:cf9caa4abc3e |
|---|---|
| 1 import { atom } from 'jotai'; | |
| 2 | |
| 3 export type ComposerState = 'idle' | 'sending'; | |
| 4 | |
| 5 export interface ComposerValue { | |
| 6 text: string; | |
| 7 state: ComposerState; | |
| 8 } | |
| 9 | |
| 10 export const composerAtom = atom<ComposerValue>({ | |
| 11 text: '', | |
| 12 state: 'idle', | |
| 13 }); | |
| 14 | |
| 15 export const composerTextAtom = atom( | |
| 16 (get) => get(composerAtom).text, | |
| 17 (get, set, newText: string) => { | |
| 18 set(composerAtom, { ...get(composerAtom), text: newText }); | |
| 19 }, | |
| 20 ); | |
| 21 | |
| 22 export const composerStatusAtom = atom( | |
| 23 (get) => get(composerAtom).state, | |
| 24 (get, set, newState: ComposerState) => { | |
| 25 set(composerAtom, { ...get(composerAtom), state: newState }); | |
| 26 }, | |
| 27 ); |