Skip to content

Commit

Permalink
Disable submit edit button when user input should be disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
yrliou committed Jul 16, 2024
1 parent 0b64a41 commit 0670c33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ function ConversationList(props: ConversationListProps) {
text={latestTurnText}
onSubmit={(text) => handleEditSubmit(id, text)}
onCancel={() => setEditInputId(null)}
isSubmitDisabled={shouldDisableUserInput}
/>
)}
{turn.selectedText && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ interface Props {
text: string
onSubmit: (text: string) => void
onCancel: () => void
isSubmitDisabled: boolean
}

function EditInput(props: Props) {
Expand Down Expand Up @@ -54,6 +55,7 @@ function EditInput(props: Props) {
<Button
size='small'
kind='filled'
isDisabled={props.isSubmitDisabled}
onClick={() => props.onSubmit(text)}
>
{getLocale('saveButtonLabel')}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function DataContextProvider(props: DataContextProviderProps) {
const [allModels, setAllModels] = React.useState<mojom.Model[]>([])
const [conversationHistory, setConversationHistory] = React.useState<mojom.ConversationTurn[]>([])
const [suggestedQuestions, setSuggestedQuestions] = React.useState<string[]>([])
const [isGenerating, setIsGenerating] = React.useState(false)
const [isGenerating, setIsGenerating] = React.useState(props.store?.isGenerating || false)
const [suggestionStatus, setSuggestionStatus] = React.useState<mojom.SuggestionGenerationStatus>(mojom.SuggestionGenerationStatus.None)
const [siteInfo, setSiteInfo] = React.useState<mojom.SiteInfo>({
title: undefined,
Expand Down

0 comments on commit 0670c33

Please sign in to comment.