Skip to content

Commit

Permalink
feat: Add feedback comment to message buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
alimtunc committed Aug 28, 2023
1 parent 89b5c41 commit 7c9990c
Showing 1 changed file with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import toast from 'react-hot-toast';
import { useRecoilValue } from 'recoil';
import { useToggle } from 'usehooks-ts';

import { StickyNote2 } from '@mui/icons-material';
import ThumbDownAlt from '@mui/icons-material/ThumbDownAlt';
import ThumbDownAltOutlined from '@mui/icons-material/ThumbDownAltOutlined';
import ThumbUpAlt from '@mui/icons-material/ThumbUpAlt';
Expand All @@ -30,7 +31,9 @@ export default function FeedbackButtons({ message }: Props) {
const accessToken = useRecoilValue(accessTokenState);
const messages = useRecoilValue(messagesState);

const [commentInput, setCommentInput] = useState('');
const [commentInput, setCommentInput] = useState(
message.humanFeedbackComment || ''
);
const [feedback, setFeedback] = useState(
message.humanFeedback || FeedbackStatus.DEFAULT
);
Expand Down Expand Up @@ -60,7 +63,6 @@ export default function FeedbackButtons({ message }: Props) {
}

onSuccess && onSuccess();
setCommentInput('');
} catch (err) {
console.log(err);
}
Expand Down Expand Up @@ -143,6 +145,13 @@ export default function FeedbackButtons({ message }: Props) {
<UpIcon sx={{ width: size, height: size }} />
</IconButton>
</Tooltip>
{commentInput && commentInput !== '' ? (
<Tooltip title="Feedback comment">
<IconButton onClick={toggleFeedbackDialog} size="small">
<StickyNote2 sx={{ width: size, height: size }} />
</IconButton>
</Tooltip>
) : null}
{renderDialog()}
</Stack>
);
Expand Down

0 comments on commit 7c9990c

Please sign in to comment.