view love/epi/src/atoms/composerAtom.ts @ 266:efaf4c63cc94

fix clean production bundle staging Recreate deployment staging before copying the Bazel bundle and verify required inference runtime paths before promoting it. Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Fri, 07 Aug 2026 12:52:30 -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 });
  },
);