Skip to content

Commit

Permalink
fix: Add back button to settings (#2949)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanfbrito authored Sep 25, 2024
1 parent 9602341 commit 9391b10
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/ui/components/SettingsView/SettingsView.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { Box, Tabs } from '@rocket.chat/fuselage';
import { Box, IconButton, Tabs } from '@rocket.chat/fuselage';
import '@rocket.chat/fuselage-polyfills';
import { useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useSelector } from 'react-redux';

import { dispatch } from '../../../store';
import type { RootState } from '../../../store/rootReducer';
import { DOWNLOADS_BACK_BUTTON_CLICKED } from '../../actions';
import { CertificatesTab } from './CertificatesTab';
import { GeneralTab } from './GeneralTab';

Expand All @@ -16,6 +18,20 @@ export const SettingsView = () => {

const [currentTab, setCurrentTab] = useState('general');

const isSideBarEnabled = useSelector(
({ isSideBarEnabled }: RootState) => isSideBarEnabled
);

const lastSelectedServerUrl = useSelector(
({ lastSelectedServerUrl }: RootState) => lastSelectedServerUrl
);

const handleBackButton = function (): void {
dispatch({
type: DOWNLOADS_BACK_BUTTON_CLICKED,
payload: lastSelectedServerUrl,
});
};
return (
<Box
display={isVisible ? 'flex' : 'none'}
Expand All @@ -35,6 +51,9 @@ export const SettingsView = () => {
fontScale='h1'
color='font-default'
>
{!isSideBarEnabled && (
<IconButton icon='arrow-back' onClick={handleBackButton} />
)}
{t('settings.title')}
</Box>

Expand Down

0 comments on commit 9391b10

Please sign in to comment.