-
Notifications
You must be signed in to change notification settings - Fork 714
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Improve settings panel (#2510)
* chore: Add settings to the settings panel * make minimize on close dependent of tray icon setting * add pt-BR translations
- Loading branch information
1 parent
38f4906
commit bc76a5d
Showing
12 changed files
with
202 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { ToggleSwitch, Field } from '@rocket.chat/fuselage'; | ||
import React, { ChangeEvent, Dispatch, FC, useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { RootAction } from '../../../../store/actions'; | ||
import { RootState } from '../../../../store/rootReducer'; | ||
import { SETTINGS_SET_IS_MENU_BAR_ENABLED_CHANGED } from '../../../actions'; | ||
|
||
type Props = { | ||
className?: string; | ||
}; | ||
|
||
export const MenuBar: FC<Props> = (props) => { | ||
const isMenuBarEnabled = useSelector( | ||
({ isMenuBarEnabled }: RootState) => isMenuBarEnabled | ||
); | ||
const dispatch = useDispatch<Dispatch<RootAction>>(); | ||
const { t } = useTranslation(); | ||
const handleChange = useCallback( | ||
(event: ChangeEvent<HTMLInputElement>) => { | ||
const isChecked = event.currentTarget.checked; | ||
dispatch({ | ||
type: SETTINGS_SET_IS_MENU_BAR_ENABLED_CHANGED, | ||
payload: isChecked, | ||
}); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
return ( | ||
<Field className={props.className}> | ||
<Field.Row> | ||
<ToggleSwitch onChange={handleChange} checked={isMenuBarEnabled} /> | ||
<Field.Label htmlFor='toggle-switch'> | ||
{t('settings.options.menubar.title')} | ||
</Field.Label> | ||
</Field.Row> | ||
<Field.Row> | ||
<Field.Hint>{t('settings.options.menubar.description')}</Field.Hint> | ||
</Field.Row> | ||
</Field> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { ToggleSwitch, Field } from '@rocket.chat/fuselage'; | ||
import React, { ChangeEvent, Dispatch, FC, useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { RootAction } from '../../../../store/actions'; | ||
import { RootState } from '../../../../store/rootReducer'; | ||
import { SETTINGS_SET_IS_SIDE_BAR_ENABLED_CHANGED } from '../../../actions'; | ||
|
||
type Props = { | ||
className?: string; | ||
}; | ||
|
||
export const SideBar: FC<Props> = (props) => { | ||
const isSideBarEnabled = useSelector( | ||
({ isSideBarEnabled }: RootState) => isSideBarEnabled | ||
); | ||
const dispatch = useDispatch<Dispatch<RootAction>>(); | ||
const { t } = useTranslation(); | ||
const handleChange = useCallback( | ||
(event: ChangeEvent<HTMLInputElement>) => { | ||
const isChecked = event.currentTarget.checked; | ||
dispatch({ | ||
type: SETTINGS_SET_IS_SIDE_BAR_ENABLED_CHANGED, | ||
payload: isChecked, | ||
}); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
return ( | ||
<Field className={props.className}> | ||
<Field.Row> | ||
<ToggleSwitch onChange={handleChange} checked={isSideBarEnabled} /> | ||
<Field.Label htmlFor='toggle-switch'> | ||
{t('settings.options.sidebar.title')} | ||
</Field.Label> | ||
</Field.Row> | ||
<Field.Row> | ||
<Field.Hint>{t('settings.options.sidebar.description')}</Field.Hint> | ||
</Field.Row> | ||
</Field> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { ToggleSwitch, Field } from '@rocket.chat/fuselage'; | ||
import React, { ChangeEvent, Dispatch, FC, useCallback } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
|
||
import { RootAction } from '../../../../store/actions'; | ||
import { RootState } from '../../../../store/rootReducer'; | ||
import { SETTINGS_SET_IS_TRAY_ICON_ENABLED_CHANGED } from '../../../actions'; | ||
|
||
type Props = { | ||
className?: string; | ||
}; | ||
|
||
export const TrayIcon: FC<Props> = (props) => { | ||
const isTrayIconEnabled = useSelector( | ||
({ isTrayIconEnabled }: RootState) => isTrayIconEnabled | ||
); | ||
const dispatch = useDispatch<Dispatch<RootAction>>(); | ||
const { t } = useTranslation(); | ||
const handleChange = useCallback( | ||
(event: ChangeEvent<HTMLInputElement>) => { | ||
const isChecked = event.currentTarget.checked; | ||
dispatch({ | ||
type: SETTINGS_SET_IS_TRAY_ICON_ENABLED_CHANGED, | ||
payload: isChecked, | ||
}); | ||
}, | ||
[dispatch] | ||
); | ||
|
||
return ( | ||
<Field className={props.className}> | ||
<Field.Row> | ||
<ToggleSwitch onChange={handleChange} checked={isTrayIconEnabled} /> | ||
<Field.Label htmlFor='toggle-switch'> | ||
{t('settings.options.trayIcon.title')} | ||
</Field.Label> | ||
</Field.Row> | ||
<Field.Row> | ||
<Field.Hint>{t('settings.options.trayIcon.description')}</Field.Hint> | ||
</Field.Row> | ||
</Field> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters