fix - nav drawer expansion (#20545)
[PR](https://github.com/twentyhq/twenty/pull/20505), I merge, does not fix the whole issue Closes https://github.com/twentyhq/twenty/issues/20502
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
|
||||
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
|
||||
export const useNavigationDrawerExpanded = () => {
|
||||
const isSettingsDrawer = useIsSettingsDrawer();
|
||||
const isNavigationDrawerExpanded = useAtomStateValue(
|
||||
isNavigationDrawerExpandedState,
|
||||
);
|
||||
return isSettingsDrawer || isNavigationDrawerExpanded;
|
||||
};
|
||||
@@ -3,11 +3,10 @@ import { type ReactNode, useContext } from 'react';
|
||||
|
||||
import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton';
|
||||
|
||||
import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded';
|
||||
import { PAGE_ACTION_CONTAINER_CLICK_OUTSIDE_ID } from '@/ui/layout/page/constants/PageActionContainerClickOutsideId';
|
||||
import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight';
|
||||
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
|
||||
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
|
||||
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
|
||||
import { AnimatePresence } from 'framer-motion';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import {
|
||||
@@ -106,9 +105,7 @@ export const PageHeader = ({
|
||||
}: PageHeaderProps) => {
|
||||
const isMobile = useIsMobile();
|
||||
const { theme } = useContext(ThemeContext);
|
||||
const isNavigationDrawerExpanded = useAtomStateValue(
|
||||
isNavigationDrawerExpandedState,
|
||||
);
|
||||
const isNavigationDrawerExpanded = useNavigationDrawerExpanded();
|
||||
|
||||
return (
|
||||
<AnimatePresence initial={false}>
|
||||
|
||||
+2
-2
@@ -1,6 +1,7 @@
|
||||
import { styled } from '@linaria/react';
|
||||
import { type ReactNode, useState } from 'react';
|
||||
|
||||
import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded';
|
||||
import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
|
||||
import { tableWidthResizeIsActiveState } from '@/object-record/record-table/states/tableWidthResizeIsActivedState';
|
||||
import { ResizablePanelEdge } from '@/ui/layout/resizable-panel/components/ResizablePanelEdge';
|
||||
@@ -83,6 +84,7 @@ export const NavigationDrawer = ({
|
||||
const [isResizing, setIsResizing] = useState(false);
|
||||
const isMobile = useIsMobile();
|
||||
const isSettingsDrawer = useIsSettingsDrawer();
|
||||
const isExpanded = useNavigationDrawerExpanded();
|
||||
|
||||
const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] =
|
||||
useAtomState(isNavigationDrawerExpandedState);
|
||||
@@ -114,8 +116,6 @@ export const NavigationDrawer = ({
|
||||
setTableWidthResizeIsActive(false);
|
||||
};
|
||||
|
||||
const isExpanded = isSettingsDrawer || isNavigationDrawerExpanded;
|
||||
|
||||
return (
|
||||
<>
|
||||
<NavigationDrawerWidthEffect />
|
||||
|
||||
+5
-7
@@ -1,4 +1,4 @@
|
||||
import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
|
||||
import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded';
|
||||
import { NAVIGATION_DRAWER_COLLAPSED_WIDTH } from '@/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth';
|
||||
import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
|
||||
import { NavigationDrawerItemBreadcrumb } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb';
|
||||
@@ -273,7 +273,7 @@ export const NavigationDrawerItem = ({
|
||||
}: NavigationDrawerItemProps) => {
|
||||
const { theme } = useContext(ThemeContext);
|
||||
const isMobile = useIsMobile();
|
||||
const isSettingsPage = useIsSettingsPage();
|
||||
const isExpanded = useNavigationDrawerExpanded();
|
||||
const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] =
|
||||
useAtomState(isNavigationDrawerExpandedState);
|
||||
|
||||
@@ -336,7 +336,7 @@ export const NavigationDrawerItem = ({
|
||||
isSoon={isSoon}
|
||||
variant={variant}
|
||||
indentationLevel={indentationLevel}
|
||||
isNavigationDrawerExpanded={isNavigationDrawerExpanded}
|
||||
isNavigationDrawerExpanded={isExpanded}
|
||||
isDragging={isDragging}
|
||||
hasRightOptions={isDefined(rightOptions)}
|
||||
isSelectedInEditMode={isSelectedInEditMode}
|
||||
@@ -369,9 +369,7 @@ export const NavigationDrawerItem = ({
|
||||
size={theme.icon.size.md}
|
||||
stroke={theme.icon.stroke.md}
|
||||
color={
|
||||
showBreadcrumb &&
|
||||
!isSettingsPage &&
|
||||
!isNavigationDrawerExpanded
|
||||
showBreadcrumb && !isExpanded
|
||||
? theme.font.color.light
|
||||
: 'currentColor'
|
||||
}
|
||||
@@ -448,7 +446,7 @@ export const NavigationDrawerItem = ({
|
||||
</StyledItemElementsContainer>
|
||||
</StyledItem>
|
||||
|
||||
{!isNavigationDrawerExpanded && !isMobile && (
|
||||
{!isExpanded && !isMobile && (
|
||||
<AppTooltip
|
||||
anchorSelect={`#${navigationItemId}`}
|
||||
content={label}
|
||||
|
||||
Reference in New Issue
Block a user