Skip to content

Commit b9d6431

Browse files
committed
combine model + hasPermission
1 parent b6c7069 commit b9d6431

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

src/components/organisms/RiskHotspotModel.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useTranslation } from 'react-i18next';
44
import { useStore } from '../../stores/storeConfig';
55
import { observer } from 'mobx-react';
66
import { Loader } from '../common';
7+
import ModelTabs from '../model/ModelTabs';
78

89
const EnvelopeIcon = ({ color = 'white', size = 20 }: { color?: string; size?: number }) => (
910
<svg
@@ -28,17 +29,15 @@ const EnvelopeIcon = ({ color = 'white', size = 20 }: { color?: string; size?: n
2829
const RiskHotspotModel = observer(() => {
2930
const { t } = useTranslation();
3031
const { userStore } = useStore();
31-
3232
if (userStore.isLoading) {
3333
return <Loader />;
3434
}
35-
3635
const hasPermission = userStore.isAuthenticated && userStore.hasEditPermission;
3736

3837
if (hasPermission) {
3938
return (
4039
<div>
41-
<h1>{t('RiskModel')}</h1>
40+
<ModelTabs/>
4241
</div>
4342
);
4443
}

src/components/templates/Header/Header.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,16 @@ const Header: React.FC<IProps> = observer(({ title }) => {
7575
<Button
7676
variant='outline-light'
7777
size='sm'
78-
className='d-flex align-items-center px-3'
78+
className='d-flex align-items-center px-3 gap-2'
7979
onClick={onLoginHandler}
8080
style={{ borderRadius: '20px', fontWeight: 500 }}
8181
>
8282
{loginText}
8383
{isAuthenticated && user?.oauth_provider_user_picture_url ? (
84-
<img src={user?.oauth_provider_user_picture_url || ''} alt='user' />
84+
<img src={user?.oauth_provider_user_picture_url || ''}
85+
alt='user'
86+
style={{ width: 18, height: 18, borderRadius: '5%' }}
87+
/>
8588
) : (
8689
<UserIcon />
8790
)}

src/components/templates/ModelTemplate.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ import WithSidebarTemplate from './WithSidebarTemplate';
1212
import { setCurrentPage, setInitPage } from '../../stores/ui/appUiSlice';
1313
import { setStoreByQuery } from '../../stores/ui/appUiThunks';
1414
import { RootState, AppDispatch } from '../../stores/store';
15-
import ModelTabs from '../model/ModelTabs';
15+
import { FeatureFlags, isFeatureEnabled } from '../../utils/featureFlags';
16+
import RiskHotspotModel from '../organisms/RiskHotspotModel';
1617

1718
interface IProps { }
1819
const ModelTemplate: React.FC<IProps> = observer(() => {
@@ -50,7 +51,7 @@ const ModelTemplate: React.FC<IProps> = observer(() => {
5051
<ButtonShowFilterModal />
5152
</div>
5253
{showFilterModal && memoConfigModal}
53-
<ModelTabs />
54+
{isFeatureEnabled(FeatureFlags.RISK_MODEL) && (<RiskHotspotModel />)}
5455
</div>
5556
</WithSidebarTemplate>
5657
);

src/components/templates/TabsTemplate.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { useStore } from '../../stores/storeConfig';
88
import { useDispatch, useSelector } from 'react-redux';
99
import { AppDispatch, RootState } from '../../stores/store';
1010
import { setCurrentTab } from '../../stores';
11-
import { FeatureFlags, isFeatureEnabled } from '../../utils/featureFlags';
1211

1312
// import MapPage from '../../pages/MapPage';
1413
interface IProps {
@@ -20,7 +19,7 @@ const GroupByTablesPanel = lazy(() => import('../groupTable/GroupByTablesPanel')
2019
const MapAccidents = lazy(() => import('../map/AccidentsMap'));
2120
const AccidentsTable = lazy(() => import('../detailsTable/AccidentsTable'));
2221
const MyImageGallery = lazy(() => import('../organisms/MyImageGallery'));
23-
const RiskHotspotModel = lazy(() => import('../organisms/RiskHotspotModel'));
22+
//const RiskHotspotModel = lazy(() => import('../organisms/RiskHotspotModel'));
2423

2524
const styles = {
2625
tab: { marginTop: '0.5rem' },
@@ -87,7 +86,7 @@ export const TabsTemplate: FunctionComponent<IProps> = observer(({ type }) => {
8786
</Suspense>
8887
</ErrorBoundary>
8988
</Tab>
90-
{isFeatureEnabled(FeatureFlags.RISK_MODEL) && (
89+
{/* {isFeatureEnabled(FeatureFlags.RISK_MODEL) && (
9190
<Tab style={styles.tab} eventKey='riskModel' title={t('RiskModel')}>
9291
<ErrorBoundary>
9392
<Suspense fallback={<Loader />}>
@@ -97,7 +96,7 @@ export const TabsTemplate: FunctionComponent<IProps> = observer(({ type }) => {
9796
</Suspense>
9897
</ErrorBoundary>
9998
</Tab>
100-
)}
99+
)} */}
101100
</Tabs>
102101
);
103102
});

0 commit comments

Comments
 (0)