Mercurial
view love/epi/src/hooks/useComposer.ts @ 268:f7b1188d5fb1
support repo rules Copilot bundle path
Match both +_repo_rules2+ and +http_archive+ Copilot CLI repository layouts during deployment and production startup.
Co-authored-by: Copilot <[email protected]>
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Fri, 07 Aug 2026 13:02:41 -0700 |
| parents | cf9caa4abc3e |
| children |
line wrap: on
line source
import { useCallback } from 'react'; import { useAtom } from 'jotai'; import { composerTextAtom, composerStatusAtom } from '@/atoms/composerAtom'; export const useComposer = () => { const [text, setText] = useAtom(composerTextAtom); const [status, setStatus] = useAtom(composerStatusAtom); const setSending = useCallback(() => setStatus('sending' as const), [setStatus]); const setIdle = useCallback(() => setStatus('idle' as const), [setStatus]); const reset = useCallback(() => { setText(''); setIdle(); }, [setText, setIdle]); const isSending = status === 'sending'; const isEmpty = text.trim() === ''; return { text, setText, status, isSending, isEmpty, isDisabled: isEmpty && !isSending, setSending, setIdle, reset, }; };