* -added API to and template for unsubscribe comment thread * -changed public API url to make it sepratate from client public pages -included the unsubscribe link to email body * -made unsubscribe email notification API to private * -added unsubscribe page * -removed unused code * Update app/client/cypress/integration/Smoke_TestSuite/ClientSideTests/Comments/UnsubscribeEmail_spec.js Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com> * Update app/client/src/pages/common/UnsubscribeEmail.tsx Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com> * Update app/client/src/pages/common/UnsubscribeEmail.tsx Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com> * Update app/server/appsmith-server/src/main/java/com/appsmith/server/repositories/BaseAppsmithRepositoryImpl.java Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com> * -updated text as per lint error * -updated text as per lint error * -moved unsubscribe screen texts to messages.ts Co-authored-by: Arpit Mohan <mohanarpit@users.noreply.github.com>
73 lines
2.0 KiB
TypeScript
73 lines
2.0 KiB
TypeScript
import React from "react";
|
|
import styled from "styled-components";
|
|
import { useParams } from "react-router-dom";
|
|
import { unsubscribeCommentThreadAction } from "actions/commentActions";
|
|
import { useDispatch, useSelector } from "react-redux";
|
|
import { isUnsubscribedSelector } from "selectors/commentsSelectors";
|
|
import {
|
|
createMessage,
|
|
UNSUBSCRIBE_EMAIL_SUCCESS,
|
|
UNSUBSCRIBE_EMAIL_MSG_1,
|
|
UNSUBSCRIBE_EMAIL_MSG_2,
|
|
UNSUBSCRIBE_EMAIL_CONFIRM_MSG,
|
|
UNSUBSCRIBE_BUTTON_LABEL,
|
|
} from "constants/messages";
|
|
|
|
const Wrapper = styled.div`
|
|
height: calc(100vh - ${(props) => props.theme.headerHeight});
|
|
background-color: #fafafa;
|
|
text-align: center;
|
|
padding-top: calc(${(props) => props.theme.headerHeight} + 50px);
|
|
.bold-text {
|
|
font-weight: ${(props) => props.theme.fontWeights[3]};
|
|
font-size: 24px;
|
|
}
|
|
.button-position {
|
|
margin: auto;
|
|
}
|
|
`;
|
|
const UnsubscribeButton = styled.button`
|
|
background-color: #f3672a;
|
|
color: white;
|
|
height: 40px;
|
|
width: 300px;
|
|
border: none;
|
|
cursor: pointer;
|
|
font-weight: 600;
|
|
font-size: 17px;
|
|
margin-top: 40px;
|
|
`;
|
|
|
|
function UnsubscribeEmail() {
|
|
const params = useParams<{ threadId: string }>();
|
|
const dispatch = useDispatch();
|
|
const isUnsubscribed = useSelector(isUnsubscribedSelector);
|
|
|
|
const unsubscribeCommentThread = () => {
|
|
dispatch(unsubscribeCommentThreadAction(params.threadId));
|
|
};
|
|
|
|
return (
|
|
<Wrapper>
|
|
<div>
|
|
<p className="bold-text">Unsubscribe</p>
|
|
{isUnsubscribed ? (
|
|
<p>{createMessage(UNSUBSCRIBE_EMAIL_SUCCESS)}</p>
|
|
) : (
|
|
<>
|
|
<p>{createMessage(UNSUBSCRIBE_EMAIL_MSG_1)}</p>
|
|
<p>{createMessage(UNSUBSCRIBE_EMAIL_MSG_2)}</p>
|
|
<p>{createMessage(UNSUBSCRIBE_EMAIL_CONFIRM_MSG)}</p>
|
|
|
|
<UnsubscribeButton onClick={unsubscribeCommentThread}>
|
|
{createMessage(UNSUBSCRIBE_BUTTON_LABEL)}
|
|
</UnsubscribeButton>
|
|
</>
|
|
)}
|
|
</div>
|
|
</Wrapper>
|
|
);
|
|
}
|
|
|
|
export default UnsubscribeEmail;
|