mirror of
https://github.com/plankanban/planka.git
synced 2025-07-25 08:09:44 +02:00
Add preferences tab to user settings, add subscribe to own cards option
This commit is contained in:
parent
f3e0cadca6
commit
6a82448dc7
13 changed files with 96 additions and 2 deletions
34
client/src/components/UserSettingsModal/PreferencesPane.jsx
Normal file
34
client/src/components/UserSettingsModal/PreferencesPane.jsx
Normal 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;
|
|
@ -0,0 +1,4 @@
|
|||
.wrapper {
|
||||
border: none !important;
|
||||
box-shadow: none !important;
|
||||
}
|
|
@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
|
|||
import { Modal, Tab } from 'semantic-ui-react';
|
||||
|
||||
import AccountPane from './AccountPane';
|
||||
import PreferencesPane from './PreferencesPane';
|
||||
|
||||
const UserSettingsModal = React.memo(
|
||||
({
|
||||
|
@ -13,6 +14,7 @@ const UserSettingsModal = React.memo(
|
|||
avatar,
|
||||
phone,
|
||||
organization,
|
||||
subscribeToOwnCards,
|
||||
isAvatarUploading,
|
||||
usernameUpdateForm,
|
||||
emailUpdateForm,
|
||||
|
@ -57,12 +59,26 @@ const UserSettingsModal = React.memo(
|
|||
/>
|
||||
),
|
||||
},
|
||||
{
|
||||
menuItem: t('common.preferences', {
|
||||
context: 'title',
|
||||
}),
|
||||
render: () => (
|
||||
<PreferencesPane subscribeToOwnCards={subscribeToOwnCards} onUpdate={onUpdate} />
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
return (
|
||||
<Modal open closeIcon size="small" centered={false} onClose={onClose}>
|
||||
<Modal.Content>
|
||||
<Tab menu={{ secondary: true, pointing: true }} panes={panes} />
|
||||
<Tab
|
||||
menu={{
|
||||
secondary: true,
|
||||
pointing: true,
|
||||
}}
|
||||
panes={panes}
|
||||
/>
|
||||
</Modal.Content>
|
||||
</Modal>
|
||||
);
|
||||
|
@ -76,6 +92,7 @@ UserSettingsModal.propTypes = {
|
|||
avatar: PropTypes.string,
|
||||
phone: PropTypes.string,
|
||||
organization: PropTypes.string,
|
||||
subscribeToOwnCards: PropTypes.bool.isRequired,
|
||||
isAvatarUploading: PropTypes.bool.isRequired,
|
||||
/* eslint-disable react/forbid-prop-types */
|
||||
usernameUpdateForm: PropTypes.object.isRequired,
|
||||
|
|
|
@ -23,6 +23,7 @@ const mapStateToProps = (state) => {
|
|||
avatar,
|
||||
phone,
|
||||
organization,
|
||||
subscribeToOwnCards,
|
||||
isAvatarUploading,
|
||||
emailUpdateForm,
|
||||
passwordUpdateForm,
|
||||
|
@ -36,6 +37,7 @@ const mapStateToProps = (state) => {
|
|||
avatar,
|
||||
phone,
|
||||
organization,
|
||||
subscribeToOwnCards,
|
||||
isAvatarUploading,
|
||||
emailUpdateForm,
|
||||
passwordUpdateForm,
|
||||
|
|
|
@ -86,12 +86,14 @@ export default {
|
|||
optional_inline: 'optional',
|
||||
organization: 'Organization',
|
||||
phone: 'Phone',
|
||||
preferences: 'Preferences',
|
||||
projectNotFound_title: 'Project Not Found',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates:
|
||||
'<0>Refresh the page</0> to load last data<br />and receive updates',
|
||||
removeMember_title: 'Remove Member',
|
||||
seconds: 'Seconds',
|
||||
settings: 'Settings',
|
||||
subscribeToMyOwnCardsByDefault: 'Subscribe to my own cards by default',
|
||||
taskActions_title: 'Task Actions',
|
||||
tasks: 'Tasks',
|
||||
time: 'Time',
|
||||
|
|
|
@ -90,12 +90,14 @@ export default {
|
|||
optional_inline: 'необязательно',
|
||||
organization: 'Организация',
|
||||
phone: 'Телефон',
|
||||
preferences: 'Предпочтения',
|
||||
projectNotFound: 'Доска не найдена',
|
||||
refreshPageToLoadLastDataAndReceiveUpdates:
|
||||
'<0>Обновите страницу</0>, чтобы загрузить<br />актуальные данные и получать обновления',
|
||||
removeMember: 'Удаление участника',
|
||||
seconds: 'Секунды',
|
||||
settings: 'Настройки',
|
||||
subscribeToMyOwnCardsByDefault: 'По умолчанию подписаться на мои собственные карточки',
|
||||
taskActions: 'Действия с задачей',
|
||||
tasks: 'Задачи',
|
||||
time: 'Время',
|
||||
|
|
|
@ -39,6 +39,7 @@ export default class extends Model {
|
|||
avatar: attr(),
|
||||
phone: attr(),
|
||||
organization: attr(),
|
||||
subscribeToOwnCards: attr(),
|
||||
deletedAt: attr(),
|
||||
isAdmin: attr({
|
||||
getDefault: () => false,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue