Skip to content

Commit

Permalink
Merge pull request #551 from marcussfu/master
Browse files Browse the repository at this point in the history
feat: add login alert for comment click
  • Loading branch information
MrOrz committed Oct 18, 2023
2 parents b029213 + 5f3bcb7 commit 2b90d06
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion components/CreateReplyRequestForm/CreateReplyRequestForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,14 @@ const CreateReplyRequestForm = React.memo(
const classes = useStyles();
const user = useCurrentUser();

const onCommentButtonClick = () => {
if (user) setShowForm(!showForm);
else {
setShowForm(false);
alert(t`Please login first.`);
}
};

return (
<>
<CardContent>
Expand Down Expand Up @@ -251,7 +259,7 @@ const CreateReplyRequestForm = React.memo(
>
<Button
className={cx({ [classes.isButtonActive]: showForm })}
onClick={() => setShowForm(!showForm)}
onClick={onCommentButtonClick}
disableElevation
>
{ownReplyRequest ? t`Update comment` : t`Comment`}
Expand Down

0 comments on commit 2b90d06

Please sign in to comment.