From 469359807d197d71bba84c621232dca6601dc181 Mon Sep 17 00:00:00 2001 From: Pabloader Date: Fri, 1 Nov 2024 21:27:20 +0000 Subject: [PATCH] AIStory: add blocking ui on generation --- src/games/ai/assets/style.css | 6 ++++ src/games/ai/components/input.tsx | 4 ++- src/games/ai/components/minichat/minichat.tsx | 28 +++++++++++++------ src/games/ai/contexts/llm.tsx | 4 +-- 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/src/games/ai/assets/style.css b/src/games/ai/assets/style.css index 890c9ff..da4c5be 100644 --- a/src/games/ai/assets/style.css +++ b/src/games/ai/assets/style.css @@ -53,6 +53,12 @@ button { background-color: var(--backgroundColor); color: var(--color); cursor: pointer; + user-select: none; + + &.disabled { + pointer-events: none; + opacity: 0.5; + } } body { diff --git a/src/games/ai/components/input.tsx b/src/games/ai/components/input.tsx index 9094c38..5ccbfb6 100644 --- a/src/games/ai/components/input.tsx +++ b/src/games/ai/components/input.tsx @@ -7,6 +7,8 @@ export const Input = () => { const { input, setInput, addMessage, continueMessage } = useContext(StateContext); const { generating } = useContext(LLMContext); + console.log({generating}); + const handleChange = useCallback((e: Event) => { if (e.target instanceof HTMLTextAreaElement) { setInput(e.target.value); @@ -36,7 +38,7 @@ export const Input = () => { return (