Add preferences tab to user settings, add subscribe to own cards option

This commit is contained in:
Maksim Eltyshev
2020-04-10 00:11:34 +05:00
parent 9b4e3931a9
commit 88314e826d
13 changed files with 96 additions and 2 deletions

View File

@@ -0,0 +1,34 @@
import React, { useCallback } from 'react';
import PropTypes from 'prop-types';
import { useTranslation } from 'react-i18next';
import { Radio, Tab } from 'semantic-ui-react';
import styles from './PreferencesPane.module.css';
const PreferencesPane = React.memo(({ subscribeToOwnCards, onUpdate }) => {
const [t] = useTranslation();
const handleSubscribeToOwnCardsChange = useCallback(() => {
onUpdate({
subscribeToOwnCards: !subscribeToOwnCards,
});
}, [subscribeToOwnCards, onUpdate]);
return (
<Tab.Pane attached={false} className={styles.wrapper}>
<Radio
toggle
checked={subscribeToOwnCards}
label={t('common.subscribeToMyOwnCardsByDefault')}
onChange={handleSubscribeToOwnCardsChange}
/>
</Tab.Pane>
);
});
PreferencesPane.propTypes = {
subscribeToOwnCards: PropTypes.bool.isRequired,
onUpdate: PropTypes.func.isRequired,
};
export default PreferencesPane;