mau coba di hangtuah yang sudah oke fitur exp nya

This commit is contained in:
mario
2025-04-11 16:43:12 +07:00
parent a78c918963
commit 02a1abc93f
4 changed files with 297 additions and 13 deletions

View File

@@ -71,11 +71,25 @@ const SidePanelWithServices = ({
const activatePanelSubscription = panelService.subscribe(
panelService.EVENTS.ACTIVATE_PANEL,
(activatePanelEvent: Types.ActivatePanelEvent) => {
if (sidePanelOpen || activatePanelEvent.forceActive) {
const tabIndex = tabs.findIndex(tab => tab.id === activatePanelEvent.panelId);
if (tabIndex !== -1) {
setActiveTabIndex(tabIndex);
// Handle the `-exp` suffix logic
const isExpertisePanel = activatePanelEvent.panelId.endsWith('-exp');
const realPanelID = isExpertisePanel
? activatePanelEvent.panelId.replace(/-exp$/, '')
: activatePanelEvent.panelId;
const tabIndex = tabs.findIndex(tab => tab.id === realPanelID);
if (isExpertisePanel && side === 'right') {
const shouldOpen = !sidePanelOpen; // Use sidePanelOpen to determine toggle state
setSidePanelOpen(shouldOpen);
if (shouldOpen) {
setActiveTabIndex(tabIndex !== -1 ? tabIndex : null);
} else {
setActiveTabIndex(null);
}
} else if (tabIndex !== -1) {
setActiveTabIndex(tabIndex);
}
}
);
@@ -95,6 +109,7 @@ const SidePanelWithServices = ({
onClose={handleClose}
onActiveTabIndexChange={handleActiveTabIndexChange}
expandedWidth={expandedWidth}
servicesManager={servicesManager} // Pass servicesManager ke SidePanel
/>
);
};