@atlaskit/focused-task-close-account
Version:
This package contains all of the UI components needed to assemble the focused tasks for deactivating and deleting users' accounts in accordance with the GDPR "Right to be forgotten".
60 lines • 3.3 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _defineProperty from "@babel/runtime/helpers/defineProperty";
import React from 'react';
import { FormattedMessage } from 'react-intl-next';
import Avatar from '@atlaskit/avatar';
import { contentPreviewMessages } from '../../messages';
import * as Styled from './styled';
import MessagesIntlProvider from '../MessagesIntlProvider';
export class DeleteUserContentPreviewScreen extends React.Component {
constructor(...args) {
super(...args);
_defineProperty(this, "state", {
currentActive: -1
});
_defineProperty(this, "handleClickSection", (userName, position) => () => {
this.props.preferenceSelection(userName);
this.setState({
currentActive: position
});
});
_defineProperty(this, "isCardSelected", position => {
return position === this.state.currentActive;
});
_defineProperty(this, "selectAdminOrSelfCopy", (adminCopy, selfCopy) => {
return this.props.isCurrentUser ? selfCopy : adminCopy;
});
}
componentDidMount() {
this.props.preferenceSelection('');
}
render() {
const {
user
} = this.props;
return /*#__PURE__*/React.createElement(MessagesIntlProvider, null, /*#__PURE__*/React.createElement(Styled.Screen, null, /*#__PURE__*/React.createElement(Styled.Title, null, /*#__PURE__*/React.createElement(FormattedMessage, this.selectAdminOrSelfCopy(contentPreviewMessages.headingAdmin, contentPreviewMessages.headingSelf))), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, this.selectAdminOrSelfCopy(contentPreviewMessages.paragraphSurveyAdmin, contentPreviewMessages.paragraphSurveySelf), {
tagName: "p"
})), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, this.selectAdminOrSelfCopy(contentPreviewMessages.lineSurveyAdmin, contentPreviewMessages.lineSurveySelf), {
tagName: "p"
})), /*#__PURE__*/React.createElement(Styled.SectionCard, {
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
className: "nameSectionCard",
onClick: this.handleClickSection('Name', 1),
isSelected: 1 === this.state.currentActive
}, /*#__PURE__*/React.createElement(Styled.Avatar, null, /*#__PURE__*/React.createElement(Avatar, {
size: "large",
src: ""
})), /*#__PURE__*/React.createElement(Styled.UserDetails, null, user.fullName)), /*#__PURE__*/React.createElement(Styled.SectionCard, {
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-classname-prop -- Ignored via go/DSP-18766
className: "formerUserSectionCard",
onClick: this.handleClickSection('Former User', 0),
isSelected: 0 === this.state.currentActive
}, /*#__PURE__*/React.createElement(Styled.Avatar, null, /*#__PURE__*/React.createElement(Avatar, {
size: "large",
src: ""
})), /*#__PURE__*/React.createElement(Styled.UserDetails, null, /*#__PURE__*/React.createElement(FormattedMessage, contentPreviewMessages.formerUser))), /*#__PURE__*/React.createElement(FormattedMessage, _extends({}, this.selectAdminOrSelfCopy(contentPreviewMessages.footnoteAdmin, contentPreviewMessages.footnoteSelf), {
tagName: "p"
}))));
}
}
export default DeleteUserContentPreviewScreen;