Skip to content

Commit 2f799dc

Browse files
committed
feat: Add Snackbar for thank you message after feedback submission
1 parent 12cd34f commit 2f799dc

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

components/AIReplySection/VoteButtons.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {
44
makeStyles,
55
Popover,
66
Typography,
7+
Snackbar,
78
} from '@material-ui/core';
89
import cx from 'classnames';
910
import CloseIcon from '@material-ui/icons/Close';
@@ -92,6 +93,7 @@ function VoteButtons({ aiResponseId }: Props) {
9293
] = useState<HTMLElement | null>(null);
9394
const [currentVote, setCurrentVote] = useState<number>(0);
9495
const [comment, setComment] = useState('');
96+
const [showThankYouSnack, setShowThankYouSnack] = useState(false);
9597

9698
// Creates and updates score using the same ID
9799
const scoreId = `${aiResponseId}__${aiReplyVoterId}`;
@@ -136,6 +138,7 @@ function VoteButtons({ aiResponseId }: Props) {
136138
comment,
137139
});
138140
closeVotePopover();
141+
setShowThankYouSnack(true);
139142
};
140143

141144
return (
@@ -205,6 +208,11 @@ function VoteButtons({ aiResponseId }: Props) {
205208
</Button>
206209
</div>
207210
</Popover>
211+
<Snackbar
212+
open={showThankYouSnack}
213+
onClose={() => setShowThankYouSnack(false)}
214+
message={t`Thank you for the feedback.`}
215+
/>
208216
</>
209217
);
210218
}

0 commit comments

Comments
 (0)