Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Updates option for hms #783

Merged
merged 1 commit into from
Jul 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 24 additions & 16 deletions src/pages/settings/profile/index.jsx
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
import React, { useState } from 'react';
import Auth from '@aws-amplify/auth';
import nextConfig from 'next/config';
import _ from 'lodash';
import {
Form, Input, Empty, Row, Col, Button, Space, Checkbox, Typography,
} from 'antd';
import { useRouter } from 'next/router';

import Header from 'components/Header';
import endUserMessages from 'utils/endUserMessages';
import pushNotificationMessage from 'utils/pushNotificationMessage';
import handleError from 'utils/http/handleError';
import { useSelector, useDispatch } from 'react-redux';
import { loadUser } from 'redux/actions/user';

import { AccountId } from 'utils/deploymentInfo';

const accountId = nextConfig()?.publicRuntimeConfig?.accountId;

const { Text } = Typography;

const ProfileSettings = () => {
Expand Down Expand Up @@ -123,22 +129,24 @@ const ProfileSettings = () => {
<Form.Item label='Institution:'>
<Input disabled placeholder={user.attributes.institution} />
</Form.Item>
<Form.Item
label='Updates: '
>
<Space align='start' style={{ marginTop: '5px' }}>
<Checkbox
defaultChecked={user.attributes[agreedEmailsKey] === 'true'}
onChange={(e) => setChanges({
changedUserAttributes: { [agreedEmailsKey]: e.target.checked.toString() },
})}
/>
<Text>
I agree to receive updates about new features in Cellenics, research done with Cellenics, and Cellenics community events. (No external marketing.)
</Text>
</Space>
</Form.Item>

{accountId !== AccountId.HMS
&& (
<Form.Item
label='Updates: '
>
<Space align='start' style={{ marginTop: '5px' }}>
<Checkbox
defaultChecked={user.attributes[agreedEmailsKey] === 'true'}
onChange={(e) => setChanges({
changedUserAttributes: { [agreedEmailsKey]: e.target.checked.toString() },
})}
/>
<Text>
I agree to receive updates about new features in Cellenics, research done with Cellenics, and Cellenics community events. (No external marketing.)
</Text>
</Space>
</Form.Item>
)}
<h2 style={{ marginTop: '40px' }}>Password settings:</h2>
<Form.Item
label='Current password:' // pragma: allowlist secret
Expand Down