From 51d99c2aa37c60dd101b609d77bdd8d0ebb85fdc Mon Sep 17 00:00:00 2001 From: hamed musallam Date: Fri, 5 Sep 2025 10:15:57 +0200 Subject: [PATCH] refactor: combine panel status menu We remove 'open on load' column and have 4 choice in the select drop down menu: - Hidden - Available - Active = current active - Open = current active + open on load close #3685 --- .../settings-tabs/DisplayTabContent.tsx | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/component/modal/setting/settings-tabs/DisplayTabContent.tsx b/src/component/modal/setting/settings-tabs/DisplayTabContent.tsx index 02491dcd6e..3891538145 100644 --- a/src/component/modal/setting/settings-tabs/DisplayTabContent.tsx +++ b/src/component/modal/setting/settings-tabs/DisplayTabContent.tsx @@ -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'; @@ -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; @@ -33,6 +33,10 @@ const PANEL_STATUS: PanelStatusItem[] = [ label: 'Available', value: 'available', }, + { + label: 'Open', + value: 'open', + }, { label: 'Active', value: 'active', @@ -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; @@ -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); }, @@ -172,19 +183,8 @@ function DisplayTabContent() { /> ), }, - { - index: 4, - Header: 'Open on load', - style: { textAlign: 'center' }, - Cell: ({ row }) => ( - - ), - }, ], - [control, onChange, register], + [control, onChange], ); return (