Peeking: discard dedicated action getter

This commit is contained in:
Enrico Ros
2025-06-15 11:43:39 -07:00
parent 61366b7096
commit ba93062638
3 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -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
@@ -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(
<div
onMouseEnter={peekDrawerEnter}
+4 -4
View File
@@ -30,10 +30,6 @@ export function useOptimaDrawerPeeking() {
return useLayoutOptimaStore(({ drawerIsPeeking }) => 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