Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions src/component/modal/setting/settings-tabs/DisplayTabContent.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Checkbox, Switch } from '@blueprintjs/core';
import { Switch } from '@blueprintjs/core';
import type { NMRiumPanelPreferences } from '@zakodium/nmrium-core';
import { useCallback, useMemo } from 'react';
import { Controller, useFormContext } from 'react-hook-form';
Expand All @@ -18,7 +18,7 @@ interface ListItem {
hideOpenOption?: boolean;
}

type PanelStatus = 'hidden' | 'available' | 'active';
type PanelStatus = 'hidden' | 'available' | 'active' | 'open';
interface PanelStatusItem {
label: string;
value: PanelStatus;
Expand All @@ -33,6 +33,10 @@ const PANEL_STATUS: PanelStatusItem[] = [
label: 'Available',
value: 'available',
},
{
label: 'Open',
value: 'open',
},
{
label: 'Active',
value: 'active',
Expand Down Expand Up @@ -108,6 +112,7 @@ function DisplayTabContent() {
(panelName: keyof NMRiumPanelPreferences, status: PanelStatus) => {
let visible = false;
let display = false;
let open = false;

if (status === 'available') {
visible = true;
Expand All @@ -117,7 +122,13 @@ function DisplayTabContent() {
visible = true;
display = true;
}
if (status === 'open') {
visible = true;
display = true;
open = true;
}

setValue(`${basePath}.${panelName}.open`, open);
setValue(`${basePath}.${panelName}.display`, display);
setValue(`${basePath}.${panelName}.visible`, visible);
},
Expand Down Expand Up @@ -172,19 +183,8 @@ function DisplayTabContent() {
/>
),
},
{
index: 4,
Header: 'Open on load',
style: { textAlign: 'center' },
Cell: ({ row }) => (
<Checkbox
style={{ margin: 0 }}
{...register(`${basePath}.${row.original.name}.open`)}
/>
),
},
],
[control, onChange, register],
[control, onChange],
);

return (
Expand Down
Loading