Skip to content

Commit f26b72a

Browse files
refactor: hide paste and copy workspace behind experimental flag
1 parent 988a280 commit f26b72a

1 file changed

Lines changed: 34 additions & 17 deletions

File tree

src/component/modal/setting/GeneralSettings.tsx

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { Classes, Dialog, DialogFooter, Tab, Tabs } from '@blueprintjs/core';
22
import styled from '@emotion/styled';
33
import { yupResolver } from '@hookform/resolvers/yup';
44
import type { Workspace } from '@zakodium/nmrium-core';
5+
import dlv from 'dlv';
56
import { useCallback, useEffect, useMemo, useRef } from 'react';
67
import {
78
FormProvider,
@@ -330,6 +331,13 @@ function WorkSpaceActionsButtons(props) {
330331
const toaster = useToaster();
331332
const { reset } = useFormContext<WorkspaceWithSource>();
332333
const values = useWatch();
334+
335+
const isExperimentalFeatures = dlv(
336+
values,
337+
'display.general.experimentalFeatures.display',
338+
false,
339+
);
340+
333341
const {
334342
originalWorkspaces,
335343
workspace: { current: workspaceName },
@@ -391,23 +399,32 @@ function WorkSpaceActionsButtons(props) {
391399
>
392400
<FaBolt className={Classes.ICON} />
393401
</Button>
394-
<StyledButton
395-
variant="outlined"
396-
onClick={handleCopyWorkspace}
397-
tooltipProps={{ content: 'Copy workspace preferences', compact: true }}
398-
marginHorizontal={5}
399-
>
400-
<FaRegCopy className={Classes.ICON} />
401-
</StyledButton>
402-
<Button
403-
variant="outlined"
404-
intent="success"
405-
onClick={handlePastWorkspaceAction}
406-
tooltipProps={{ content: 'Paste workspace preferences', compact: true }}
407-
>
408-
<FaPaste className={Classes.ICON} />
409-
</Button>
410-
402+
{isExperimentalFeatures && (
403+
<>
404+
<StyledButton
405+
variant="outlined"
406+
onClick={handleCopyWorkspace}
407+
tooltipProps={{
408+
content: 'Copy workspace preferences',
409+
compact: true,
410+
}}
411+
marginHorizontal={5}
412+
>
413+
<FaRegCopy className={Classes.ICON} />
414+
</StyledButton>
415+
<Button
416+
variant="outlined"
417+
intent="success"
418+
onClick={handlePastWorkspaceAction}
419+
tooltipProps={{
420+
content: 'Paste workspace preferences',
421+
compact: true,
422+
}}
423+
>
424+
<FaPaste className={Classes.ICON} />
425+
</Button>
426+
</>
427+
)}
411428
<ClipboardFallbackModal
412429
mode={shouldFallback}
413430
onDismiss={cleanShouldFallback}

0 commit comments

Comments
 (0)