From ba93062638db8f190975f54da8b189efc904a572 Mon Sep 17 00:00:00 2001 From: Enrico Ros Date: Sun, 15 Jun 2025 11:43:39 -0700 Subject: [PATCH] Peeking: discard dedicated action getter --- src/common/layout/optima/nav/DesktopNav.tsx | 4 ++-- src/common/layout/optima/portals/OptimaPortalsIn.tsx | 4 ++-- src/common/layout/optima/useOptima.tsx | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/layout/optima/nav/DesktopNav.tsx b/src/common/layout/optima/nav/DesktopNav.tsx index 39d0a93ee..b50cec0c7 100644 --- a/src/common/layout/optima/nav/DesktopNav.tsx +++ b/src/common/layout/optima/nav/DesktopNav.tsx @@ -25,7 +25,7 @@ import { useOverlayComponents } from '~/common/layout/overlays/useOverlayCompone import { BringTheLove } from './BringTheLove'; import { DesktopNavGroupBox, DesktopNavIcon, navItemClasses } from './DesktopNavIcon'; import { InvertedBar, InvertedBarCornerItem } from '../InvertedBar'; -import { optimaGetPeekActions, optimaOpenModels, optimaOpenPreferences, optimaToggleDrawer, useOptimaDrawerOpen, useOptimaModals } from '../useOptima'; +import { optimaActions, optimaOpenModels, optimaOpenPreferences, optimaToggleDrawer, useOptimaDrawerOpen, useOptimaModals } from '../useOptima'; import { scratchClipSupported, useScratchClipVisibility } from '../scratchclip/store-scratchclip'; @@ -59,7 +59,7 @@ export function DesktopNav(props: { component: React.ElementType, currentApp?: N const isDrawerOpen = useOptimaDrawerOpen(); const { showPromisedOverlay } = useOverlayComponents(); const { showModels, showPreferences } = useOptimaModals(); - const { peekDrawerEnter, peekDrawerLeave } = optimaGetPeekActions(); + const { peekDrawerEnter, peekDrawerLeave } = optimaActions(); const { isVisible: isScratchClipVisible, toggleVisibility: toggleScratchClipVisibility } = useScratchClipVisibility(); // derived state diff --git a/src/common/layout/optima/portals/OptimaPortalsIn.tsx b/src/common/layout/optima/portals/OptimaPortalsIn.tsx index da1cd61bc..25a57d095 100644 --- a/src/common/layout/optima/portals/OptimaPortalsIn.tsx +++ b/src/common/layout/optima/portals/OptimaPortalsIn.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { createPortal } from 'react-dom'; import { OptimaPortalId, useLayoutPortalsStore } from './store-layout-portals'; -import { optimaGetPeekActions } from '../useOptima'; +import { optimaActions } from '../useOptima'; const _drawerWrapperStyle = { @@ -16,7 +16,7 @@ export function OptimaDrawerIn(props: { children: React.ReactNode }) { if (!portalElement) return null; // wrap portal contents in a div that updates the hover state of the drawer - const { peekDrawerEnter, peekDrawerLeave } = optimaGetPeekActions(); + const { peekDrawerEnter, peekDrawerLeave } = optimaActions(); return createPortal(
drawerIsPeeking); } -export function optimaGetPeekActions(): { peekDrawerEnter: () => void, peekDrawerLeave: () => void } { - return useLayoutOptimaStore.getState(); -} - // Panel @@ -65,6 +61,10 @@ export function useOptimaPanelOpen(isMobile: boolean, currentApp?: NavItemApp) { }; } +export function useOptimaPanelPeeking() { + return useLayoutOptimaStore(({ panelIsPeeking }) => panelIsPeeking); +} + // Modals