Add preferences tab to user settings, add subscribe to own cards option
parent
9b4e3931a9
commit
88314e826d
@ -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;
|
||||
@ -0,0 +1,4 @@
|
||||
.wrapper {
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
||||
Loading…
Reference in New Issue