From 87acb8816a89c53a3420421d5ba0c3666a5d713f Mon Sep 17 00:00:00 2001 From: Woody Date: Fri, 24 Apr 2026 15:56:35 +0800 Subject: [PATCH] feat(frontend): display submitted question below input (sub-phase 2.2) Show submitted question as italic text below the input area after clicking submit. Clears when user starts typing a new question. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus --- frontend/src/components/QueryInput.tsx | 32 ++++++++++---- .../src/test/components/QueryInput.test.tsx | 42 +++++++++++++++++++ 2 files changed, 66 insertions(+), 8 deletions(-) diff --git a/frontend/src/components/QueryInput.tsx b/frontend/src/components/QueryInput.tsx index 9f03d9c..7486b59 100644 --- a/frontend/src/components/QueryInput.tsx +++ b/frontend/src/components/QueryInput.tsx @@ -7,12 +7,14 @@ export interface QueryInputProps { export const QueryInput: React.FC = ({ onSubmit, isLoading }) => { const [question, setQuestion] = useState('') + const [submittedQuestion, setSubmittedQuestion] = useState(null) const handleSubmit = (e: FormEvent): void => { e.preventDefault() const trimmed = question.trim() if (trimmed && !isLoading) { onSubmit(trimmed) + setSubmittedQuestion(trimmed) setQuestion('') } } @@ -24,26 +26,40 @@ export const QueryInput: React.FC = ({ onSubmit, isLoading }) = } } + const handleChange = (e: React.ChangeEvent): void => { + setQuestion(e.target.value) + if (e.target.value.trim() !== '') { + setSubmittedQuestion(null) + } + } + const isDisabled = isLoading || question.trim() === '' return (