Skip to content

Commit

Permalink
feat: Add Snackbar for thank you message after feedback submission
Browse files Browse the repository at this point in the history
  • Loading branch information
MrOrz committed Jan 27, 2025
1 parent 12cd34f commit 2f799dc
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions components/AIReplySection/VoteButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
makeStyles,
Popover,
Typography,
Snackbar,
} from '@material-ui/core';
import cx from 'classnames';
import CloseIcon from '@material-ui/icons/Close';
Expand Down Expand Up @@ -92,6 +93,7 @@ function VoteButtons({ aiResponseId }: Props) {
] = useState<HTMLElement | null>(null);
const [currentVote, setCurrentVote] = useState<number>(0);
const [comment, setComment] = useState('');
const [showThankYouSnack, setShowThankYouSnack] = useState(false);

// Creates and updates score using the same ID
const scoreId = `${aiResponseId}__${aiReplyVoterId}`;
Expand Down Expand Up @@ -136,6 +138,7 @@ function VoteButtons({ aiResponseId }: Props) {
comment,
});
closeVotePopover();
setShowThankYouSnack(true);
};

return (
Expand Down Expand Up @@ -205,6 +208,11 @@ function VoteButtons({ aiResponseId }: Props) {
</Button>
</div>
</Popover>
<Snackbar
open={showThankYouSnack}
onClose={() => setShowThankYouSnack(false)}
message={t`Thank you for the feedback.`}
/>
</>
);
}
Expand Down

0 comments on commit 2f799dc

Please sign in to comment.