Skip to content

Commit

Permalink
[frontend] Add forgotten feature flag (#8134)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9eac7e2)
  • Loading branch information
Kedae committed Aug 23, 2024
1 parent 0915ce3 commit cdcfd82
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
import React from 'react';
import NavToolbarMenu, { MenuEntry } from '@components/common/menus/NavToolbarMenu';
import useHelper from '../../../utils/hooks/useHelper';

const ImportMenu = () => {
const { isFeatureEnable } = useHelper();
const isDataTableEnabled = isFeatureEnable('DATA_TABLES');
if (!isDataTableEnabled) {
return (
<NavToolbarMenu
entries={[{
path: '/dashboard/data/import',
label: 'Import',
}]}
/>
);
}
const entries: MenuEntry[] = [
{
path: '/dashboard/data/import',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@ import Import from './Import';
import WorkbenchFile from '../../common/files/workbench/WorkbenchFile';
import ImportFilesContent from './ImportFilesContent';
import ImportWorkbenchesContent from './ImportWorkbenchesContent';
import useHelper from '../../../../utils/hooks/useHelper';

const Root = () => (
<Routes>
<Route path="/" Component={Import} />
<Route
path="/pending/:fileId"
element={<WorkbenchFile />}
/>
<Route
path="/file"
element={<ImportFilesContent />}
/>
<Route
path="/workbench"
element={<ImportWorkbenchesContent />}
/>
</Routes>
);
const Root = () => {
const { isFeatureEnable } = useHelper();
const isDataTableEnabled = isFeatureEnable('DATA_TABLES');
return (
<Routes>
<Route path="/" Component={Import} />
<Route
path="/pending/:fileId"
element={<WorkbenchFile />}
/>
{isDataTableEnabled && (
<Route
path="/file"
element={<ImportFilesContent />}
/>
)}
{isDataTableEnabled && (
<Route
path="/workbench"
element={<ImportWorkbenchesContent />}
/>
)}
</Routes>
);
};

export default Root;

0 comments on commit cdcfd82

Please sign in to comment.