Skip to content

The open alternative to Salesforce, designed for AI.

[1/2 Sidebar] New layout (#25974)

Thomas des Francs2ce24e927808
diff --git a/packages/twenty-docs/snippets/ui/generated/tokens.mdx b/packages/twenty-docs/snippets/ui/generated/tokens.mdx
index e82231b3e1a..350c7df1dc6 100644
--- a/packages/twenty-docs/snippets/ui/generated/tokens.mdx
+++ b/packages/twenty-docs/snippets/ui/generated/tokens.mdx
@@ -116,6 +116,7 @@
| --- | --- | --- | --- | --- |
| boxShadow.color | --t-box-shadow-color | color(display-p3 0 0 0 / 0.039) | rgba(0, 0, 0, 0.6) | |
| boxShadow.light | --t-box-shadow-light | 0px 2px 4px 0px color(display-p3 0 0 0 / 0.039), 0px 0px 4px 0px color(display-p3 0 0 0 / 0.078) | 0px 2px 4px 0px rgba(0, 0, 0, 0.04), 0px 0px 4px 0px rgba(0, 0, 0, 0.08) | |
+| boxShadow.sidebar | --t-box-shadow-sidebar | -4px 4px 4px 0px rgba(0, 0, 0, 0.005) | -4px 4px 4px 0px rgba(0, 0, 0, 0.03) | |
| boxShadow.strong | --t-box-shadow-strong | 2px 4px 16px 0px color(display-p3 0 0 0 / 0.161), 0px 2px 4px 0px color(display-p3 0 0 0 / 0.078) | 2px 4px 16px 0px rgba(0, 0, 0, 0.16), 0px 2px 4px 0px rgba(0, 0, 0, 0.08) | |
| boxShadow.superHeavy | --t-box-shadow-super-heavy | 0px 0px 8px 0px color(display-p3 0 0 0 / 0.161), 0px 8px 64px -16px color(display-p3 0 0 0 / 0.478), 0px 24px 56px -16px color(display-p3 0 0 0 / 0.078) | 2px 4px 16px 0px rgba(0, 0, 0, 0.12), 0px 2px 4px 0px rgba(0, 0, 0, 0.04) | |
| boxShadow.underline | --t-box-shadow-underline | 0px 1px 0px 0px color(display-p3 0 0 0 / 0.361) | 0px 1px 0px 0px rgba(0, 0, 0, 0.32) | |
diff --git a/packages/twenty-front/src/modules/ai/components/AiChatPageHeader.tsx b/packages/twenty-front/src/modules/ai/components/AiChatPageHeader.tsx
index 43644550ccf..7989ae0c9d1 100644
--- a/packages/twenty-front/src/modules/ai/components/AiChatPageHeader.tsx
+++ b/packages/twenty-front/src/modules/ai/components/AiChatPageHeader.tsx
@@ -1,3 +1,4 @@
+import { APP_HEADER_HEIGHT } from '@/ui/layout/constants/AppHeaderHeight';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { isDefined } from 'twenty-shared/utils';
@@ -12,7 +13,6 @@ import { AGENT_CHAT_NEW_THREAD_DRAFT_KEY } from '@/ai/states/agentChatDraftsByTh
import { currentAiChatThreadState } from '@/ai/states/currentAiChatThreadState';
import { currentAiChatThreadDataSelector } from '@/ai/states/selectors/currentAiChatThreadDataSelector';
import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded';
-import { SIDE_PANEL_TOP_BAR_HEIGHT } from '@/side-panel/constants/SidePanelTopBarHeight';
import { NavigationDrawerCollapseButton } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerCollapseButton';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -24,7 +24,7 @@ const StyledHeader = styled.header`
display: flex;
flex-shrink: 0;
gap: ${themeCssVariables.spacing[2]};
- height: ${SIDE_PANEL_TOP_BAR_HEIGHT}px;
+ height: ${APP_HEADER_HEIGHT}px;
padding: 0 ${themeCssVariables.spacing[3]};
`;
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatContent.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatContent.tsx
index ce6dbd6a2d0..0bea9046d21 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatContent.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatContent.tsx
@@ -1,3 +1,4 @@
+import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { themeCssVariables } from 'twenty-ui/theme-constants';
@@ -55,6 +56,7 @@ const AI_CHAT_RECENTS_NAVIGATION_SECTION_ID = 'AiChatRecents';
export const NavigationDrawerAiChatContent = () => {
const { t } = useLingui();
+ const isExpanded = useIsNavigationDrawerContentExpanded();
const currentAiChatThread = useAtomStateValue(currentAiChatThreadState);
const { handleThreadClick } = useAiChatThreadClick({
@@ -67,7 +69,7 @@ export const NavigationDrawerAiChatContent = () => {
if (loading && threads.length === 0) {
return (
<StyledContainer>
- <AiChatSkeletonLoader />
+ {isExpanded && <AiChatSkeletonLoader />}
</StyledContainer>
);
}
@@ -110,7 +112,7 @@ export const NavigationDrawerAiChatContent = () => {
rightIcon={filterDropdown}
/>
)}
- {threads.length === 0 ? (
+ {threads.length === 0 && isExpanded ? (
<StyledEmptyState>{t`No chat`}</StyledEmptyState>
) : null}
{hasNextPage ? <StyledFetchMoreTrigger ref={fetchMoreRef} /> : null}
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadItem.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadItem.tsx
index d4eed6f873c..bb19433b814 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadItem.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadItem.tsx
@@ -1,3 +1,5 @@
+import { IconMessage } from 'twenty-ui/icon';
+import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { useLingui } from '@lingui/react/macro';
import { AiChatThreadItemMenu } from '@/ai/components/AiChatThreadItemMenu';
@@ -22,6 +24,7 @@ export const NavigationDrawerAiChatThreadItem = ({
onClick,
}: NavigationDrawerAiChatThreadItemProps) => {
const { t } = useLingui();
+ const isExpanded = useIsNavigationDrawerContentExpanded();
const {
isRenaming,
draftTitle,
@@ -42,7 +45,7 @@ export const NavigationDrawerAiChatThreadItem = ({
itemMenuDropdownId,
);
- if (isRenaming) {
+ if (isRenaming && isExpanded) {
return (
<NavigationDrawerInput
value={draftTitle}
@@ -57,6 +60,7 @@ export const NavigationDrawerAiChatThreadItem = ({
return (
<NavigationDrawerItem
+ Icon={isExpanded ? undefined : IconMessage}
label={displayLabel}
active={isActive}
onClick={() => onClick(thread)}
diff --git a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadSection.tsx b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadSection.tsx
index d54b23effbd..d25b773e89c 100644
--- a/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadSection.tsx
+++ b/packages/twenty-front/src/modules/ai/components/NavigationDrawerAiChatThreadSection.tsx
@@ -1,21 +1,8 @@
-import { styled } from '@linaria/react';
import { type ReactNode } from 'react';
-import { AnimatedExpandableContainer } from 'twenty-ui/primitives/layout';
-import { themeCssVariables } from 'twenty-ui/theme-constants';
-
import { NavigationDrawerAiChatThreadItem } from '@/ai/components/NavigationDrawerAiChatThreadItem';
-import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
-import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
-import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle';
-import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection';
+import { CollapsibleNavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection';
import { type AgentChatThread } from '~/generated-metadata/graphql';
-const StyledThreadList = styled.div`
- display: flex;
- flex-direction: column;
- gap: ${themeCssVariables.spacing['0.5']};
-`;
-
export type NavigationDrawerAiChatThreadSectionProps = {
sectionId: string;
title: string;
@@ -35,40 +22,21 @@ export const NavigationDrawerAiChatThreadSection = ({
rightIcon,
alwaysShowRightIcon = false,
}: NavigationDrawerAiChatThreadSectionProps) => {
- const { isNavigationSectionOpen, toggleNavigationSection } =
- useNavigationSection(sectionId);
-
return (
- <NavigationDrawerSection>
- <NavigationDrawerAnimatedCollapseWrapper>
- <NavigationDrawerSectionTitle
- label={title}
- onClick={toggleNavigationSection}
- alwaysShowRightIcon={alwaysShowRightIcon}
- isOpen={isNavigationSectionOpen}
- rightIcon={rightIcon}
+ <CollapsibleNavigationDrawerSection
+ sectionId={sectionId}
+ label={title}
+ rightIcon={rightIcon}
+ alwaysShowRightIcon={alwaysShowRightIcon}
+ >
+ {threads.map((thread) => (
+ <NavigationDrawerAiChatThreadItem
+ key={thread.id}
+ thread={thread}
+ isActive={currentThreadId === thread.id}
+ onClick={onThreadClick}
/>
- </NavigationDrawerAnimatedCollapseWrapper>
- {threads.length > 0 ? (
- <AnimatedExpandableContainer
- isExpanded={isNavigationSectionOpen}
- dimension="height"
- mode="fit-content"
- containAnimation
- initial={false}
- >
- <StyledThreadList>
- {threads.map((thread) => (
- <NavigationDrawerAiChatThreadItem
- key={thread.id}
- thread={thread}
- isActive={currentThreadId === thread.id}
- onClick={onThreadClick}
- />
- ))}
- </StyledThreadList>
- </AnimatedExpandableContainer>
- ) : null}
- </NavigationDrawerSection>
+ ))}
+ </CollapsibleNavigationDrawerSection>
);
};
diff --git a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBar.tsx b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBar.tsx
index 1e7001ba649..003ade031ce 100644
--- a/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBar.tsx
+++ b/packages/twenty-front/src/modules/layout-customization/components/LayoutCustomizationBar.tsx
@@ -21,6 +21,11 @@ import { SaveAndCancelButtons } from '@/settings/components/SaveAndCancelButtons
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { PageLayoutType } from '~/generated-metadata/graphql';
+const StyledAnimatedContainer = styled(motion.div)`
+ flex-shrink: 0;
+ overflow: hidden;
+`;
+
const StyledContainer = styled.div`
align-items: center;
background: ${themeCssVariables.color.blue};
@@ -97,7 +102,7 @@ const LayoutCustomizationBarContent = () => {
: t`Layout customization`;
return (
- <motion.div
+ <StyledAnimatedContainer
initial={{ height: 0, opacity: 0 }}
animate={{ height: 'auto', opacity: 1 }}
exit={{ height: 0, opacity: 0 }}
@@ -133,7 +138,7 @@ const LayoutCustomizationBarContent = () => {
pageLayoutId={currentPageLayoutId}
/>
)}
- </motion.div>
+ </StyledAnimatedContainer>
);
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
index 23bc0458e75..29a3d66bccc 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/components/NavigationMenuItemIcon.tsx
@@ -1,8 +1,8 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { NavigationMenuItemType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
import {
Avatar,
- StyledTintedIconTileContainer,
getIconTileColorShades,
} from 'twenty-ui/primitives/data-display';
import { IconLink, IconWorld, useIcons } from 'twenty-ui/icon';
@@ -16,6 +16,7 @@ import { getNavigationMenuItemObjectNameSingular } from '@/navigation-menu-item/
import { getNavigationMenuItemComputedLink } from '@/navigation-menu-item/display/utils/getNavigationMenuItemComputedLink';
import { getNavigationMenuItemLabel } from '@/navigation-menu-item/display/utils/getNavigationMenuItemLabel';
import { ObjectIconWithViewOverlay } from '@/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay';
+import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';
import { useGetStandardObjectIcon } from '@/object-metadata/hooks/useGetStandardObjectIcon';
import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
@@ -80,22 +81,18 @@ export const NavigationMenuItemIcon = ({
const pageLayoutColor = getNavigationMenuItemColor(navigationMenuItem);
const pageLayoutIconStyle = getIconTileColorShades(pageLayoutColor);
+ if (isDefined(PageLayoutIcon)) {
+ return <ColoredIcon Icon={PageLayoutIcon} color={pageLayoutColor} />;
+ }
+
return (
- <StyledTintedIconTileContainer
- $backgroundColor={pageLayoutIconStyle.backgroundColor}
- $borderColor={pageLayoutIconStyle.borderColor}
- >
- <Avatar
- size="sm"
- shape="rounded-square"
- icon={
- isDefined(PageLayoutIcon) ? (
- <PageLayoutIcon color={pageLayoutIconStyle.iconColor} />
- ) : undefined
- }
- name={navigationMenuItem.name ?? ''}
- />
- </StyledTintedIconTileContainer>
+ <Avatar
+ size="md"
+ shape="rounded-square"
+ name={navigationMenuItem.name ?? ''}
+ color={pageLayoutIconStyle.iconColor}
+ backgroundColor={pageLayoutIconStyle.backgroundColor}
+ />
);
}
@@ -115,27 +112,9 @@ export const NavigationMenuItemIcon = ({
);
}
- const itemIcon = isRecord
- ? undefined
- : objectMetadataItem?.icon
- ? getIcon(objectMetadataItem.icon)
- : undefined;
- const IconToUse = StandardIcon ?? itemIcon;
-
- const effectiveColor = getNavigationMenuItemColor(
- navigationMenuItem,
- objectMetadataItem,
- );
- const useStyledIcon = !isRecord;
- const iconStyle = useStyledIcon
- ? getIconTileColorShades(effectiveColor)
- : null;
-
- const iconColorToUse = iconStyle
- ? iconStyle.iconColor
- : StandardIcon
- ? IconColor
- : themeCssVariables.font.color.secondary;
+ if (!isRecord) {
+ return <ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />;
+ }
const labelIdentifier = getNavigationMenuItemLabel(
navigationMenuItem,
@@ -153,29 +132,20 @@ export const NavigationMenuItemIcon = ({
})
: null;
- const avatar = (
+ return (
<Avatar
- size={iconStyle ? 'sm' : 'md'}
+ size="md"
shape={recordIdentifier?.avatarShape ?? 'rounded-square'}
icon={
- isDefined(IconToUse) ? <IconToUse color={iconColorToUse} /> : undefined
+ isDefined(StandardIcon) ? (
+ <StandardIcon
+ color={IconColor ?? themeCssVariables.font.color.secondary}
+ />
+ ) : undefined
}
src={getAbsoluteImageUrl(recordIdentifier?.avatarUrl ?? '')}
name={labelIdentifier}
colorSeed={navigationMenuItem.targetRecordId ?? undefined}
/>
);
-
- if (!iconStyle) {
- return avatar;
- }
-
- return (
- <StyledTintedIconTileContainer
- $backgroundColor={iconStyle.backgroundColor}
- $borderColor={iconStyle.borderColor}
- >
- {avatar}
- </StyledTintedIconTileContainer>
- );
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/dnd/components/AddToNavigationDragHandle.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/dnd/components/AddToNavigationDragHandle.tsx
index 592f34cccf4..f8aabcfa1f8 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/dnd/components/AddToNavigationDragHandle.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/dnd/components/AddToNavigationDragHandle.tsx
@@ -1,3 +1,4 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { styled } from '@linaria/react';
import { useContext, type ReactNode } from 'react';
import { NavigationMenuItemType } from 'twenty-shared/types';
@@ -32,37 +33,6 @@ const StyledIconSlot = styled.div<{
}
`;
-type AddToNavigationDragHandleIconProps = {
- icon?: IconComponent;
- customIconContent?: ReactNode;
- iconColor?: string;
-};
-
-const AddToNavigationDragHandleIcon = ({
- icon,
- customIconContent,
- iconColor,
-}: AddToNavigationDragHandleIconProps) => {
- const { theme } = useContext(ThemeContext);
- const iconSize = theme.icon.size.md;
- const iconStroke = theme.icon.stroke.sm;
-
- if (isDefined(customIconContent)) {
- return <>{customIconContent}</>;
- }
-
- if (isDefined(icon)) {
- const Icon = icon;
- return (
- <Icon
- size={iconSize}
- stroke={iconStroke}
- color={iconColor ?? theme.grayScale.gray1}
- />
- );
- }
-};
-
type AddToNavigationDragHandleProps = {
icon?: IconComponent;
customIconContent?: ReactNode;
@@ -91,32 +61,53 @@ export const AddToNavigationDragHandle = ({
}
: undefined,
);
- const hasBackgroundColor =
+ const hasFixedIconSize =
payload.type !== NavigationMenuItemType.RECORD && !isHovered;
- const showCustomContentWithoutWrapper = isDefined(customIconContent);
-
- return (
- <StyledIconSlot
- $hasFixedSize={hasBackgroundColor || showCustomContentWithoutWrapper}
- $disabled={disabled}
- $disableDrag={disableDrag}
- >
- {isHovered ? (
+ const renderIcon = () => {
+ if (isHovered) {
+ return (
<IconGripVertical
size={theme.icon.size.md}
stroke={theme.icon.stroke.sm}
color={theme.font.color.tertiary}
/>
- ) : showCustomContentWithoutWrapper ? (
- customIconContent
- ) : hasBackgroundColor && icon ? (
- <TintedIconTile Icon={icon} color={effectiveColor} />
- ) : (
- <AddToNavigationDragHandleIcon
- icon={icon}
- customIconContent={customIconContent}
+ );
+ }
+
+ if (isDefined(customIconContent)) {
+ return customIconContent;
+ }
+
+ if (!isDefined(icon)) {
+ return null;
+ }
+
+ const Icon = icon;
+
+ if (payload.type === NavigationMenuItemType.VIEW) {
+ return <TintedIconTile Icon={Icon} color={effectiveColor} />;
+ }
+
+ if (payload.type === NavigationMenuItemType.RECORD) {
+ return (
+ <Icon
+ size={theme.icon.size.md}
+ stroke={theme.icon.stroke.sm}
+ color={theme.grayScale.gray1}
/>
- )}
+ );
+ }
+
+ return <ColoredIcon Icon={Icon} color={effectiveColor} />;
+ };
+
+ return (
+ <StyledIconSlot
+ $hasFixedSize={hasFixedIconSize || isDefined(customIconContent)}
+ $disabled={disabled}
+ $disableDrag={disableDrag}
+ >
+ {renderIcon()}
</StyledIconSlot>
);
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx
index a3b2b7a526f..657ceaaeb56 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolder.tsx
@@ -1,7 +1,7 @@
-import { Suspense, lazy, useContext } from 'react';
-import { isDefined } from 'twenty-shared/utils';
-import { IconChevronDown, IconChevronRight, useIcons } from 'twenty-ui/icon';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
+import { NavigationMenuItemFolderChevron } from '@/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron';
+import { Suspense, lazy } from 'react';
+import { useIcons } from 'twenty-ui/icon';
import { useIsMobile } from 'twenty-ui/utilities';
import { type NavigationMenuItem } from '~/generated-metadata/graphql';
@@ -113,7 +113,6 @@ const NavigationMenuItemFolderReadOnlyContent = ({
}: NavigationMenuItemFolderReadOnlyContentProps) => {
const { getIcon } = useIcons();
const isMobile = useIsMobile();
- const { theme } = useContext(ThemeContext);
const FolderIcon = getIcon(folderIconKey ?? FOLDER_ICON_DEFAULT);
const { isOpen, handleToggle, hasActiveChild, activeChildIndex } =
@@ -127,33 +126,19 @@ const NavigationMenuItemFolderReadOnlyContent = ({
header={
<NavigationDrawerItem
label={folderName}
- Icon={FolderIcon}
- iconColor={
- isDefined(folderColor)
- ? folderColor
- : DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER
- }
+ Icon={() => (
+ <ColoredIcon
+ Icon={FolderIcon}
+ color={folderColor ?? DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER}
+ />
+ )}
active={!isOpen && hasActiveChild}
onClick={handleToggle}
className="navigation-drawer-item"
triggerEvent="CLICK"
preventCollapseOnMobile={isMobile}
alwaysShowRightOptions
- rightOptions={
- isOpen ? (
- <IconChevronDown
- size={theme.icon.size.sm}
- stroke={theme.icon.stroke.sm}
- color={themeCssVariables.font.color.tertiary}
- />
- ) : (
- <IconChevronRight
- size={theme.icon.size.sm}
- stroke={theme.icon.stroke.sm}
- color={themeCssVariables.font.color.tertiary}
- />
- )
- }
+ rightOptions={<NavigationMenuItemFolderChevron isOpen={isOpen} />}
/>
}
isOpen={isOpen}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron.tsx
new file mode 100644
index 00000000000..0968f4a1b90
--- /dev/null
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron.tsx
@@ -0,0 +1,34 @@
+import { styled } from '@linaria/react';
+import { IconChevronRight } from 'twenty-ui/icon';
+import { themeCssVariables, useTheme } from 'twenty-ui/theme-constants';
+
+const StyledContainer = styled.span<{ isOpen: boolean }>`
+ display: inline-flex;
+ transform: rotate(${({ isOpen }) => (isOpen ? 90 : 0)}deg);
+ transition: transform
+ calc(${themeCssVariables.animation.duration.normal} * 1s) ease;
+
+ @media (prefers-reduced-motion: reduce) {
+ transition: none;
+ }
+`;
+
+type NavigationMenuItemFolderChevronProps = {
+ isOpen: boolean;
+};
+
+export const NavigationMenuItemFolderChevron = ({
+ isOpen,
+}: NavigationMenuItemFolderChevronProps) => {
+ const theme = useTheme();
+
+ return (
+ <StyledContainer isOpen={isOpen}>
+ <IconChevronRight
+ size={theme.icon.size.sm}
+ stroke={theme.icon.stroke.sm}
+ color={themeCssVariables.font.color.tertiary}
+ />
+ </StyledContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderContent.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderContent.tsx
index 1bfd6e1cd47..8a32a7cdf48 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderContent.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderContent.tsx
@@ -1,3 +1,4 @@
+import { NavigationMenuItemType } from 'twenty-shared/types';
import { IconHeartOff } from 'twenty-ui/icon';
import { LightIconButton } from 'twenty-ui/primitives/input';
import { type NavigationMenuItem } from '~/generated-metadata/graphql';
@@ -67,6 +68,7 @@ export const NavigationMenuItemFolderContent = ({
>
<NavigationDrawerItem
secondaryLabel={getObjectNavigationMenuItemSecondaryLabel({
+ isView: navigationMenuItem.type === NavigationMenuItemType.VIEW,
objectMetadataItems,
navigationMenuItemObjectNameSingular: objectNameSingular ?? '',
})}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx
index 25db01d1760..383b27f7abe 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderDnd.tsx
@@ -1,18 +1,15 @@
+import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
+import { NavigationMenuItemFolderChevron } from '@/navigation-menu-item/display/folder/components/NavigationMenuItemFolderChevron';
+import { NavigationMenuItemEntrance } from '@/navigation-menu-item/edit/components/NavigationMenuItemEntrance';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import React, { Fragment, useCallback, useContext } from 'react';
import { createPortal } from 'react-dom';
import { isDefined } from 'twenty-shared/utils';
-import {
- IconChevronDown,
- IconChevronRight,
- IconFolder,
- IconHeartOff,
- IconPlus,
- useIcons,
-} from 'twenty-ui/icon';
+import { IconFolder, IconHeartOff, IconPlus, useIcons } from 'twenty-ui/icon';
import { LightIconButton } from 'twenty-ui/primitives/input';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
import { useIsMobile } from 'twenty-ui/utilities';
import { type NavigationMenuItem } from '~/generated-metadata/graphql';
@@ -104,9 +101,12 @@ export const NavigationMenuItemFolderDnd = ({
orphanIndex,
}: NavigationMenuItemFolderDndProps) => {
const { t } = useLingui();
- const { theme } = useContext(ThemeContext);
const { getIcon } = useIcons();
const isMobile = useIsMobile();
+ const isNavigationDrawerExpanded = useAtomStateValue(
+ isNavigationDrawerExpandedState,
+ );
+ const isExpanded = isNavigationDrawerExpanded || isMobile;
const section: NavigationMenuItemSection = isEditInPlace
? 'favorite'
@@ -197,19 +197,7 @@ export const NavigationMenuItemFolderDnd = ({
handleToggle();
}}
>
- {isOpen ? (
- <IconChevronDown
- size={theme.icon.size.sm}
- stroke={theme.icon.stroke.sm}
- color={theme.font.color.tertiary}
- />
- ) : (
- <IconChevronRight
- size={theme.icon.size.sm}
- stroke={theme.icon.stroke.sm}
- color={theme.font.color.tertiary}
- />
- )}
+ <NavigationMenuItemFolderChevron isOpen={isOpen} />
</div>
);
@@ -228,12 +216,14 @@ export const NavigationMenuItemFolderDnd = ({
const header = headerOverride ?? (
<NavigationDrawerItem
label={folderName}
- Icon={FolderIcon}
- iconColor={iconColor}
+ Icon={() => <ColoredIcon Icon={FolderIcon} color={iconColor} />}
active={
(!isOpen && hasActiveChild) ||
(isWorkspace && isSelectedInEditMode && !isOpen)
}
+ isSelectedInEditMode={
+ isWorkspace && isFolderEditHighlighted && !isExpanded
+ }
onClick={handleHeaderClick}
rightOptions={headerRightOptions}
className="navigation-drawer-item"
@@ -315,7 +305,9 @@ export const NavigationMenuItemFolderDnd = ({
return (
<>
<StyledFolderContainer
- $isSelectedInEditMode={isWorkspace && isFolderEditHighlighted}
+ $isSelectedInEditMode={
+ isWorkspace && isFolderEditHighlighted && isExpanded
+ }
data-drag-over-header={isDragOverFolderHeader ? 'true' : undefined}
data-forbidden-drop-target={isForbiddenDropTarget ? 'true' : undefined}
>
@@ -391,19 +383,21 @@ export const NavigationMenuItemFolderDnd = ({
)}
/>
{isWorkspace && isLayoutCustomizationModeEnabled && (
- <NavigationDrawerSubItem
- label={t`Add menu item`}
- Icon={IconPlus}
- onClick={handleAddMenuItemToFolder}
- triggerEvent="CLICK"
- variant="tertiary"
- isSelectedInEditMode={false}
- subItemState={getNavigationSubItemLeftAdornment({
- index: navigationMenuItems.length,
- arrayLength: folderContentLength,
- selectedIndex: -1,
- })}
- />
+ <NavigationMenuItemEntrance>
+ <NavigationDrawerSubItem
+ label={t`Add menu item`}
+ Icon={IconPlus}
+ onClick={handleAddMenuItemToFolder}
+ triggerEvent="CLICK"
+ variant="tertiary"
+ isSelectedInEditMode={false}
+ subItemState={getNavigationSubItemLeftAdornment({
+ index: navigationMenuItems.length,
+ arrayLength: folderContentLength,
+ selectedIndex: -1,
+ })}
+ />
+ </NavigationMenuItemEntrance>
)}
</NavigationMenuItemDroppableSlot>
</StyledFolderDroppableContent>
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderSubItem.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderSubItem.tsx
index 615a084db1c..f70b8645f89 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderSubItem.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/NavigationMenuItemFolderSubItem.tsx
@@ -6,7 +6,6 @@ import { type NavigationMenuItem } from '~/generated-metadata/graphql';
import { lastClickedNavigationMenuItemIdState } from '@/navigation-menu-item/common/states/lastClickedNavigationMenuItemIdState';
import { useNavigateToNavigationMenuItemLink } from '@/navigation-menu-item/common/hooks/useNavigateToNavigationMenuItemLink';
-import { getNavigationMenuItemColor } from '@/navigation-menu-item/common/utils/getNavigationMenuItemColor';
import { NavigationMenuItemIcon } from '@/navigation-menu-item/display/components/NavigationMenuItemIcon';
import { useIdentifyActiveNavigationMenuItems } from '@/navigation-menu-item/display/hooks/useIdentifyActiveNavigationMenuItems';
import { useIsNavigationMenuItemEditHighlighted } from '@/navigation-menu-item/display/hooks/useIsNavigationMenuItemEditHighlighted';
@@ -127,6 +126,7 @@ export const NavigationMenuItemFolderSubItem = ({
const viewSecondaryLabel =
navigationMenuItem.type === NavigationMenuItemType.VIEW
? getObjectNavigationMenuItemSecondaryLabel({
+ isView: true,
objectMetadataItems,
navigationMenuItemObjectNameSingular: objectNameSingular ?? '',
})
@@ -143,10 +143,6 @@ export const NavigationMenuItemFolderSubItem = ({
Icon={() => (
<NavigationMenuItemIcon navigationMenuItem={navigationMenuItem} />
)}
- iconColor={getNavigationMenuItemColor(
- navigationMenuItem,
- objectMetadataItem ?? undefined,
- )}
to={isDragging || isEditable ? undefined : computedLink}
onClick={handleClick}
active={isActive}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/__stories__/NavigationMenuItemFolderSubItem.stories.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/__stories__/NavigationMenuItemFolderSubItem.stories.tsx
new file mode 100644
index 00000000000..82ba652c2c4
--- /dev/null
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/folder/components/__stories__/NavigationMenuItemFolderSubItem.stories.tsx
@@ -0,0 +1,44 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { NavigationMenuItemType } from 'twenty-shared/types';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { NavigationMenuItemFolderSubItem } from '@/navigation-menu-item/display/folder/components/NavigationMenuItemFolderSubItem';
+import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
+import { MemoryRouterDecorator } from '~/testing/decorators/MemoryRouterDecorator';
+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';
+
+const meta: Meta<typeof NavigationMenuItemFolderSubItem> = {
+ title: 'Modules/NavigationMenuItem/NavigationMenuItemFolderSubItem',
+ component: NavigationMenuItemFolderSubItem,
+ decorators: [
+ ComponentDecorator,
+ IconsProviderDecorator,
+ MemoryRouterDecorator,
+ ToastDecorator,
+ ],
+ parameters: { container: { width: 240 } },
+ args: {
+ index: 0,
+ arrayLength: 1,
+ selectedIndex: -1,
+ isDragging: false,
+ },
+};
+
+export default meta;
+type Story = StoryObj<typeof NavigationMenuItemFolderSubItem>;
+
+export const Link: Story = {
+ args: {
+ navigationMenuItem: {
+ id: '71c0a705-a53f-4e86-a2ba-4da7ae347c5d',
+ folderId: '6194edbc-ae3b-4c7c-b6ea-41ea28edc242',
+ type: NavigationMenuItemType.LINK,
+ name: 'Example website',
+ link: 'https://example.com',
+ position: 0,
+ createdAt: '2026-01-01T12:00:00.000Z',
+ updatedAt: '2026-01-01T12:00:00.000Z',
+ },
+ },
+};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/link/components/LinkIconWithLinkOverlay.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/link/components/LinkIconWithLinkOverlay.tsx
index fd2e289f431..31766b4655a 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/link/components/LinkIconWithLinkOverlay.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/link/components/LinkIconWithLinkOverlay.tsx
@@ -1,7 +1,7 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { styled } from '@linaria/react';
import { useContext, useState } from 'react';
import { getLinkFaviconUrl, isDefined } from 'twenty-shared/utils';
-import { getIconTileColorShades } from 'twenty-ui/primitives/data-display';
import { type IconComponent } from 'twenty-ui/icon';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
@@ -11,41 +11,21 @@ const failedFaviconUrls = new Set<string>();
const StyledCompositeContainer = styled.div`
align-items: center;
- border-radius: ${themeCssVariables.border.radius.sm};
box-sizing: border-box;
display: flex;
flex-shrink: 0;
- height: 16px;
+ height: calc(${themeCssVariables.icon.size.md} * 1px);
justify-content: center;
position: relative;
- width: 16px;
-`;
-
-const StyledMainIconWrapper = styled.div<{
- $backgroundColor: string;
- $borderColor?: string;
- $noBackgroundOrBorder?: boolean;
-}>`
- align-items: center;
- background-color: ${({ $backgroundColor, $noBackgroundOrBorder }) =>
- $noBackgroundOrBorder ? 'transparent' : $backgroundColor};
- border: ${({ $borderColor, $noBackgroundOrBorder }) =>
- $noBackgroundOrBorder || !$borderColor
- ? 'none'
- : `1px solid ${$borderColor}`};
- border-radius: ${themeCssVariables.border.radius.sm};
- box-sizing: border-box;
- display: flex;
- inset: 0;
- justify-content: center;
- overflow: hidden;
- position: absolute;
+ width: calc(${themeCssVariables.icon.size.md} * 1px);
`;
const StyledFaviconImage = styled.img`
- height: 100%;
+ display: block;
+ flex-shrink: 0;
+ height: calc(${themeCssVariables.icon.size.md} * 1px);
object-fit: contain;
- width: 100%;
+ width: calc(${themeCssVariables.icon.size.md} * 1px);
`;
const StyledLinkOverlay = styled.div<{ $backgroundColor: string }>`
@@ -82,34 +62,23 @@ export const LinkIconWithLinkOverlay = ({
const showFavicon =
isDefined(faviconUrl) && !isKnownFailed && localFailedLink !== linkKey;
- const linkStyle = getIconTileColorShades(
- navItemColor ?? DEFAULT_NAVIGATION_MENU_ITEM_COLOR_LINK,
- );
-
return (
<StyledCompositeContainer>
- <StyledMainIconWrapper
- $backgroundColor={linkStyle.backgroundColor}
- $borderColor={linkStyle.borderColor}
- $noBackgroundOrBorder={showFavicon}
- >
- {showFavicon ? (
- <StyledFaviconImage
- src={faviconUrl}
- alt=""
- onError={() => {
- if (isDefined(link)) failedFaviconUrls.add(link);
- setLocalFailedLink(linkKey);
- }}
- />
- ) : (
- <DefaultIcon
- size="14px"
- stroke={theme.icon.stroke.md}
- color={linkStyle.iconColor}
- />
- )}
- </StyledMainIconWrapper>
+ {showFavicon ? (
+ <StyledFaviconImage
+ src={faviconUrl}
+ alt=""
+ onError={() => {
+ if (isDefined(link)) failedFaviconUrls.add(link);
+ setLocalFailedLink(linkKey);
+ }}
+ />
+ ) : (
+ <ColoredIcon
+ Icon={DefaultIcon}
+ color={navItemColor ?? DEFAULT_NAVIGATION_MENU_ITEM_COLOR_LINK}
+ />
+ )}
<StyledLinkOverlay $backgroundColor={themeCssVariables.grayScale.gray4}>
<LinkIcon
size="14px"
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
index dca06c9c9a6..97034f2db18 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/object/components/NavigationDrawerItemForObjectMetadataItem.tsx
@@ -11,6 +11,7 @@ import { getNavigationMenuItemLabel } from '@/navigation-menu-item/display/utils
import { isCoreWorkflowsObjectNavigationMenuItem } from '@/navigation-menu-item/display/utils/isCoreWorkflowsObjectNavigationMenuItem';
import { ObjectIconWithViewOverlay } from '@/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay';
import { lastVisitedViewPerObjectMetadataItemState } from '@/navigation/states/lastVisitedViewPerObjectMetadataItemState';
+import { ObjectMetadataIcon } from '@/object-metadata/components/ObjectMetadataIcon';
import { objectMetadataItemsSelector } from '@/object-metadata/states/objectMetadataItemsSelector';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
@@ -167,9 +168,7 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
objectColor={objectNavItemColor}
/>
)
- : getIcon(objectMetadataItem.icon);
-
- const iconThemeColor = !isRecord ? objectNavItemColor : undefined;
+ : () => <ObjectMetadataIcon objectMetadataItem={objectMetadataItem} />;
const isWorkflowCoreIndexPageEnabled = useIsFeatureEnabled(
FeatureFlagKey.IS_WORKFLOW_CORE_INDEX_PAGE_ENABLED,
@@ -181,8 +180,9 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
isWorkflowCoreIndexPageEnabled,
});
- const objectSecondaryLabel =
- isRecord || isViewWithResolvedView
+ const objectSecondaryLabel = isViewWithResolvedView
+ ? objectMetadataItem.labelPlural
+ : isRecord
? objectMetadataItem.labelSingular
: undefined;
@@ -206,7 +206,6 @@ export const NavigationDrawerItemForObjectMetadataItem = ({
}
onClick={handleClick}
Icon={Icon}
- iconColor={iconThemeColor}
active={isActive}
isSelectedInEditMode={isSelectedInEditMode}
isDragging={isDragging}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/__tests__/getNavigationMenuItemSecondaryLabel.test.ts b/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/__tests__/getNavigationMenuItemSecondaryLabel.test.ts
index 58e96d095ea..fcea4a1e95d 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/__tests__/getNavigationMenuItemSecondaryLabel.test.ts
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/__tests__/getNavigationMenuItemSecondaryLabel.test.ts
@@ -20,6 +20,16 @@ describe('getObjectNavigationMenuItemSecondaryLabel', () => {
expect(result).toBe('Person');
});
+ it('should return labelPlural for a view menu item', () => {
+ const result = getObjectNavigationMenuItemSecondaryLabel({
+ isView: true,
+ objectMetadataItems: getTestEnrichedObjectMetadataItemsMock(),
+ navigationMenuItemObjectNameSingular: 'person',
+ });
+
+ expect(result).toBe('People');
+ });
+
it('should return undefined when object metadata item is not found', () => {
const result = getObjectNavigationMenuItemSecondaryLabel({
objectMetadataItems: getTestEnrichedObjectMetadataItemsMock(),
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/getObjectNavigationMenuItemSecondaryLabel.ts b/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/getObjectNavigationMenuItemSecondaryLabel.ts
index 6e4c5805534..37abb7516e8 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/getObjectNavigationMenuItemSecondaryLabel.ts
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/object/utils/getObjectNavigationMenuItemSecondaryLabel.ts
@@ -3,21 +3,27 @@ import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/Enriche
type GetObjectNavigationMenuItemSecondaryLabelProps = {
objectMetadataItems: Pick<
EnrichedObjectMetadataItem,
- 'nameSingular' | 'labelSingular'
+ 'nameSingular' | 'labelSingular' | 'labelPlural'
>[];
navigationMenuItemObjectNameSingular: string;
+ isView?: boolean;
};
export const getObjectNavigationMenuItemSecondaryLabel = ({
objectMetadataItems,
navigationMenuItemObjectNameSingular,
+ isView = false,
}: GetObjectNavigationMenuItemSecondaryLabelProps) => {
if (navigationMenuItemObjectNameSingular === 'view') {
return 'View';
}
- return objectMetadataItems.find(
+ const objectMetadataItem = objectMetadataItems.find(
(objectMetadataItem) =>
objectMetadataItem.nameSingular === navigationMenuItemObjectNameSingular,
- )?.labelSingular;
+ );
+
+ return isView
+ ? objectMetadataItem?.labelPlural
+ : objectMetadataItem?.labelSingular;
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/page-layout/components/NavigationMenuItemPageLayoutDisplay.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/page-layout/components/NavigationMenuItemPageLayoutDisplay.tsx
index 2f7fa207db1..243f85316db 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/page-layout/components/NavigationMenuItemPageLayoutDisplay.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/page-layout/components/NavigationMenuItemPageLayoutDisplay.tsx
@@ -1,9 +1,7 @@
import { useLocation } from 'react-router-dom';
-import { isDefined } from 'twenty-shared/utils';
-import { useIcons } from 'twenty-ui/icon';
import { isLayoutCustomizationModeEnabledState } from '@/layout-customization/states/isLayoutCustomizationModeEnabledState';
-import { getNavigationMenuItemColor } from '@/navigation-menu-item/common/utils/getNavigationMenuItemColor';
+import { NavigationMenuItemIcon } from '@/navigation-menu-item/display/components/NavigationMenuItemIcon';
import { getPageLayoutNavigationMenuItemComputedLink } from '@/navigation-menu-item/display/page-layout/utils/getPageLayoutNavigationMenuItemComputedLink';
import type { NavigationMenuItemSectionContentProps } from '@/navigation-menu-item/display/sections/types/NavigationMenuItemSectionContentProps';
import { NavigationDrawerItem } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerItem';
@@ -22,14 +20,11 @@ export const NavigationMenuItemPageLayoutDisplay = ({
isLayoutCustomizationModeEnabledState,
);
- const { getIcon } = useIcons();
const location = useLocation();
const label = item.name ?? '';
const computedLink = getPageLayoutNavigationMenuItemComputedLink(item);
- const pageLayoutColor = getNavigationMenuItemColor(item);
- const Icon = isDefined(item.icon) ? getIcon(item.icon) : undefined;
const isActive = computedLink !== '' && location.pathname === computedLink;
return (
@@ -45,8 +40,7 @@ export const NavigationMenuItemPageLayoutDisplay = ({
? editModeProps?.onEditModeClick
: undefined
}
- Icon={Icon}
- iconColor={pageLayoutColor}
+ Icon={() => <NavigationMenuItemIcon navigationMenuItem={item} />}
active={isActive}
isSelectedInEditMode={editModeProps?.isSelectedInEditMode}
isDragging={isDragging}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay.tsx b/packages/twenty-front/src/modules/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay.tsx
index 26b6e436665..61bf2b4044f 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/display/view/components/ObjectIconWithViewOverlay.tsx
@@ -1,6 +1,6 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { styled } from '@linaria/react';
import { useContext } from 'react';
-import { getIconTileColorShades } from 'twenty-ui/primitives/data-display';
import { type IconComponent } from 'twenty-ui/icon';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
@@ -10,26 +10,10 @@ const StyledCompositeContainer = styled.div`
box-sizing: border-box;
display: flex;
flex-shrink: 0;
- height: 16px;
+ height: calc(${themeCssVariables.icon.size.md} * 1px);
justify-content: center;
position: relative;
- width: 16px;
-`;
-
-const StyledObjectIconWrapper = styled.div<{
- $backgroundColor: string;
- $borderColor?: string;
-}>`
- align-items: center;
- background-color: ${({ $backgroundColor }) => $backgroundColor};
- border: ${({ $borderColor }) =>
- $borderColor ? `1px solid ${$borderColor}` : 'none'};
- border-radius: ${themeCssVariables.border.radius.sm};
- box-sizing: border-box;
- display: flex;
- inset: 0;
- justify-content: center;
- position: absolute;
+ width: calc(${themeCssVariables.icon.size.md} * 1px);
`;
const StyledViewOverlay = styled.div<{ $backgroundColor: string }>`
@@ -57,20 +41,10 @@ export const ObjectIconWithViewOverlay = ({
objectColor,
}: ObjectIconWithViewOverlayProps) => {
const { theme } = useContext(ThemeContext);
- const objectStyle = getIconTileColorShades(objectColor);
return (
<StyledCompositeContainer>
- <StyledObjectIconWrapper
- $backgroundColor={objectStyle.backgroundColor}
- $borderColor={objectStyle.borderColor}
- >
- <ObjectIcon
- size="14px"
- stroke={theme.icon.stroke.md}
- color={objectStyle.iconColor}
- />
- </StyledObjectIconWrapper>
+ <ColoredIcon Icon={ObjectIcon} color={objectColor} />
<StyledViewOverlay $backgroundColor={themeCssVariables.grayScale.gray4}>
<ViewIcon
size="12px"
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEntrance.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEntrance.tsx
new file mode 100644
index 00000000000..82a6a4f183e
--- /dev/null
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/NavigationMenuItemEntrance.tsx
@@ -0,0 +1,33 @@
+import { styled } from '@linaria/react';
+import { motion, useReducedMotion } from 'framer-motion';
+import { type ReactNode, useContext } from 'react';
+import { ThemeContext } from 'twenty-ui/theme-constants';
+
+const StyledContainer = styled.div`
+ overflow: hidden;
+`;
+
+const AnimatedContainer = motion.create(StyledContainer);
+
+type NavigationMenuItemEntranceProps = {
+ children: ReactNode;
+};
+
+export const NavigationMenuItemEntrance = ({
+ children,
+}: NavigationMenuItemEntranceProps) => {
+ const { theme } = useContext(ThemeContext);
+ const shouldReduceMotion = useReducedMotion();
+
+ return (
+ <AnimatedContainer
+ initial={shouldReduceMotion ? false : { height: 0, opacity: 0 }}
+ animate={{ height: 'auto', opacity: 1 }}
+ transition={{
+ duration: shouldReduceMotion ? 0 : theme.animation.duration.normal,
+ }}
+ >
+ {children}
+ </AnimatedContainer>
+ );
+};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/WorkspaceSectionAddMenuItemButton.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/WorkspaceSectionAddMenuItemButton.tsx
index 64fad792b99..a4e047a5cbf 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/components/WorkspaceSectionAddMenuItemButton.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/components/WorkspaceSectionAddMenuItemButton.tsx
@@ -1,7 +1,10 @@
import { useLingui } from '@lingui/react/macro';
+import { styled } from '@linaria/react';
import React from 'react';
import { SidePanelPages } from 'twenty-shared/types';
import { IconColumnInsertRight, IconPlus } from 'twenty-ui/icon';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
+import { NavigationMenuItemEntrance } from '@/navigation-menu-item/edit/components/NavigationMenuItemEntrance';
import { pendingInsertionNavigationMenuItemState } from '@/navigation-menu-item/common/states/pendingInsertionNavigationMenuItemState';
import { selectedNavigationMenuItemIdInEditModeState } from '@/navigation-menu-item/common/states/selectedNavigationMenuItemIdInEditModeState';
@@ -12,6 +15,10 @@ import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
+const StyledContainer = styled.div`
+ padding-top: ${themeCssVariables.spacing['0.5']};
+`;
+
export const WorkspaceSectionAddMenuItemButton = () => {
const { t } = useLingui();
const { navigateSidePanel } = useNavigateSidePanel();
@@ -42,13 +49,17 @@ export const WorkspaceSectionAddMenuItemButton = () => {
pendingInsertionNavigationMenuItem === null;
return (
- <NavigationDrawerItem
- Icon={IconPlus}
- label={t`Add menu item`}
- onClick={handleClick}
- triggerEvent="CLICK"
- variant="tertiary"
- isSelectedInEditMode={isSelected}
- />
+ <NavigationMenuItemEntrance>
+ <StyledContainer>
+ <NavigationDrawerItem
+ Icon={IconPlus}
+ label={t`Add menu item`}
+ onClick={handleClick}
+ triggerEvent="CLICK"
+ variant="tertiary"
+ isSelectedInEditMode={isSelected}
+ />
+ </StyledContainer>
+ </NavigationMenuItemEntrance>
);
};
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelEditFolderPickerSubPage.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelEditFolderPickerSubPage.tsx
index 567c552f3d0..1f66aacdf48 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelEditFolderPickerSubPage.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelEditFolderPickerSubPage.tsx
@@ -1,6 +1,6 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { useLingui } from '@lingui/react/macro';
import { useState } from 'react';
-import { TintedIconTile } from 'twenty-ui/primitives/data-display';
import { useIcons } from 'twenty-ui/icon';
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
@@ -71,7 +71,7 @@ export const SidePanelEditFolderPickerSubPage = () => {
>
<CommandMenuItem
LeftComponent={
- <TintedIconTile Icon={FolderIcon} color={folderColor} />
+ <ColoredIcon Icon={FolderIcon} color={folderColor} />
}
label={folder.name}
id={folder.id}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
index 044096abd45..35c4fdd5017 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemMainMenu.tsx
@@ -1,7 +1,7 @@
import { useLingui } from '@lingui/react/macro';
import { NavigationMenuItemType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-import { Avatar, TintedIconTile } from 'twenty-ui/primitives/data-display';
+import { Avatar } from 'twenty-ui/primitives/data-display';
import { IconBox, IconFolder, IconLink, IconTable } from 'twenty-ui/icon';
import { themeCssVariables } from 'twenty-ui/theme-constants';
@@ -63,7 +63,7 @@ export const SidePanelNewSidebarItemMainMenu = ({
onEnter={onSelectObject}
>
<CommandMenuItem
- Icon={() => <TintedIconTile Icon={IconBox} color="blue" />}
+ Icon={IconBox}
label={t`Object`}
id={NavigationMenuItemType.OBJECT}
hasSubMenu={true}
@@ -75,7 +75,7 @@ export const SidePanelNewSidebarItemMainMenu = ({
onEnter={onSelectView}
>
<CommandMenuItem
- Icon={() => <TintedIconTile Icon={IconTable} />}
+ Icon={IconTable}
label={t`View`}
id={NavigationMenuItemType.VIEW}
hasSubMenu={true}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemViewObjectPickerSubView.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemViewObjectPickerSubView.tsx
index 6a02148f54f..9baef4c4e35 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemViewObjectPickerSubView.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelNewSidebarItemViewObjectPickerSubView.tsx
@@ -1,5 +1,4 @@
import { useLingui } from '@lingui/react/macro';
-import { TintedIconTile } from 'twenty-ui/primitives/data-display';
import { IconSettings } from 'twenty-ui/icon';
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
@@ -72,7 +71,7 @@ export const SidePanelNewSidebarItemViewObjectPickerSubView = ({
{showSystemObjectsOption && (
<SelectableListItem itemId="system" onEnter={onOpenSystemPicker}>
<CommandMenuItem
- Icon={() => <TintedIconTile Icon={IconSettings} />}
+ Icon={IconSettings}
label={t`System objects`}
id="system"
hasSubMenu={true}
diff --git a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelObjectPickerSubView.tsx b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelObjectPickerSubView.tsx
index c21ff7732f4..0ff527a42c9 100644
--- a/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelObjectPickerSubView.tsx
+++ b/packages/twenty-front/src/modules/navigation-menu-item/edit/side-panel/components/SidePanelObjectPickerSubView.tsx
@@ -1,5 +1,4 @@
import { useLingui } from '@lingui/react/macro';
-import { TintedIconTile } from 'twenty-ui/primitives/data-display';
import { IconSettings } from 'twenty-ui/icon';
import { CommandMenuItem } from '@/command-menu/components/CommandMenuItem';
@@ -70,7 +69,7 @@ export const SidePanelObjectPickerSubView = ({
))}
<SelectableListItem itemId="system" onEnter={onOpenSystemPicker}>
<CommandMenuItem
- Icon={() => <TintedIconTile Icon={IconSettings} />}
+ Icon={IconSettings}
label={t`System objects`}
id="system"
hasSubMenu
diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerContent.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerContent.tsx
index 4bdb426e733..c72ea0ab8a4 100644
--- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerContent.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerContent.tsx
@@ -1,7 +1,6 @@
import { MainNavigationDrawerNavigationContent } from '@/navigation/components/MainNavigationDrawerNavigationContent';
import { NavigationDrawerTabbedContent } from '@/navigation/components/NavigationDrawerTabbedContent';
import { useActiveNavigationDrawerMode } from '@/navigation/hooks/useActiveNavigationDrawerMode';
-import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { useHasPermissionFlag } from '@/settings/roles/hooks/useHasPermissionFlag';
import { NavigationDrawerScrollableContent } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerScrollableContent';
import { NAVIGATION_DRAWER_TABS } from '@/ui/navigation/states/navigationDrawerTabs';
@@ -10,12 +9,8 @@ import { PermissionFlagType } from '~/generated-metadata/graphql';
export const MainNavigationDrawerContent = () => {
const activeNavigationDrawerMode = useActiveNavigationDrawerMode();
const hasAiPermission = useHasPermissionFlag(PermissionFlagType.AI);
- const isExpanded = useIsNavigationDrawerContentExpanded();
- // Chat threads carry no icon of their own, so the icon rail would list them
- // as a column of identical bubbles. The navigation items stay useful there.
const showAiChatContent =
- isExpanded &&
hasAiPermission &&
activeNavigationDrawerMode === NAVIGATION_DRAWER_TABS.AI_CHAT_HISTORY;
diff --git a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx
index 712c00f65f1..dad36ba880a 100644
--- a/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/MainNavigationDrawerModeSwitcher.tsx
@@ -1,3 +1,4 @@
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { motion, useReducedMotion } from 'framer-motion';
@@ -19,14 +20,11 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
// Expanded, the row is sized off the page card header beside it so the rules
-// read as one line across both columns. Collapsed, the modes stack into the
-// icon rail and the rules would cut it in half, so they go.
+// read as one line across both columns.
const StyledSwitcher = styled.div<{ isExpanded: boolean }>`
align-items: ${({ isExpanded }) => (isExpanded ? 'center' : 'flex-start')};
border-bottom: ${({ isExpanded }) =>
isExpanded ? `1px solid ${themeCssVariables.border.color.light}` : 'none'};
- border-top: ${({ isExpanded }) =>
- isExpanded ? `1px solid ${themeCssVariables.border.color.light}` : 'none'};
box-sizing: border-box;
display: flex;
flex-direction: ${({ isExpanded }) => (isExpanded ? 'row' : 'column')};
@@ -65,7 +63,10 @@ const StyledMode = styled.button<{ isActive: boolean; isExpanded: boolean }>`
font-weight: ${themeCssVariables.font.weight.medium};
gap: ${({ isActive, isExpanded }) =>
isActive && isExpanded ? themeCssVariables.spacing[1] : '0'};
- height: ${themeCssVariables.spacing[7]};
+ height: ${({ isExpanded }) =>
+ isExpanded
+ ? themeCssVariables.spacing[7]
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
justify-content: ${({ isExpanded }) =>
isExpanded ? 'flex-start' : 'center'};
// A flex item will not shrink past its content without this, so flex-shrink
@@ -78,7 +79,7 @@ const StyledMode = styled.button<{ isActive: boolean; isExpanded: boolean }>`
color calc(${themeCssVariables.animation.duration.fast} * 1s) ease,
gap calc(${themeCssVariables.animation.duration.normal} * 1s) ease;
width: ${({ isExpanded }) =>
- isExpanded ? 'auto' : themeCssVariables.spacing[6]};
+ isExpanded ? 'auto' : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
&[aria-disabled='true'] {
color: ${themeCssVariables.font.color.light};
diff --git a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
index 5dd2d1f5c09..22fe846eb1b 100644
--- a/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
+++ b/packages/twenty-front/src/modules/navigation/components/SettingsNavigationDrawerContent.tsx
@@ -1,3 +1,4 @@
+import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { MOBILE_NAVIGATION_BAR_CLEARANCE } from '@/navigation/constants/MobileNavigationBarClearance';
import { SettingsNavigationDrawerItems } from '@/settings/components/SettingsNavigationDrawerItems';
import { AdvancedSettingsSwitch } from '@/ui/input/components/AdvancedSettingsSwitch';
@@ -29,6 +30,7 @@ const advancedSettingsSwitchClassName = css`
export const SettingsNavigationDrawerContent = () => {
const { t } = useLingui();
const isMobile = useIsMobile();
+ const isNavigationDrawerExpanded = useIsNavigationDrawerContentExpanded();
const [isAdvancedModeEnabled, setIsAdvancedModeEnabled] = useAtomState(
isAdvancedModeEnabledState,
);
@@ -46,6 +48,7 @@ export const SettingsNavigationDrawerContent = () => {
isAdvancedModeEnabled={isAdvancedModeEnabled}
setIsAdvancedModeEnabled={setIsAdvancedModeEnabled}
label={t`Advanced`}
+ isCompact={!isNavigationDrawerExpanded}
/>
</NavigationDrawerSection>
</StyledAdvancedSwitchFixedContent>
diff --git a/packages/twenty-front/src/modules/navigation/components/__stories__/MainNavigationDrawerContent.stories.tsx b/packages/twenty-front/src/modules/navigation/components/__stories__/MainNavigationDrawerContent.stories.tsx
new file mode 100644
index 00000000000..12e46f265da
--- /dev/null
+++ b/packages/twenty-front/src/modules/navigation/components/__stories__/MainNavigationDrawerContent.stories.tsx
@@ -0,0 +1,117 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { createStore, Provider } from 'jotai';
+import { useState } from 'react';
+import { MemoryRouter } from 'react-router-dom';
+import { expect, userEvent, within } from 'storybook/test';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { AGENT_CHAT_INSTANCE_ID } from '@/ai/constants/AgentChatInstanceId';
+import { AgentChatComponentInstanceContext } from '@/ai/contexts/AgentChatComponentInstanceContext';
+import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
+import { metadataStoreState } from '@/metadata-store/states/metadataStoreState';
+import { MainNavigationDrawerContent } from '@/navigation/components/MainNavigationDrawerContent';
+import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
+import { PermissionFlagType } from '~/generated-metadata/graphql';
+import { IconsProviderDecorator } from '~/testing/decorators/IconsProviderDecorator';
+import { ToastDecorator } from '~/testing/decorators/ToastDecorator';
+
+const THREAD = {
+ id: '3a36fc8c-c8e2-4f16-a283-24dc05e3704b',
+ title: 'Pipeline summary',
+ createdAt: '2026-01-01T12:00:00.000Z',
+ updatedAt: '2026-01-01T12:00:00.000Z',
+ conversationSize: 0,
+ totalCacheReadTokens: 0,
+ totalInputCredits: 0,
+ totalInputTokens: 0,
+ totalOutputCredits: 0,
+ totalOutputTokens: 0,
+};
+
+const ContentWithCollapseControl = () => {
+ const [isExpanded, setIsExpanded] = useAtomState(
+ isNavigationDrawerExpandedState,
+ );
+
+ return (
+ <>
+ <button onClick={() => setIsExpanded(!isExpanded)}>
+ {isExpanded ? 'Collapse sidebar' : 'Expand sidebar'}
+ </button>
+ <MainNavigationDrawerContent />
+ </>
+ );
+};
+
+const AiNavigationContent = () => {
+ const [store] = useState(() => {
+ const initialStore = createStore();
+ initialStore.set(isNavigationDrawerExpandedState.atom, true);
+ initialStore.set(currentUserWorkspaceState.atom, {
+ permissionFlags: [PermissionFlagType.AI],
+ objectsPermissions: [],
+ isImpersonating: false,
+ twoFactorAuthenticationMethodSummary: null,
+ });
+ initialStore.set(metadataStoreState.atomFamily('agentChatThreads'), {
+ current: [THREAD],
+ draft: [],
+ status: 'up-to-date',
+ });
+ return initialStore;
+ });
+
+ return (
+ <Provider store={store}>
+ <MemoryRouter initialEntries={['/chat']}>
+ <AgentChatComponentInstanceContext.Provider
+ value={{ instanceId: AGENT_CHAT_INSTANCE_ID }}
+ >
+ <ContentWithCollapseControl />
+ </AgentChatComponentInstanceContext.Provider>
+ </MemoryRouter>
+ </Provider>
+ );
+};
+
+const meta: Meta<typeof MainNavigationDrawerContent> = {
+ title: 'Modules/Navigation/MainNavigationDrawerContent',
+ component: MainNavigationDrawerContent,
+ decorators: [ComponentDecorator, IconsProviderDecorator, ToastDecorator],
+ parameters: { container: { width: 240, height: 400 } },
+ render: () => <AiNavigationContent />,
+};
+
+export default meta;
+type Story = StoryObj<typeof MainNavigationDrawerContent>;
+
+export const KeepsAiContentWhenCollapsed: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ await expect(
+ await canvas.findByRole('button', { name: /Pipeline summary/ }),
+ ).toBeVisible();
+ const chatActions = await canvas.findByLabelText('Chat actions', {
+ selector: 'button',
+ });
+ chatActions.focus();
+ await expect(chatActions).toHaveFocus();
+ await userEvent.click(
+ await canvas.findByRole('button', { name: 'Collapse sidebar' }),
+ );
+ await expect(
+ await canvas.findByRole('button', { name: /Pipeline summary/ }),
+ ).toBeVisible();
+ chatActions.focus();
+ await expect(chatActions).not.toHaveFocus();
+ await userEvent.click(
+ await canvas.findByRole('button', { name: 'Expand sidebar' }),
+ );
+ await expect(
+ await canvas.findByRole('button', { name: /Pipeline summary/ }),
+ ).toBeVisible();
+ chatActions.focus();
+ await expect(chatActions).toHaveFocus();
+ },
+};
diff --git a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useSwitchNavigationDrawerMode.test.tsx b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useSwitchNavigationDrawerMode.test.tsx
index 8f440ff45d9..14326541470 100644
--- a/packages/twenty-front/src/modules/navigation/hooks/__tests__/useSwitchNavigationDrawerMode.test.tsx
+++ b/packages/twenty-front/src/modules/navigation/hooks/__tests__/useSwitchNavigationDrawerMode.test.tsx
@@ -19,6 +19,16 @@ jest.mock('@/ai/hooks/useSwitchToNewAiChat');
jest.mock('@/navigation/hooks/useDefaultHomePagePath');
jest.mock('@/ui/utilities/responsive/hooks/useIsMobile');
+jest.mock('@/side-panel/hooks/useSidePanelMenu', () => ({
+ useSidePanelMenu: () => ({ closeSidePanelMenu: jest.fn() }),
+}));
+jest.mock('@/ai/hooks/useSelectAiChatThread', () => ({
+ useSelectAiChatThread: () => ({ selectAiChatThread: jest.fn() }),
+}));
+jest.mock('@/side-panel/hooks/useOpenAskAiPageInSidePanel', () => ({
+ useOpenAskAiPageInSidePanel: () => ({ openAskAiPage: jest.fn() }),
+}));
+
const DEFAULT_HOME_PAGE_PATH = '/objects/companies';
const AI_CHAT_PATH = '/chat/20202020-0687-4c41-b707-ed1bfca972a7';
@@ -77,7 +87,8 @@ describe('useSwitchNavigationDrawerMode', () => {
jest.mocked(useIsMobile).mockReturnValue(false);
});
- it('leaves settings for the memorized location and restores the drawer', () => {
+ it('leaves settings for the memorized location and restores the mobile drawer', () => {
+ jest.mocked(useIsMobile).mockReturnValue(true);
const { result, store } = renderSwitchNavigationDrawerMode({
pathname: '/settings/profile',
expandedMemorized: false,
@@ -178,6 +189,110 @@ describe('useSwitchNavigationDrawerMode', () => {
expect(mockSwitchToNewChat).not.toHaveBeenCalled();
});
+ it.each([false, true])(
+ 'preserves desktop sidebar expansion (%s) when opening settings and returning home',
+ (isExpanded) => {
+ const { result, store } = renderSwitchNavigationDrawerMode({
+ pathname: '/objects/people',
+ });
+ act(() => store.set(isNavigationDrawerExpandedState.atom, isExpanded));
+
+ act(() =>
+ result.current.switchNavigationDrawerMode(
+ NAVIGATION_DRAWER_TABS.SETTINGS,
+ ),
+ );
+
+ expect(result.current.location.pathname).toBe('/settings/profile');
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(isExpanded);
+
+ act(() =>
+ result.current.switchNavigationDrawerMode(
+ NAVIGATION_DRAWER_TABS.NAVIGATION_MENU,
+ ),
+ );
+
+ expect(result.current.location.pathname).toBe('/objects/people');
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(isExpanded);
+ },
+ );
+
+ it.each([false, true])(
+ 'keeps the latest desktop sidebar choice (%s) when leaving settings',
+ (isExpanded) => {
+ const { result, store } = renderSwitchNavigationDrawerMode({
+ pathname: DEFAULT_HOME_PAGE_PATH,
+ });
+ act(() => store.set(isNavigationDrawerExpandedState.atom, !isExpanded));
+ act(() =>
+ result.current.switchNavigationDrawerMode(
+ NAVIGATION_DRAWER_TABS.SETTINGS,
+ ),
+ );
+ expect(result.current.location.pathname).toBe('/settings/profile');
+
+ act(() => store.set(isNavigationDrawerExpandedState.atom, isExpanded));
+ act(() =>
+ result.current.switchNavigationDrawerMode(
+ NAVIGATION_DRAWER_TABS.NAVIGATION_MENU,
+ ),
+ );
+
+ expect(result.current.location.pathname).toBe(DEFAULT_HOME_PAGE_PATH);
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(isExpanded);
+ },
+ );
+
+ it('stays collapsed through Home → Settings → AI → Home', () => {
+ jest.mocked(useSwitchToNewAiChat).mockImplementation(
+ jest.requireActual<{
+ useSwitchToNewAiChat: typeof useSwitchToNewAiChat;
+ }>('@/ai/hooks/useSwitchToNewAiChat').useSwitchToNewAiChat,
+ );
+ jest.mocked(useReturnFromExpandedAiChat).mockImplementation(
+ jest.requireActual<{
+ useReturnFromExpandedAiChat: typeof useReturnFromExpandedAiChat;
+ }>('@/ai/hooks/useReturnFromExpandedAiChat').useReturnFromExpandedAiChat,
+ );
+ const { result, store } = renderSwitchNavigationDrawerMode({
+ pathname: DEFAULT_HOME_PAGE_PATH,
+ });
+ act(() => store.set(isNavigationDrawerExpandedState.atom, false));
+
+ expect(result.current.location.pathname).toBe(DEFAULT_HOME_PAGE_PATH);
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(false);
+
+ for (const [mode, pathname] of [
+ [NAVIGATION_DRAWER_TABS.SETTINGS, '/settings/profile'],
+ [NAVIGATION_DRAWER_TABS.AI_CHAT_HISTORY, '/chat'],
+ [NAVIGATION_DRAWER_TABS.NAVIGATION_MENU, DEFAULT_HOME_PAGE_PATH],
+ ] as const) {
+ window.history.replaceState(null, '', result.current.location.pathname);
+ act(() => result.current.switchNavigationDrawerMode(mode));
+
+ expect(result.current.location.pathname).toBe(pathname);
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(false);
+ }
+ window.history.replaceState(null, '', '/');
+ });
+
+ it('opens the settings drawer on mobile even when it was closed', () => {
+ jest.mocked(useIsMobile).mockReturnValue(true);
+ const { result, store } = renderSwitchNavigationDrawerMode({
+ pathname: '/objects/people',
+ });
+ act(() => store.set(isNavigationDrawerExpandedState.atom, false));
+
+ act(() =>
+ result.current.switchNavigationDrawerMode(
+ NAVIGATION_DRAWER_TABS.SETTINGS,
+ ),
+ );
+
+ expect(result.current.location.pathname).toBe('/settings/profile');
+ expect(store.get(isNavigationDrawerExpandedState.atom)).toBe(true);
+ });
+
it('opens settings and memorizes where it came from', () => {
const { result, store } = renderSwitchNavigationDrawerMode({
pathname: '/objects/people',
diff --git a/packages/twenty-front/src/modules/navigation/hooks/useNavigationDrawerExpanded.ts b/packages/twenty-front/src/modules/navigation/hooks/useNavigationDrawerExpanded.ts
index be250cd4b36..455b20c7d1b 100644
--- a/packages/twenty-front/src/modules/navigation/hooks/useNavigationDrawerExpanded.ts
+++ b/packages/twenty-front/src/modules/navigation/hooks/useNavigationDrawerExpanded.ts
@@ -1,15 +1,5 @@
-import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
-import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-export const useNavigationDrawerExpanded = () => {
- const isMobile = useIsMobile();
- const isSettingsDrawer = useIsSettingsDrawer();
- const isNavigationDrawerExpanded = useAtomStateValue(
- isNavigationDrawerExpandedState,
- );
- return isMobile
- ? isNavigationDrawerExpanded
- : isSettingsDrawer || isNavigationDrawerExpanded;
-};
+export const useNavigationDrawerExpanded = () =>
+ useAtomStateValue(isNavigationDrawerExpandedState);
diff --git a/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts b/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts
index c7babc6e0fd..c2755b9294f 100644
--- a/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts
+++ b/packages/twenty-front/src/modules/navigation/hooks/useOpenSettings.ts
@@ -8,10 +8,12 @@ import { navigationMemorizedUrlState } from '@/ui/navigation/states/navigationMe
import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
import { useCallback } from 'react';
+import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useLocation } from 'react-router-dom';
export const useOpenSettingsMenu = () => {
const location = useLocation();
+ const isMobile = useIsMobile();
const isSettingsPage = useIsSettingsPage();
const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] =
useAtomState(isNavigationDrawerExpandedState);
@@ -33,12 +35,15 @@ export const useOpenSettingsMenu = () => {
return;
}
- setNavigationDrawerExpandedMemorized(isNavigationDrawerExpanded);
- setIsNavigationDrawerExpanded(true);
+ if (isMobile) {
+ setNavigationDrawerExpandedMemorized(isNavigationDrawerExpanded);
+ setIsNavigationDrawerExpanded(true);
+ }
setNavigationMemorizedUrl(location.pathname + location.search);
setCurrentMobileNavigationDrawer('settings');
setNavigationDrawerActiveTab(NAVIGATION_DRAWER_TABS.NAVIGATION_MENU);
}, [
+ isMobile,
isSettingsPage,
isNavigationDrawerExpanded,
location.pathname,
diff --git a/packages/twenty-front/src/modules/navigation/hooks/useSwitchNavigationDrawerMode.ts b/packages/twenty-front/src/modules/navigation/hooks/useSwitchNavigationDrawerMode.ts
index 55d03d47f3a..1f5cbdf5389 100644
--- a/packages/twenty-front/src/modules/navigation/hooks/useSwitchNavigationDrawerMode.ts
+++ b/packages/twenty-front/src/modules/navigation/hooks/useSwitchNavigationDrawerMode.ts
@@ -1,3 +1,4 @@
+import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { useLocation, useNavigate } from 'react-router-dom';
import { SettingsPath } from 'twenty-shared/types';
@@ -24,6 +25,7 @@ import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { isAiChatPath } from '~/utils/isAiChatPath';
export const useSwitchNavigationDrawerMode = () => {
+ const isMobile = useIsMobile();
const location = useLocation();
const navigate = useNavigate();
const navigateSettings = useNavigateSettings();
@@ -64,7 +66,9 @@ export const useSwitchNavigationDrawerMode = () => {
if (isSettingsDrawer) {
setCurrentMobileNavigationDrawer('main');
- setIsNavigationDrawerExpanded(navigationDrawerExpandedMemorized);
+ if (isMobile) {
+ setIsNavigationDrawerExpanded(navigationDrawerExpandedMemorized);
+ }
navigate(
getNavigationDrawerHomeDestination({
memorizedUrl: navigationMemorizedUrl,
diff --git a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataIcon.tsx b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataIcon.tsx
index f412d21ab61..0a3ddacac4c 100644
--- a/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataIcon.tsx
+++ b/packages/twenty-front/src/modules/object-metadata/components/ObjectMetadataIcon.tsx
@@ -1,6 +1,6 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
-import { TintedIconTile } from 'twenty-ui/primitives/data-display';
import { useIcons } from 'twenty-ui/icon';
export type ObjectMetadataIconInput = Pick<
@@ -23,7 +23,7 @@ export const ObjectMetadataIcon = ({
const Icon = getIcon(objectMetadataItem?.icon);
return (
- <TintedIconTile
+ <ColoredIcon
Icon={Icon}
color={getObjectColorWithFallback(objectMetadataItem)}
size={size}
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/__tests__/getObjectColorWithFallback.test.ts b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/getObjectColorWithFallback.test.ts
new file mode 100644
index 00000000000..430addce62f
--- /dev/null
+++ b/packages/twenty-front/src/modules/object-metadata/utils/__tests__/getObjectColorWithFallback.test.ts
@@ -0,0 +1,64 @@
+import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
+
+describe('getObjectColorWithFallback', () => {
+ it('should return gray when no object metadata item is provided', () => {
+ expect(getObjectColorWithFallback(undefined)).toBe('gray');
+ });
+
+ it('should return gray for system objects', () => {
+ expect(
+ getObjectColorWithFallback({
+ nameSingular: 'rocket',
+ color: 'purple',
+ isSystem: true,
+ }),
+ ).toBe('gray');
+ });
+
+ it('should return the stored color when there is one', () => {
+ expect(
+ getObjectColorWithFallback({
+ nameSingular: 'rocket',
+ color: 'purple',
+ isSystem: false,
+ }),
+ ).toBe('purple');
+ });
+
+ it('should fall back to the standard object color', () => {
+ expect(
+ getObjectColorWithFallback({
+ nameSingular: 'company',
+ color: null,
+ isSystem: false,
+ }),
+ ).toBe('blue');
+ });
+
+ it('should derive a stable color from the name of a custom object', () => {
+ const color = getObjectColorWithFallback({
+ nameSingular: 'rocket',
+ color: null,
+ isSystem: false,
+ });
+
+ expect(color).not.toBe('gray');
+ expect(
+ getObjectColorWithFallback({
+ nameSingular: 'rocket',
+ color: null,
+ isSystem: false,
+ }),
+ ).toBe(color);
+ });
+
+ it('should return gray when the object has neither a color nor a name yet', () => {
+ expect(
+ getObjectColorWithFallback({
+ nameSingular: undefined,
+ color: undefined,
+ isSystem: false,
+ }),
+ ).toBe('gray');
+ });
+});
diff --git a/packages/twenty-front/src/modules/object-metadata/utils/getObjectColorWithFallback.ts b/packages/twenty-front/src/modules/object-metadata/utils/getObjectColorWithFallback.ts
index 464ffe97b6a..6c623bffa3f 100644
--- a/packages/twenty-front/src/modules/object-metadata/utils/getObjectColorWithFallback.ts
+++ b/packages/twenty-front/src/modules/object-metadata/utils/getObjectColorWithFallback.ts
@@ -39,7 +39,9 @@ const getColorForCustomObject = (seed: string): ThemeColor => {
export const getObjectColorWithFallback = (
objectMetadataItem:
- | Pick<EnrichedObjectMetadataItem, 'nameSingular' | 'color' | 'isSystem'>
+ | (Pick<EnrichedObjectMetadataItem, 'color' | 'isSystem'> & {
+ nameSingular?: string | null;
+ })
| null
| undefined,
): ThemeColor => {
@@ -55,9 +57,14 @@ export const getObjectColorWithFallback = (
return objectMetadataItem.color as ThemeColor;
}
+ const nameSingular = objectMetadataItem.nameSingular;
+
+ if (!isNonEmptyString(nameSingular)) {
+ return SYSTEM_OBJECT_COLOR;
+ }
+
return (
- STANDARD_OBJECT_FALLBACK_COLOR[
- objectMetadataItem.nameSingular as CoreObjectNameSingular
- ] ?? getColorForCustomObject(objectMetadataItem.nameSingular)
+ STANDARD_OBJECT_FALLBACK_COLOR[nameSingular as CoreObjectNameSingular] ??
+ getColorForCustomObject(nameSingular)
);
};
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx
index b3f63e3489c..cee5a582f78 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/components/SettingsUpdateDataModelObjectAboutForm.tsx
@@ -17,7 +17,7 @@ import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomState
import { zodResolver } from '@hookform/resolvers/zod';
import { useLingui } from '@lingui/react/macro';
import { FormProvider, useForm } from 'react-hook-form';
-import { parseThemeColor } from 'twenty-ui/utilities';
+import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
type SettingsUpdateDataModelObjectAboutFormProps = {
objectMetadataItem: EnrichedObjectMetadataItem;
@@ -56,7 +56,7 @@ export const SettingsUpdateDataModelObjectAboutForm = ({
namePlural,
nameSingular,
...(isCustomObject
- ? { color: parseThemeColor(objectMetadataItem.color) }
+ ? { color: getObjectColorWithFallback(objectMetadataItem) }
: {}),
},
});
diff --git a/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts b/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts
index 55e5882ccae..ecf4ede3ac3 100644
--- a/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts
+++ b/packages/twenty-front/src/modules/settings/data-model/object-details/hooks/useSaveUpdateDataModelObjectAboutForm.ts
@@ -15,7 +15,7 @@ import { TRANSLATABLE_PROPERTIES_BY_METADATA_NAME } from 'twenty-shared/i18n';
import { SOURCE_LOCALE } from 'twenty-shared/translations';
import { SettingsPath } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-import { parseThemeColor } from 'twenty-ui/utilities';
+import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
import { useLocaleOptions } from '~/localization/hooks/useLocaleOptions';
import { MetadataTranslationsDocument } from '~/generated-metadata/graphql';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
@@ -131,10 +131,12 @@ export const useSaveUpdateDataModelObjectAboutForm = ({
nameSingular: updatedObject?.data?.updateOneObject.nameSingular,
...(isCustomObject
? {
- color: parseThemeColor(
- updatedObject?.data?.updateOneObject.color ??
+ color: getObjectColorWithFallback({
+ ...objectMetadataItem,
+ color:
+ updatedObject?.data?.updateOneObject.color ??
objectMetadataItem.color,
- ),
+ }),
}
: {}),
});
diff --git a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
index 16cadc1a8b9..5e5f5049acc 100644
--- a/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
+++ b/packages/twenty-front/src/modules/settings/data-model/objects/forms/components/SettingsDataModelObjectAboutForm.tsx
@@ -1,3 +1,4 @@
+import { getObjectColorWithFallback } from '@/object-metadata/utils/getObjectColorWithFallback';
import { useGetIsMetadataItemCustom } from '@/object-metadata/hooks/useGetIsMetadataItemCustom';
import { type EnrichedObjectMetadataItem } from '@/object-metadata/types/EnrichedObjectMetadataItem';
import { AdvancedSettingsWrapper } from '@/settings/components/AdvancedSettingsWrapper';
@@ -18,7 +19,6 @@ import { InlineBanner } from 'twenty-ui/primitives/feedback';
import { IconInfoCircle, IconLink, IconRefresh } from 'twenty-ui/icon';
import { AppTooltip, Card, TooltipDelay } from 'twenty-ui/primitives/surfaces';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
-import { parseThemeColor } from 'twenty-ui/utilities';
import { type StringKeyOf } from 'type-fest';
import { useNavigateSettings } from '~/hooks/useNavigateSettings';
import { computeMetadataNamesFromLabels } from '~/pages/settings/data-model/utils/computeMetadataNamesFromLabels';
@@ -96,6 +96,11 @@ export const SettingsDataModelObjectAboutForm = ({
watch('description');
watch('icon');
const objectIconColor = watch('color');
+ const resolvedIconColor = getObjectColorWithFallback({
+ nameSingular: objectMetadataItem?.nameSingular ?? watch('nameSingular'),
+ isSystem: objectMetadataItem?.isSystem ?? false,
+ color: objectIconColor,
+ });
const apiNameTooltipText =
!isDefined(objectMetadataItem) ||
@@ -153,6 +158,7 @@ export const SettingsDataModelObjectAboutForm = ({
render={({ field: { onChange, value } }) => (
<IconPicker
selectedIconKey={value}
+ iconColor={resolvedIconColor}
disabled={disableEdition}
dropdownId={
isDefined(objectMetadataItem)
@@ -162,7 +168,7 @@ export const SettingsDataModelObjectAboutForm = ({
iconColorPicker={
showObjectColorInIconPicker
? {
- selectedColor: parseThemeColor(objectIconColor),
+ selectedColor: resolvedIconColor,
onColorChange: (nextColor) => {
setValue('color', nextColor, {
shouldDirty: true,
diff --git a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx
index e7b95668586..745cfb544a0 100644
--- a/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx
+++ b/packages/twenty-front/src/modules/settings/hooks/useSettingsNavigationItems.tsx
@@ -30,7 +30,7 @@ import {
IconMessageCircle,
IconPlug,
IconServer,
- IconSettings,
+ IconSettings2,
IconSparkles,
IconUserCircle,
IconUsers,
@@ -116,7 +116,7 @@ const useSettingsNavigationItems = (): SettingsNavigationSection[] => {
{
label: t`General`,
path: SettingsPath.General,
- Icon: IconSettings,
+ Icon: IconSettings2,
isHidden: !permissionMap[PermissionFlagType.WORKSPACE],
},
{
diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx
index 09ccf750957..3b2c74a14c5 100644
--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx
+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelFolderInfo.tsx
@@ -1,8 +1,9 @@
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
+import { DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER } from '@/navigation-menu-item/common/constants/NavigationMenuItemDefaultColorFolder';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { NavigationMenuItemType } from 'twenty-shared/types';
import { isDefined } from 'twenty-shared/utils';
-import { TintedIconTile } from 'twenty-ui/primitives/data-display';
import { useIcons } from 'twenty-ui/icon';
import { FOLDER_ICON_DEFAULT } from '@/navigation-menu-item/common/constants/FolderIconDefault';
@@ -75,9 +76,12 @@ export const SidePanelFolderInfo = () => {
}
clickableComponent={
<StyledClickableIconWrapper>
- <TintedIconTile
+ <ColoredIcon
Icon={FolderIconComponent}
- color={selectedItem.color}
+ color={
+ selectedItem.color ??
+ DEFAULT_NAVIGATION_MENU_ITEM_COLOR_FOLDER
+ }
/>
</StyledClickableIconWrapper>
}
diff --git a/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx b/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx
index 45ed832ff44..0c701d31b06 100644
--- a/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx
+++ b/packages/twenty-front/src/modules/side-panel/components/SidePanelSubViewWithSearch.tsx
@@ -23,10 +23,12 @@ const StyledSearchContainer = styled.div`
const StyledSearchInput = styled.input`
background: transparent;
border: none;
- border-radius: ${themeCssVariables.border.radius.sm};
+ border-radius: 0;
box-sizing: border-box;
+ min-width: 0;
outline: none;
+ overflow: hidden;
padding: 0;
width: 100%;
diff --git a/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts
index 574749a328d..4507b60047d 100644
--- a/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts
+++ b/packages/twenty-front/src/modules/side-panel/constants/SidePanelTopBarHeight.ts
@@ -1 +1,3 @@
-export const SIDE_PANEL_TOP_BAR_HEIGHT = 40;
+import { APP_HEADER_HEIGHT } from '@/ui/layout/constants/AppHeaderHeight';
+
+export const SIDE_PANEL_TOP_BAR_HEIGHT = APP_HEADER_HEIGHT;
diff --git a/packages/twenty-front/src/modules/ui/icon/components/ColoredIcon.tsx b/packages/twenty-front/src/modules/ui/icon/components/ColoredIcon.tsx
new file mode 100644
index 00000000000..885152b8282
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/icon/components/ColoredIcon.tsx
@@ -0,0 +1,33 @@
+import { css } from '@linaria/core';
+import { type IconComponent } from 'twenty-ui/icon';
+import { getIconTileColorShades } from 'twenty-ui/primitives/data-display';
+import { useTheme } from 'twenty-ui/theme-constants';
+
+const iconClassName = css`
+ flex-shrink: 0;
+`;
+
+type ColoredIconProps = {
+ Icon: IconComponent;
+ color?: string | null;
+ size?: number;
+ stroke?: number;
+};
+
+export const ColoredIcon = ({
+ Icon,
+ color,
+ size,
+ stroke,
+}: ColoredIconProps) => {
+ const theme = useTheme();
+
+ return (
+ <Icon
+ className={iconClassName}
+ size={size ?? theme.icon.size.md}
+ stroke={stroke ?? theme.icon.stroke.md}
+ color={getIconTileColorShades(color).iconColor}
+ />
+ );
+};
diff --git a/packages/twenty-front/src/modules/ui/icon/components/__stories__/ColoredIcon.stories.tsx b/packages/twenty-front/src/modules/ui/icon/components/__stories__/ColoredIcon.stories.tsx
new file mode 100644
index 00000000000..d2fbf5678d6
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/icon/components/__stories__/ColoredIcon.stories.tsx
@@ -0,0 +1,19 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { IconBuildingSkyscraper, IconFolder, IconLink } from 'twenty-ui/icon';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { ColoredIcon } from '@/ui/icon/components/ColoredIcon';
+
+const meta: Meta<typeof ColoredIcon> = {
+ title: 'UI/Icon/ColoredIcon',
+ component: ColoredIcon,
+ decorators: [ComponentDecorator],
+ args: { Icon: IconBuildingSkyscraper, color: 'blue' },
+};
+
+export default meta;
+type Story = StoryObj<typeof ColoredIcon>;
+
+export const Object: Story = {};
+export const Folder: Story = { args: { Icon: IconFolder, color: 'orange' } };
+export const Link: Story = { args: { Icon: IconLink, color: 'green' } };
diff --git a/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx b/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx
index 86631709ec0..c048de54c00 100644
--- a/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/AdvancedSettingsSwitch.tsx
@@ -1,18 +1,25 @@
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { styled } from '@linaria/react';
import { useLingui } from '@lingui/react/macro';
import { useId } from 'react';
import { Switch } from 'twenty-ui/primitives/input';
import { themeCssVariables } from 'twenty-ui/theme-constants';
-const StyledContainer = styled.label`
+const StyledContainer = styled.label<{ isCompact: boolean }>`
align-items: center;
box-sizing: border-box;
cursor: pointer;
display: flex;
- height: ${themeCssVariables.spacing[5]};
- justify-content: space-between;
- padding: ${themeCssVariables.spacing[1]};
- width: 100%;
+ height: ${({ isCompact }) =>
+ isCompact
+ ? `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`
+ : themeCssVariables.spacing[5]};
+ justify-content: ${({ isCompact }) =>
+ isCompact ? 'center' : 'space-between'};
+ padding: ${({ isCompact }) =>
+ isCompact ? '0' : themeCssVariables.spacing[1]};
+ width: ${({ isCompact }) =>
+ isCompact ? `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px` : '100%'};
`;
const StyledText = styled.div`
@@ -23,6 +30,7 @@ const StyledText = styled.div`
const StyledSwitch = styled(Switch)`
${StyledContainer} & {
+ align-self: center;
color: ${themeCssVariables.color.yellow};
}
`;
@@ -32,6 +40,7 @@ type AdvancedSettingsSwitchProps = {
setIsAdvancedModeEnabled: (enabled: boolean) => void;
label?: string;
className?: string;
+ isCompact?: boolean;
};
export const AdvancedSettingsSwitch = ({
@@ -39,18 +48,28 @@ export const AdvancedSettingsSwitch = ({
setIsAdvancedModeEnabled,
label,
className,
+ isCompact = false,
}: AdvancedSettingsSwitchProps) => {
const { t } = useLingui();
const onChange = (newValue: boolean) => {
setIsAdvancedModeEnabled(newValue);
};
const instanceId = useId();
+ const labelId = `${instanceId}-text`;
+ const switchLabel = label ?? t`Advanced`;
return (
- <StyledContainer className={className} htmlFor={instanceId}>
- <StyledText>{label ?? t`Advanced`}</StyledText>
+ <StyledContainer
+ className={className}
+ htmlFor={instanceId}
+ isCompact={isCompact}
+ title={isCompact ? switchLabel : undefined}
+ >
+ {!isCompact && <StyledText id={labelId}>{switchLabel}</StyledText>}
<StyledSwitch
id={instanceId}
+ aria-label={isCompact ? switchLabel : undefined}
+ aria-labelledby={isCompact ? undefined : labelId}
onCheckedChange={onChange}
checked={isAdvancedModeEnabled}
/>
diff --git a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
index ffc22a1b93a..10ec2b777c0 100644
--- a/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/IconPicker.tsx
@@ -2,15 +2,12 @@ import { css } from '@linaria/core';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { useStore } from 'jotai';
-import React, {
- type ReactNode,
- useCallback,
- useContext,
- useMemo,
- useState,
-} from 'react';
+import React, { type ReactNode, useCallback, useMemo, useState } from 'react';
import { isDefined } from 'twenty-shared/utils';
-import { ColorSample } from 'twenty-ui/primitives/data-display';
+import {
+ ColorSample,
+ getIconTileColorShades,
+} from 'twenty-ui/primitives/data-display';
import { IconApps, type IconComponent, useIcons } from 'twenty-ui/icon';
import {
IconButton,
@@ -19,7 +16,7 @@ import {
LightIconButton,
} from 'twenty-ui/primitives/input';
import { type ThemeColor } from 'twenty-ui/theme';
-import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
+import { themeCssVariables } from 'twenty-ui/theme-constants';
import { ICON_PICKER_DROPDOWN_CONTENT_WIDTH } from '@/ui/input/components/constants/IconPickerDropdownContentWidth';
import { ThemeColorPickerMenu } from '@/ui/input/components/ThemeColorPickerMenu';
@@ -59,6 +56,7 @@ export type IconPickerProps = {
dropdownWidth?: number;
dropdownOffset?: DropdownOffset;
maxIconsVisible?: number;
+ iconColor?: ThemeColor;
iconColorPicker?: {
selectedColor: ThemeColor;
onColorChange: (color: ThemeColor) => void;
@@ -240,8 +238,6 @@ const IconPickerIcon = ({
focusedIconKey,
color,
}: IconPickerIconProps) => {
- const { theme } = useContext(ThemeContext);
-
const selectedItemId = useAtomComponentStateValue(
selectedItemIdComponentState,
iconKey,
@@ -261,7 +257,11 @@ const IconPickerIcon = ({
<Icon
// oxlint-disable-next-line react/jsx-props-no-spreading
{...iconProps}
- color={isDefined(color) ? theme.color[color] : iconProps.color}
+ color={
+ isDefined(color)
+ ? getIconTileColorShades(color).iconColor
+ : iconProps.color
+ }
/>
)}
onClick={onSelect}
@@ -287,6 +287,7 @@ export const IconPicker = ({
dropdownOffset,
maxIconsVisible,
iconColorPicker,
+ iconColor,
}: IconPickerProps) => {
const [searchString, setSearchString] = useState('');
@@ -394,16 +395,16 @@ export const IconPicker = ({
[matchingSearchIconKeys],
);
- const { theme } = useContext(ThemeContext);
-
const BaseIcon = selectedIconKey ? getIcon(selectedIconKey) : IconApps;
- const displayIcon: IconComponent = !isDefined(iconColorPicker)
+ const selectedColor = iconColorPicker?.selectedColor ?? iconColor;
+
+ const displayIcon: IconComponent = !isDefined(selectedColor)
? BaseIcon
: (iconProps) => (
<BaseIcon
className={iconProps.className}
- color={theme.color[iconColorPicker.selectedColor]}
+ color={getIconTileColorShades(selectedColor).iconColor}
size={iconProps.size}
stroke={iconProps.stroke}
style={iconProps.style}
@@ -483,7 +484,7 @@ export const IconPicker = ({
selectedIconKey={selectedIconKey}
Icon={getIcon(iconKey)}
focusedIconKey={focusedIconKey}
- color={iconColorPicker?.selectedColor}
+ color={selectedColor}
/>
))}
</StyledMenuIconItemsContainer>
diff --git a/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx b/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx
index e89174c83cd..cc0a572afac 100644
--- a/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx
+++ b/packages/twenty-front/src/modules/ui/input/components/__stories__/AdvancedSettingsSwitch.stories.tsx
@@ -46,7 +46,7 @@ type Story = StoryObj<typeof AdvancedSettingsSwitch>;
export const Default: Story = {
play: async ({ canvasElement, args }) => {
const canvas = within(canvasElement);
- const control = canvas.getByRole('switch', { name: 'Advanced' });
+ const control = await canvas.findByRole('switch', { name: 'Advanced' });
await userEvent.click(canvas.getByText('Advanced'));
await expect(control).toBeChecked();
await expect(args.setIsAdvancedModeEnabled).toHaveBeenLastCalledWith(true);
@@ -67,3 +67,17 @@ export const Dark: Story = {
),
],
};
+
+export const Compact: Story = {
+ args: { isCompact: true },
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ const control = await canvas.findByRole('switch', { name: 'Advanced' });
+
+ await expect(control).not.toBeChecked();
+ await userEvent.click(control);
+ await expect(control).toBeChecked();
+ await userEvent.keyboard(' ');
+ await expect(control).not.toBeChecked();
+ },
+};
diff --git a/packages/twenty-front/src/modules/ui/layout/constants/AppHeaderHeight.ts b/packages/twenty-front/src/modules/ui/layout/constants/AppHeaderHeight.ts
new file mode 100644
index 00000000000..dc8021e64d6
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/layout/constants/AppHeaderHeight.ts
@@ -0,0 +1 @@
+export const APP_HEADER_HEIGHT = 48;
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
index ef88e8011a1..f4e0008676b 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/DefaultLayout.tsx
@@ -63,7 +63,6 @@ const StyledMainContainer = styled.div`
display: flex;
flex: 0 1 100%;
min-width: 0;
- overflow: hidden;
@media print {
display: block;
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/MainAppLayoutWithSidePanel.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/MainAppLayoutWithSidePanel.tsx
index 0a34704dc13..842c1aea8ce 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/MainAppLayoutWithSidePanel.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/MainAppLayoutWithSidePanel.tsx
@@ -33,7 +33,6 @@ const StyledContent = styled.div`
flex: 1 1 0;
min-height: 0;
min-width: 0;
- overflow: hidden;
@media print {
display: block;
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageCardHeader.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageCardHeader.tsx
index a7b85219b08..9892b4ff924 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageCardHeader.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageCardHeader.tsx
@@ -1,5 +1,5 @@
+import { APP_HEADER_HEIGHT } from '@/ui/layout/constants/AppHeaderHeight';
import { useNavigationDrawerExpanded } from '@/navigation/hooks/useNavigationDrawerExpanded';
-import { SIDE_PANEL_TOP_BAR_HEIGHT } from '@/side-panel/constants/SidePanelTopBarHeight';
import { useWorkspaceSurface } from '@/ui/layout/hooks/useWorkspaceSurface';
import { useWorkspaceSurfaceHeaderPortal } from '@/ui/layout/hooks/useWorkspaceSurfaceHeaderPortal';
import {
@@ -37,7 +37,7 @@ const StyledHeader = styled.div<{ centerTitle?: boolean }>`
centerTitle
? 'minmax(0, 1fr) minmax(0, auto) minmax(0, 1fr)'
: 'minmax(0, auto) minmax(min-content, 1fr)'};
- min-height: ${SIDE_PANEL_TOP_BAR_HEIGHT}px;
+ min-height: ${APP_HEADER_HEIGHT}px;
padding: 0 ${themeCssVariables.spacing[3]};
width: 100%;
`;
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/PageCardLayout.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/PageCardLayout.tsx
index 50e5fe9be6b..e7eff73797f 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/PageCardLayout.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/PageCardLayout.tsx
@@ -29,32 +29,21 @@ const StyledMainCardWrapper = styled.div`
box-sizing: border-box;
display: flex;
flex: 1 1 0;
- margin-left: -3px;
min-width: 0;
- padding-left: 4px;
width: 0;
- @media (max-width: ${MOBILE_VIEWPORT}px) {
- margin-left: 0;
- padding-left: 0;
- }
-
@media print {
display: block;
- margin-left: 0;
min-width: auto;
- padding-left: 0;
width: auto;
}
`;
-// oxlint-disable-next-line twenty/no-hardcoded-colors
const StyledCard = styled.div`
background: ${themeCssVariables.background.primary};
- border-radius: ${themeCssVariables.border.radius.lg} 0 0 0;
- box-shadow:
- -4px 0 4px 0 rgba(0, 0, 0, 0.006),
- 0 0 0 1px ${themeCssVariables.border.color.medium};
+ border-left: 1px solid ${themeCssVariables.border.color.medium};
+ border-radius: 0;
+ box-shadow: ${themeCssVariables.boxShadow.sidebar};
box-sizing: border-box;
display: flex;
flex: 1;
@@ -63,23 +52,13 @@ const StyledCard = styled.div`
overflow: hidden;
width: 100%;
- .dark & {
- box-shadow:
- -4px 0 4px 0 rgba(0, 0, 0, 0.03),
- 0 0 0 1px ${themeCssVariables.border.color.medium};
- }
-
@media (max-width: ${MOBILE_VIEWPORT}px) {
- border-radius: 0;
+ border-left: none;
box-shadow: none;
-
- .dark & {
- box-shadow: none;
- }
}
@media print {
- border-radius: 0;
+ border-left: none;
box-shadow: none;
display: block;
min-height: auto;
@@ -144,12 +123,12 @@ export const PageCardLayout = ({
<StyledRoot data-page-surface="main">
<StyledMainCardWrapper>
<StyledCard>
+ <StyledPrintHidden>{header}</StyledPrintHidden>
{shouldShowInformationBanner && (
<StyledPrintHidden>
<InformationBannerWrapper />
</StyledPrintHidden>
)}
- <StyledPrintHidden>{header}</StyledPrintHidden>
<StyledPrintHidden>{secondaryBar}</StyledPrintHidden>
{body}
</StyledCard>
diff --git a/packages/twenty-front/src/modules/ui/layout/page/components/__tests__/PageCardLayout.test.tsx b/packages/twenty-front/src/modules/ui/layout/page/components/__tests__/PageCardLayout.test.tsx
index cda291fa2da..395272c183a 100644
--- a/packages/twenty-front/src/modules/ui/layout/page/components/__tests__/PageCardLayout.test.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/page/components/__tests__/PageCardLayout.test.tsx
@@ -7,7 +7,7 @@ jest.mock('@/information-banner/components/InformationBannerWrapper', () => ({
}));
describe('PageCardLayout', () => {
- it('renders the information banner before the page bars and body', () => {
+ it('renders the information banner below the header and above the secondary bar', () => {
render(
<PageCardLayout
header={<div>Page header</div>}
@@ -23,7 +23,7 @@ describe('PageCardLayout', () => {
informationBanner.compareDocumentPosition(
screen.getByText('Page header'),
),
- ).toBe(Node.DOCUMENT_POSITION_FOLLOWING);
+ ).toBe(Node.DOCUMENT_POSITION_PRECEDING);
expect(
informationBanner.compareDocumentPosition(
screen.getByText('Secondary bar'),
diff --git a/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth.ts b/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth.ts
index 59bff5e04ce..21478aaa19b 100644
--- a/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth.ts
+++ b/packages/twenty-front/src/modules/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth.ts
@@ -1 +1 @@
-export const NAVIGATION_DRAWER_COLLAPSED_WIDTH = 40;
+export const NAVIGATION_DRAWER_COLLAPSED_WIDTH = 48;
diff --git a/packages/twenty-front/src/modules/ui/layout/top-bar/components/TopBar.tsx b/packages/twenty-front/src/modules/ui/layout/top-bar/components/TopBar.tsx
index 37dc9a446ea..3c2e5949fe6 100644
--- a/packages/twenty-front/src/modules/ui/layout/top-bar/components/TopBar.tsx
+++ b/packages/twenty-front/src/modules/ui/layout/top-bar/components/TopBar.tsx
@@ -15,7 +15,7 @@ const StyledContainer = styled.div`
display: flex;
flex-direction: column;
- margin-left: ${themeCssVariables.spacing[3]};
+ margin-left: ${themeCssVariables.spacing[2]};
`;
const StyledTopBar = styled.div`
@@ -28,6 +28,7 @@ const StyledTopBar = styled.div`
font-weight: ${themeCssVariables.font.weight.medium};
height: 39px;
justify-content: space-between;
+ margin-left: ${themeCssVariables.spacing[1]};
padding-right: ${themeCssVariables.spacing[2]};
z-index: 7;
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx
index 16db5a3f6b1..a1c1d880049 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection.tsx
@@ -1,3 +1,4 @@
+import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { NavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSection';
import { NavigationDrawerSectionTitle } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle';
import { useNavigationSection } from '@/ui/navigation/navigation-drawer/hooks/useNavigationSection';
@@ -18,6 +19,8 @@ type CollapsibleNavigationDrawerSectionProps = {
label: string;
children: ReactNode;
wrapTitle?: (titleNode: ReactNode) => ReactNode;
+ rightIcon?: ReactNode;
+ alwaysShowRightIcon?: boolean;
};
export const CollapsibleNavigationDrawerSection = ({
@@ -25,13 +28,18 @@ export const CollapsibleNavigationDrawerSection = ({
label,
children,
wrapTitle,
+ rightIcon,
+ alwaysShowRightIcon,
}: CollapsibleNavigationDrawerSectionProps) => {
+ const isNavigationDrawerExpanded = useIsNavigationDrawerContentExpanded();
const { toggleNavigationSection, isNavigationSectionOpen } =
useNavigationSection(sectionId);
const titleNode = (
<NavigationDrawerSectionTitle
label={label}
+ rightIcon={rightIcon}
+ alwaysShowRightIcon={alwaysShowRightIcon}
onClick={toggleNavigationSection}
isOpen={isNavigationSectionOpen}
/>
@@ -39,9 +47,10 @@ export const CollapsibleNavigationDrawerSection = ({
return (
<NavigationDrawerSection>
- {wrapTitle ? wrapTitle(titleNode) : titleNode}
+ {isNavigationDrawerExpanded &&
+ (wrapTitle ? wrapTitle(titleNode) : titleNode)}
<AnimatedExpandableContainer
- isExpanded={isNavigationSectionOpen}
+ isExpanded={!isNavigationDrawerExpanded || isNavigationSectionOpen}
dimension="height"
mode="fit-content"
containAnimation
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles.tsx
index 4a7ab8b0904..2ee8d547a64 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/internal/MultiWorkspacesDropdownStyles.tsx
@@ -1,3 +1,4 @@
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { styled } from '@linaria/react';
import { IconChevronDown } from 'twenty-ui/icon';
import { themeCssVariables } from 'twenty-ui/theme-constants';
@@ -15,22 +16,30 @@ export const StyledContainer = styled.div<{
display: flex;
gap: ${({ isNavigationDrawerExpanded }) =>
isNavigationDrawerExpanded ? themeCssVariables.spacing[2] : '0'};
- height: ${themeCssVariables.spacing[7]};
+ height: ${({ isNavigationDrawerExpanded }) =>
+ isNavigationDrawerExpanded
+ ? themeCssVariables.spacing[7]
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
max-width: 100%;
min-width: 0;
opacity: ${({ disabled }) => (disabled ? 0.5 : 1)};
- padding: calc(${themeCssVariables.spacing[1]} - 1px);
+ padding: ${({ isNavigationDrawerExpanded }) =>
+ isNavigationDrawerExpanded
+ ? `calc(${themeCssVariables.spacing[1]} - 1px)`
+ : `calc(${themeCssVariables.spacing[2]} - 1px)`};
pointer-events: ${({ disabled }) => (disabled ? 'none' : 'auto')};
- width: fit-content;
+ width: ${({ isNavigationDrawerExpanded }) =>
+ isNavigationDrawerExpanded
+ ? 'fit-content'
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
&:hover {
background-color: ${({ disabled }) =>
disabled
? 'transparent'
: themeCssVariables.background.transparent.lighter};
- border: 1px solid
- ${({ disabled }) =>
- disabled ? 'transparent' : themeCssVariables.border.color.medium};
+ border-color: ${({ disabled }) =>
+ disabled ? 'transparent' : themeCssVariables.border.color.medium};
}
`;
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx
index 7df09c4db37..4cbf1dec240 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawer.tsx
@@ -2,7 +2,6 @@ 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';
import { NAVIGATION_DRAWER_COLLAPSED_WIDTH } from '@/ui/layout/resizable-panel/constants/NavigationDrawerCollapsedWidth';
@@ -50,24 +49,18 @@ const StyledAnimatedContainer = styled.div<{
}
`;
-// The header takes a tighter gap than the sections below it so that the mode
-// switcher row starts where the page card header ends in the next column.
const StyledContainer = styled.div<{
isExpanded?: boolean;
}>`
box-sizing: border-box;
display: flex;
flex-direction: column;
- gap: ${themeCssVariables.spacing[1]};
height: 100%;
- padding: ${themeCssVariables.spacing[1]} 0 ${themeCssVariables.spacing[4]}
- ${themeCssVariables.spacing[2]};
+ padding-bottom: ${themeCssVariables.spacing[4]};
width: ${({ isExpanded }) =>
isExpanded ? `var(${NAVIGATION_DRAWER_WIDTH_VAR})` : '100%'};
@media (max-width: ${MOBILE_VIEWPORT}px) {
width: 100%;
- padding-left: ${themeCssVariables.spacing[2]};
- padding-right: ${themeCssVariables.spacing[2]};
}
`;
@@ -75,11 +68,13 @@ const StyledContent = styled.div`
display: flex;
flex: 1;
flex-direction: column;
- gap: ${themeCssVariables.spacing[3]};
+ gap: ${themeCssVariables.spacing[2]};
min-height: 0;
+ padding-left: ${themeCssVariables.spacing[2]};
@media (max-width: ${MOBILE_VIEWPORT}px) {
gap: ${themeCssVariables.spacing[4]};
+ padding-right: ${themeCssVariables.spacing[2]};
}
`;
@@ -89,7 +84,6 @@ export const NavigationDrawer = ({
}: NavigationDrawerProps) => {
const [isResizing, setIsResizing] = useState(false);
const isMobile = useIsMobile();
- const isSettingsDrawer = useIsSettingsDrawer();
const isExpanded = useNavigationDrawerExpanded();
const [isNavigationDrawerExpanded, setIsNavigationDrawerExpanded] =
@@ -132,13 +126,11 @@ export const NavigationDrawer = ({
isResizing={isResizing}
>
<StyledContainer isExpanded={isExpanded}>
- <NavigationDrawerHeader
- showCollapseButton={isMobile || !isSettingsDrawer}
- />
+ <NavigationDrawerHeader />
<StyledContent>{children}</StyledContent>
</StyledContainer>
- {isNavigationDrawerExpanded && !isMobile && !isSettingsDrawer && (
+ {isNavigationDrawerExpanded && !isMobile && (
<ResizablePanelEdge
side="right"
constraints={NAVIGATION_DRAWER_CONSTRAINTS}
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
index b3c7ded19df..04846f026be 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper.tsx
@@ -1,4 +1,3 @@
-import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { styled } from '@linaria/react';
import {
@@ -20,27 +19,26 @@ export const NavigationDrawerAnimatedCollapseWrapper = ({
children: React.ReactNode;
}) => {
const { theme } = useContext(ThemeContext);
- const isSettingsPage = useIsSettingsPage();
const isNavigationDrawerExpanded = useIsNavigationDrawerContentExpanded();
- const shouldShowContent = isSettingsPage || isNavigationDrawerExpanded;
-
- const animate: AnimationControls | TargetAndTransition = shouldShowContent
- ? {
- opacity: 1,
- width: 'auto',
- height: 'auto',
- pointerEvents: 'auto',
- }
- : {
- opacity: 0,
- width: 0,
- height: 0,
- pointerEvents: 'none',
- };
+ const animate: AnimationControls | TargetAndTransition =
+ isNavigationDrawerExpanded
+ ? {
+ opacity: 1,
+ width: 'auto',
+ height: 'auto',
+ pointerEvents: 'auto',
+ }
+ : {
+ opacity: 0,
+ width: 0,
+ height: 0,
+ pointerEvents: 'none',
+ };
return (
<StyledAnimatedContainer
+ inert={!isNavigationDrawerExpanded || undefined}
initial={false}
animate={animate}
transition={{
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx
index 9ab70952db3..f98384d5799 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerHeader.tsx
@@ -1,3 +1,5 @@
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
+import { APP_HEADER_HEIGHT } from '@/ui/layout/constants/AppHeaderHeight';
import { styled } from '@linaria/react';
import { t } from '@lingui/core/macro';
import { IconSearch } from 'twenty-ui/icon';
@@ -5,39 +7,55 @@ import { LightIconButton } from 'twenty-ui/primitives/input';
import { MOBILE_VIEWPORT, themeCssVariables } from 'twenty-ui/theme-constants';
import { useOpenRecordsSearchPageInSidePanel } from '@/side-panel/hooks/useOpenRecordsSearchPageInSidePanel';
-import { PAGE_BAR_MIN_HEIGHT } from '@/ui/layout/page/constants/PageBarMinHeight';
import { MultiWorkspaceDropdownButton } from '@/ui/navigation/navigation-drawer/components/MultiWorkspaceDropdown/MultiWorkspaceDropdownButton';
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { NavigationDrawerCollapseButton } from './NavigationDrawerCollapseButton';
-const StyledContainer = styled.div<{ isExpanded: boolean }>`
- align-items: ${({ isExpanded }) => (isExpanded ? 'center' : 'flex-start')};
- display: flex;
- flex-direction: ${({ isExpanded }) => (isExpanded ? 'row' : 'column')};
+const StyledContainer = styled.div`
flex-shrink: 0;
- gap: ${({ isExpanded }) => (isExpanded ? '0' : themeCssVariables.spacing[4])};
- min-height: ${PAGE_BAR_MIN_HEIGHT}px;
- padding-right: ${themeCssVariables.spacing[2]};
- transition: gap calc(${themeCssVariables.animation.duration.normal} * 1s) ease;
user-select: none;
+`;
+
+const StyledHeaderRow = styled.div`
+ align-items: center;
+ border-bottom: 1px solid ${themeCssVariables.border.color.medium};
+ box-sizing: border-box;
+ display: flex;
+ height: ${APP_HEADER_HEIGHT}px;
+ padding: 0 ${themeCssVariables.spacing[2]};
@media (max-width: ${MOBILE_VIEWPORT}px) {
- padding-left: ${themeCssVariables.spacing[5]};
- padding-right: ${themeCssVariables.spacing[5]};
+ padding: 0 ${themeCssVariables.spacing[7]};
+ }
+`;
+
+const StyledCollapsedSearch = styled.div`
+ padding: ${themeCssVariables.spacing[3]} ${themeCssVariables.spacing[2]}
+ ${themeCssVariables.spacing[1]};
+`;
+
+const StyledSearchButtonContainer = styled.div<{ isExpanded: boolean }>`
+ display: flex;
+
+ > button {
+ height: ${({ isExpanded }) =>
+ isExpanded
+ ? themeCssVariables.spacing[6]
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
+ width: ${({ isExpanded }) =>
+ isExpanded
+ ? themeCssVariables.spacing[6]
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
}
`;
-const StyledRightActions = styled.div<{ isExpanded: boolean }>`
+const StyledRightActions = styled.div`
align-items: center;
- align-self: ${({ isExpanded }) => (isExpanded ? 'auto' : 'flex-end')};
display: flex;
- flex-direction: ${({ isExpanded }) => (isExpanded ? 'row' : 'column')};
flex-shrink: 0;
- gap: ${({ isExpanded }) =>
- isExpanded ? '2px' : themeCssVariables.spacing[1]};
- margin-left: ${({ isExpanded }) => (isExpanded ? 'auto' : '0')};
- transition: gap calc(${themeCssVariables.animation.duration.normal} * 1s) ease;
+ gap: ${themeCssVariables.spacing['0.5']};
+ margin-left: auto;
`;
const StyledNavigationDrawerCollapseButtonContainer = styled.div`
@@ -49,53 +67,54 @@ const StyledNavigationDrawerCollapseButtonContainer = styled.div`
@media (max-width: ${MOBILE_VIEWPORT}px) {
> * {
- height: ${themeCssVariables.spacing[8]};
+ height: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
padding-right: 0;
- width: ${themeCssVariables.spacing[8]};
+ width: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
}
}
`;
const StyledWorkspaceDropdownContainer = styled.div`
- align-items: center;
display: flex;
flex: 1 1 auto;
- min-height: ${themeCssVariables.spacing[8]};
min-width: 0;
`;
-type NavigationDrawerHeaderProps = {
- showCollapseButton: boolean;
-};
-
-export const NavigationDrawerHeader = ({
- showCollapseButton,
-}: NavigationDrawerHeaderProps) => {
+export const NavigationDrawerHeader = () => {
const isMobile = useIsMobile();
const { openRecordsSearchPage } = useOpenRecordsSearchPageInSidePanel();
const isExpanded = useIsNavigationDrawerContentExpanded();
+ const searchButton = !isMobile && (
+ <StyledSearchButtonContainer isExpanded={isExpanded}>
+ <LightIconButton
+ Icon={IconSearch}
+ accent="secondary"
+ size="small"
+ onClick={openRecordsSearchPage}
+ aria-label={t`Search`}
+ />
+ </StyledSearchButtonContainer>
+ );
+
return (
- <StyledContainer isExpanded={isExpanded}>
- <StyledWorkspaceDropdownContainer>
- <MultiWorkspaceDropdownButton />
- </StyledWorkspaceDropdownContainer>
- <StyledRightActions isExpanded={isExpanded}>
- {!isMobile && (
- <LightIconButton
- Icon={IconSearch}
- accent="secondary"
- size="small"
- onClick={openRecordsSearchPage}
- aria-label={t`Search`}
- />
- )}
- {isExpanded && showCollapseButton && (
- <StyledNavigationDrawerCollapseButtonContainer>
- <NavigationDrawerCollapseButton direction="left" />
- </StyledNavigationDrawerCollapseButtonContainer>
+ <StyledContainer>
+ <StyledHeaderRow>
+ <StyledWorkspaceDropdownContainer>
+ <MultiWorkspaceDropdownButton />
+ </StyledWorkspaceDropdownContainer>
+ {isExpanded && (
+ <StyledRightActions>
+ {searchButton}
+ <StyledNavigationDrawerCollapseButtonContainer>
+ <NavigationDrawerCollapseButton direction="left" />
+ </StyledNavigationDrawerCollapseButtonContainer>
+ </StyledRightActions>
)}
- </StyledRightActions>
+ </StyledHeaderRow>
+ {!isExpanded && !isMobile && (
+ <StyledCollapsedSearch>{searchButton}</StyledCollapsedSearch>
+ )}
</StyledContainer>
);
};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
index 57e008de9cf..2d35db38958 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItem.tsx
@@ -1,5 +1,5 @@
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
-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';
import { useNavigationDrawerTooltip } from '@/ui/navigation/navigation-drawer/hooks/useNavigationDrawerTooltip';
@@ -107,14 +107,20 @@ const StyledItem = styled.button<StyledItemProps>`
display: flex;
font-family: ${themeCssVariables.font.family};
font-size: ${themeCssVariables.font.size.md};
- height: ${themeCssVariables.spacing[7]};
+ height: ${({ isNavigationDrawerExpanded }) =>
+ isNavigationDrawerExpanded
+ ? themeCssVariables.spacing[7]
+ : `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`};
margin-top: ${({ indentationLevel }) =>
indentationLevel === 2 ? '2px' : '0'};
min-width: 0;
padding-bottom: ${themeCssVariables.spacing[1]};
- padding-left: ${themeCssVariables.spacing[1]};
- padding-right: ${({ hasRightOptions }) =>
- hasRightOptions
+ padding-left: ${({ isNavigationDrawerExpanded }) =>
+ isNavigationDrawerExpanded
+ ? themeCssVariables.spacing[1]
+ : `calc(${themeCssVariables.spacing[2]} - 1px)`};
+ padding-right: ${({ hasRightOptions, isNavigationDrawerExpanded }) =>
+ hasRightOptions && isNavigationDrawerExpanded
? themeCssVariables.spacing['0.5']
: themeCssVariables.spacing[1]};
padding-top: ${themeCssVariables.spacing[1]};
@@ -123,7 +129,7 @@ const StyledItem = styled.button<StyledItemProps>`
user-select: none;
width: ${({ isNavigationDrawerExpanded, hasRightOptions }) =>
!isNavigationDrawerExpanded
- ? `calc(${NAVIGATION_DRAWER_COLLAPSED_WIDTH}px - ${themeCssVariables.spacing[6]} + ${themeCssVariables.spacing[1]} + ${hasRightOptions ? themeCssVariables.spacing['0.5'] : themeCssVariables.spacing[1]})`
+ ? `${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px`
: `calc(100% - ${themeCssVariables.spacing['1.5']} + ${themeCssVariables.spacing[1]} + ${hasRightOptions ? themeCssVariables.spacing['0.5'] : themeCssVariables.spacing[1]})`};
&:hover {
@@ -139,7 +145,7 @@ const StyledItem = styled.button<StyledItemProps>`
}
@media (max-width: ${MOBILE_VIEWPORT}px) {
- height: ${themeCssVariables.spacing[8]};
+ height: ${NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE}px;
}
`;
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
index 7a7e5fbc6cc..6fda238f3ae 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemBreadcrumb.tsx
@@ -7,10 +7,11 @@ export type NavigationDrawerItemBreadcrumbProps = {
};
const StyledNavigationDrawerItemBreadcrumbContainer = styled.div`
- height: 28px;
+ height: ${themeCssVariables.spacing[7]};
margin-inline-end: ${themeCssVariables.spacing[2]};
margin-inline-start: 7.5px;
+ position: relative;
width: 9px;
[data-dnd-dragging] & {
@@ -29,7 +30,7 @@ const StyledGapVerticalLine = styled.div<{ darker: boolean }>`
: themeCssVariables.border.color.strong};
height: 2px;
- position: relative;
+ position: absolute;
top: -2px;
width: 1px;
@@ -41,14 +42,10 @@ const StyledSecondaryFullVerticalBar = styled.div<{ darker: boolean }>`
? themeCssVariables.font.color.tertiary
: themeCssVariables.border.color.strong};
- height: calc(${themeCssVariables.spacing[7]} + 1px);
- position: relative;
- top: -17px;
+ height: 100%;
+ position: absolute;
+ top: 0;
width: 1px;
-
- @media (max-width: ${MOBILE_VIEWPORT}px) {
- height: calc(${themeCssVariables.spacing[8]} + 1px);
- }
`;
const StyledRoundedProtrusion = styled.div<{ darker: boolean }>`
@@ -67,8 +64,8 @@ const StyledRoundedProtrusion = styled.div<{ darker: boolean }>`
height: 14px;
- position: relative;
- top: -2px;
+ position: absolute;
+ top: 0;
width: 8px;
z-index: ${({ darker }) => (darker ? '1' : 'auto')};
`;
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
index e86cdc2d476..8ea69a4aab4 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerItemsCollapsableContainer.tsx
@@ -1,4 +1,4 @@
-import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
+import { NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE } from '@/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize';
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { styled } from '@linaria/react';
import { type ReactNode, useContext } from 'react';
@@ -9,8 +9,6 @@ import {
} from 'framer-motion';
import { ThemeContext, themeCssVariables } from 'twenty-ui/theme-constants';
-const COLLAPSED_GROUP_WIDTH = 24;
-
const StyledAnimationGroupContainerBase = styled.div<{
isCollapsedGroup: boolean;
}>`
@@ -42,13 +40,11 @@ export const NavigationDrawerItemsCollapsableContainer = ({
children,
}: NavigationDrawerItemsCollapsableContainerProps) => {
const { theme } = useContext(ThemeContext);
- const isSettingsPage = useIsSettingsPage();
- const isNavigationDrawerExpanded = useIsNavigationDrawerContentExpanded();
- const isExpanded = isNavigationDrawerExpanded || isSettingsPage;
+ const isExpanded = useIsNavigationDrawerContentExpanded();
const animate: AnimationControls | TargetAndTransition = isExpanded
? { width: 'auto' }
- : { width: COLLAPSED_GROUP_WIDTH };
+ : { width: NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE };
return (
<StyledAnimationGroupContainer
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSection.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSection.tsx
index 448a127b587..af02e0c7962 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSection.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSection.tsx
@@ -1,4 +1,3 @@
-import { useIsSettingsDrawer } from '@/navigation/hooks/useIsSettingsDrawer';
import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
import { styled } from '@linaria/react';
@@ -11,13 +10,13 @@ const StyledSection = styled.div`
const StyledSectionInnerContainerMinusScrollPadding = styled.div<{
isMobile: boolean;
- isMainNavCollapsed: boolean;
+ isCollapsed: boolean;
}>`
display: flex;
flex-direction: column;
gap: ${themeCssVariables.betweenSiblingsGap};
- width: ${({ isMobile, isMainNavCollapsed }) =>
- isMobile || isMainNavCollapsed
+ width: ${({ isMobile, isCollapsed }) =>
+ isMobile || isCollapsed
? '100%'
: `calc(100% - ${themeCssVariables.spacing[2]})`};
`;
@@ -30,18 +29,16 @@ export const NavigationDrawerSection = ({
className?: string;
}) => {
const isMobile = useIsMobile();
- const isSettingsDrawer = useIsSettingsDrawer();
const isNavigationDrawerExpanded = useAtomStateValue(
isNavigationDrawerExpandedState,
);
- const isMainNavCollapsed =
- !isSettingsDrawer && !isMobile && !isNavigationDrawerExpanded;
+ const isCollapsed = !isMobile && !isNavigationDrawerExpanded;
return (
<StyledSection className={className}>
<StyledSectionInnerContainerMinusScrollPadding
isMobile={isMobile}
- isMainNavCollapsed={isMainNavCollapsed}
+ isCollapsed={isCollapsed}
>
{children}
</StyledSectionInnerContainerMinusScrollPadding>
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
index a18b6cefd07..18ed0b8e4ab 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/NavigationDrawerSectionTitle.tsx
@@ -1,4 +1,3 @@
-import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';
import { styled } from '@linaria/react';
@@ -83,10 +82,9 @@ export const NavigationDrawerSectionTitle = ({
const { theme } = useContext(ThemeContext);
const isMobile = useIsMobile();
const isNavigationDrawerExpanded = useIsNavigationDrawerContentExpanded();
- const isSettingsPage = useIsSettingsPage();
const handleTitleClick = (e: React.MouseEvent<HTMLDivElement>) => {
e.stopPropagation();
- if (isDefined(onClick) && (isNavigationDrawerExpanded || isSettingsPage)) {
+ if (isDefined(onClick) && isNavigationDrawerExpanded) {
onClick();
}
};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/CollapsibleNavigationDrawerSection.stories.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/CollapsibleNavigationDrawerSection.stories.tsx
new file mode 100644
index 00000000000..ca08e585a67
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__stories__/CollapsibleNavigationDrawerSection.stories.tsx
@@ -0,0 +1,86 @@
+import { type Meta, type StoryObj } from '@storybook/react-vite';
+import { createStore, Provider } from 'jotai';
+import { useState } from 'react';
+import { expect, userEvent, waitFor, within } from 'storybook/test';
+import { ComponentDecorator } from 'twenty-ui/testing';
+
+import { CollapsibleNavigationDrawerSection } from '@/ui/navigation/navigation-drawer/components/CollapsibleNavigationDrawerSection';
+import { isNavigationSectionOpenFamilyState } from '@/ui/navigation/navigation-drawer/states/isNavigationSectionOpenFamilyState';
+import { isNavigationDrawerExpandedState } from '@/ui/navigation/states/isNavigationDrawerExpanded';
+import { useAtomState } from '@/ui/utilities/state/jotai/hooks/useAtomState';
+
+const SECTION_ID = 'stories/settings/User';
+
+const SidebarControls = () => {
+ const [isExpanded, setIsExpanded] = useAtomState(
+ isNavigationDrawerExpandedState,
+ );
+
+ return (
+ <button onClick={() => setIsExpanded(!isExpanded)}>
+ {isExpanded ? 'Collapse sidebar' : 'Expand sidebar'}
+ </button>
+ );
+};
+
+const SectionWithSidebarControls = () => {
+ const [store] = useState(() => {
+ const initialStore = createStore();
+ initialStore.set(isNavigationDrawerExpandedState.atom, true);
+ initialStore.set(
+ isNavigationSectionOpenFamilyState.atomFamily(SECTION_ID),
+ true,
+ );
+ return initialStore;
+ });
+
+ return (
+ <Provider store={store}>
+ <SidebarControls />
+ <CollapsibleNavigationDrawerSection sectionId={SECTION_ID} label="User">
+ <a href="/settings/profile">Profile</a>
+ </CollapsibleNavigationDrawerSection>
+ </Provider>
+ );
+};
+
+const meta: Meta<typeof CollapsibleNavigationDrawerSection> = {
+ title: 'UI/Navigation/NavigationDrawer/CollapsibleNavigationDrawerSection',
+ component: CollapsibleNavigationDrawerSection,
+ decorators: [ComponentDecorator],
+ parameters: { container: { width: 240 } },
+ render: () => <SectionWithSidebarControls />,
+};
+
+export default meta;
+type Story = StoryObj<typeof CollapsibleNavigationDrawerSection>;
+
+export const PreservesSectionState: Story = {
+ play: async ({ canvasElement }) => {
+ const canvas = within(canvasElement);
+ await userEvent.click(await canvas.findByText('User'));
+ await waitFor(() =>
+ expect(
+ canvas.queryByRole('link', { name: 'Profile' }),
+ ).not.toBeInTheDocument(),
+ );
+
+ await userEvent.click(
+ await canvas.findByRole('button', { name: 'Collapse sidebar' }),
+ );
+ await expect(
+ await canvas.findByRole('link', { name: 'Profile' }),
+ ).toBeVisible();
+ await expect(canvas.queryByText('User')).not.toBeInTheDocument();
+
+ await userEvent.click(
+ await canvas.findByRole('button', { name: 'Expand sidebar' }),
+ );
+ await expect(await canvas.findByText('User')).toBeVisible();
+ await waitFor(() =>
+ expect(
+ canvas.queryByRole('link', { name: 'Profile' }),
+ ).not.toBeInTheDocument(),
+ );
+ },
+};
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__tests__/NavigationDrawerAnimatedCollapseWrapper.test.tsx b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__tests__/NavigationDrawerAnimatedCollapseWrapper.test.tsx
index cd055cd579b..edf33f5af7f 100644
--- a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__tests__/NavigationDrawerAnimatedCollapseWrapper.test.tsx
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/components/__tests__/NavigationDrawerAnimatedCollapseWrapper.test.tsx
@@ -1,10 +1,8 @@
import { useIsNavigationDrawerContentExpanded } from '@/navigation/hooks/useIsNavigationDrawerContentExpanded';
-import { useIsSettingsPage } from '@/navigation/hooks/useIsSettingsPage';
import { NavigationDrawerAnimatedCollapseWrapper } from '@/ui/navigation/navigation-drawer/components/NavigationDrawerAnimatedCollapseWrapper';
import { render, screen, waitFor } from '@testing-library/react';
jest.mock('@/navigation/hooks/useIsNavigationDrawerContentExpanded');
-jest.mock('@/navigation/hooks/useIsSettingsPage');
const NavigationModes = () => (
<NavigationDrawerAnimatedCollapseWrapper>
@@ -14,18 +12,17 @@ const NavigationModes = () => (
describe('NavigationDrawerAnimatedCollapseWrapper', () => {
beforeEach(() => {
- jest.mocked(useIsNavigationDrawerContentExpanded).mockReturnValue(false);
- jest.mocked(useIsSettingsPage).mockReturnValue(true);
+ jest.mocked(useIsNavigationDrawerContentExpanded).mockReturnValue(true);
});
- it('keeps its children mounted while collapsing and expanding around settings', async () => {
+ it('keeps its children mounted while collapsing and expanding the drawer', async () => {
const { rerender } = render(<NavigationModes />);
const navigationModesButton = screen.getByRole('button', {
name: 'Navigation modes',
});
const animatedContainer = navigationModesButton.parentElement;
- jest.mocked(useIsSettingsPage).mockReturnValue(false);
+ jest.mocked(useIsNavigationDrawerContentExpanded).mockReturnValue(false);
rerender(<NavigationModes />);
await waitFor(() => {
@@ -40,7 +37,7 @@ describe('NavigationDrawerAnimatedCollapseWrapper', () => {
navigationModesButton,
);
- jest.mocked(useIsSettingsPage).mockReturnValue(true);
+ jest.mocked(useIsNavigationDrawerContentExpanded).mockReturnValue(true);
rerender(<NavigationModes />);
await waitFor(() => {
diff --git a/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize.ts b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize.ts
new file mode 100644
index 00000000000..c57c9516274
--- /dev/null
+++ b/packages/twenty-front/src/modules/ui/navigation/navigation-drawer/constants/NavigationDrawerCollapsedButtonSize.ts
@@ -0,0 +1 @@
+export const NAVIGATION_DRAWER_COLLAPSED_BUTTON_SIZE = 32;
diff --git a/packages/twenty-front/src/pages/ai-chat/AiChatPage.tsx b/packages/twenty-front/src/pages/ai-chat/AiChatPage.tsx
index 13e317058ef..7feee068bf1 100644
--- a/packages/twenty-front/src/pages/ai-chat/AiChatPage.tsx
+++ b/packages/twenty-front/src/pages/ai-chat/AiChatPage.tsx
@@ -9,13 +9,10 @@ import { AiChatTab } from '@/ai/components/AiChatTab';
import { AI_CHAT_SURFACE } from '@/ai/constants/AiChatSurface';
import { AiChatSurfaceContext } from '@/ai/contexts/AiChatSurfaceContext';
-const PANEL_CORNER_RADIUS_DERIVED_FROM_THEME_SCALE = `calc(${themeCssVariables.border.radius.md} + ${themeCssVariables.spacing[1]})`;
-
const StyledPanel = styled.div`
background: ${themeCssVariables.background.primary};
border-left: 1px solid ${themeCssVariables.border.color.medium};
- border-radius: ${PANEL_CORNER_RADIUS_DERIVED_FROM_THEME_SCALE} 0 0
- ${PANEL_CORNER_RADIUS_DERIVED_FROM_THEME_SCALE};
+ border-radius: 0;
display: flex;
flex: 1;
flex-direction: column;
diff --git a/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx b/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx
index c599d63131c..d8b49370cf6 100644
--- a/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx
+++ b/packages/twenty-front/src/pages/settings/general/SettingsGeneral.tsx
@@ -13,7 +13,7 @@ import { SettingsSecuritySettings } from '@/settings/security/components/Setting
import { NameField } from '@/settings/workspace/components/NameField';
import { WorkspaceLogoUploader } from '@/settings/workspace/components/WorkspaceLogoUploader';
import { useAtomStateValue } from '@/ui/utilities/state/jotai/hooks/useAtomStateValue';
-import { IconHistory, IconKey, IconSettings } from 'twenty-ui/icon';
+import { IconHistory, IconKey, IconSettings2 } from 'twenty-ui/icon';
import { H2Title } from 'twenty-ui/primitives/typography';
import { Section } from 'twenty-ui/primitives/layout';
import { PermissionFlagType } from '~/generated-metadata/graphql';
@@ -36,7 +36,11 @@ export const SettingsGeneral = () => {
);
const tabs = [
- { id: GENERAL_TAB_GENERAL, title: t`General`, Icon: IconSettings },
+ {
+ id: GENERAL_TAB_GENERAL,
+ title: t`General`,
+ Icon: IconSettings2,
+ },
...(hasSecurityPermission
? [
{ id: GENERAL_TAB_SECURITY, title: t`Security`, Icon: IconKey },
diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/employment-history-custom-object-seed.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/employment-history-custom-object-seed.constant.ts
index 4c0457ee6c0..8edad3b08a7 100644
--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/employment-history-custom-object-seed.constant.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/employment-history-custom-object-seed.constant.ts
@@ -5,6 +5,7 @@ export const EMPLOYMENT_HISTORY_CUSTOM_OBJECT_SEED: ObjectMetadataSeed = {
labelSingular: 'Employment History',
namePlural: 'employmentHistories',
nameSingular: 'employmentHistory',
+ color: 'gray',
icon: 'IconBriefcase',
skipNameField: true,
};
diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-care-agreement-custom-object-seed.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-care-agreement-custom-object-seed.constant.ts
index 4db02f82dde..edc5ffb5323 100644
--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-care-agreement-custom-object-seed.constant.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-care-agreement-custom-object-seed.constant.ts
@@ -5,6 +5,7 @@ export const PET_CARE_AGREEMENT_CUSTOM_OBJECT_SEED: ObjectMetadataSeed = {
labelSingular: 'Pet Care Agreement',
namePlural: 'petCareAgreements',
nameSingular: 'petCareAgreement',
+ color: 'gray',
icon: 'IconPaw',
skipNameField: true,
};
diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-custom-object-seed.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-custom-object-seed.constant.ts
index c2698a1610b..f619b2c62fc 100644
--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-custom-object-seed.constant.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/pet-custom-object-seed.constant.ts
@@ -5,5 +5,6 @@ export const PET_CUSTOM_OBJECT_SEED: ObjectMetadataSeed = {
labelSingular: 'Pet',
namePlural: 'pets',
nameSingular: 'pet',
+ color: 'gray',
icon: 'IconCat',
};
diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/rocket-custom-object-seed.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/rocket-custom-object-seed.constant.ts
index 0ad9392dc51..5723304abd7 100644
--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/rocket-custom-object-seed.constant.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/rocket-custom-object-seed.constant.ts
@@ -5,6 +5,7 @@ export const ROCKET_CUSTOM_OBJECT_SEED: ObjectMetadataSeed = {
labelSingular: 'Rocket',
namePlural: 'rockets',
nameSingular: 'rocket',
+ color: 'gray',
icon: 'IconRocket',
description: 'A rocket',
isRemote: false,
diff --git a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/survey-results-object-seed.constant.ts b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/survey-results-object-seed.constant.ts
index 879587acfe6..a5d547af22d 100644
--- a/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/survey-results-object-seed.constant.ts
+++ b/packages/twenty-server/src/engine/workspace-manager/dev-seeder/metadata/custom-objects/constants/survey-results-object-seed.constant.ts
@@ -5,5 +5,6 @@ export const SURVEY_RESULT_CUSTOM_OBJECT_SEED: ObjectMetadataSeed = {
labelSingular: 'Survey result',
namePlural: 'surveyResults',
nameSingular: 'surveyResult',
+ color: 'gray',
icon: 'IconRulerMeasure',
};
diff --git a/packages/twenty-ui/design-tokens/boxShadow.ts b/packages/twenty-ui/design-tokens/boxShadow.ts
index 3e13e932bf8..a8f4e7544e7 100644
--- a/packages/twenty-ui/design-tokens/boxShadow.ts
+++ b/packages/twenty-ui/design-tokens/boxShadow.ts
@@ -10,6 +10,10 @@ export const BOX_SHADOW_TOKENS = {
'0px 2px 4px 0px color(display-p3 0 0 0 / 0.039), 0px 0px 4px 0px color(display-p3 0 0 0 / 0.078)',
dark: '0px 2px 4px 0px rgba(0, 0, 0, 0.04), 0px 0px 4px 0px rgba(0, 0, 0, 0.08)',
}),
+ sidebar: token({
+ light: '-4px 4px 4px 0px rgba(0, 0, 0, 0.005)',
+ dark: '-4px 4px 4px 0px rgba(0, 0, 0, 0.03)',
+ }),
strong: token({
light:
'2px 4px 16px 0px color(display-p3 0 0 0 / 0.161), 0px 2px 4px 0px color(display-p3 0 0 0 / 0.078)',
diff --git a/packages/twenty-ui/generated/tokens.docs.json b/packages/twenty-ui/generated/tokens.docs.json
index 0cdb2094f89..979acd9f012 100644
--- a/packages/twenty-ui/generated/tokens.docs.json
+++ b/packages/twenty-ui/generated/tokens.docs.json
@@ -496,6 +496,13 @@
"dark": "0px 2px 4px 0px rgba(0, 0, 0, 0.04), 0px 0px 4px 0px rgba(0, 0, 0, 0.08)",
"isNumber": false
},
+ {
+ "path": "boxShadow.sidebar",
+ "cssVariable": "--t-box-shadow-sidebar",
+ "light": "-4px 4px 4px 0px rgba(0, 0, 0, 0.005)",
+ "dark": "-4px 4px 4px 0px rgba(0, 0, 0, 0.03)",
+ "isNumber": false
+ },
{
"path": "boxShadow.strong",
"cssVariable": "--t-box-shadow-strong",
diff --git a/packages/twenty-ui/src/primitives/data-display/TintedIconTile/TintedIconTile.tsx b/packages/twenty-ui/src/primitives/data-display/TintedIconTile/TintedIconTile.tsx
index 90486a817fa..66bbc3a6d83 100644
--- a/packages/twenty-ui/src/primitives/data-display/TintedIconTile/TintedIconTile.tsx
+++ b/packages/twenty-ui/src/primitives/data-display/TintedIconTile/TintedIconTile.tsx
@@ -29,7 +29,6 @@ export const TintedIconTile = ({
return (
<StyledTintedIconTileContainer
$backgroundColor={style.backgroundColor}
- $borderColor={style.borderColor}
$dimension={tileDimension}
>
<Icon size={iconSize} stroke={iconStroke} color={style.iconColor} />
diff --git a/packages/twenty-ui/src/primitives/data-display/TintedIconTile/internal/constants/tintedIconTileColorShades.constant.ts b/packages/twenty-ui/src/primitives/data-display/TintedIconTile/internal/constants/tintedIconTileColorShades.constant.ts
index 3d2f44f3a6f..e115f263c55 100644
--- a/packages/twenty-ui/src/primitives/data-display/TintedIconTile/internal/constants/tintedIconTileColorShades.constant.ts
+++ b/packages/twenty-ui/src/primitives/data-display/TintedIconTile/internal/constants/tintedIconTileColorShades.constant.ts
@@ -1,5 +1,5 @@
export const TINTED_ICON_TILE_COLOR_SHADES = {
- background: 5,
+ background: 4,
border: 6,
- icon: 11,
+ icon: 10,
} as const;
diff --git a/packages/twenty-ui/src/theme-constants/theme-dark.css b/packages/twenty-ui/src/theme-constants/theme-dark.css
index e1cdd253995..e4711f9d09f 100644
--- a/packages/twenty-ui/src/theme-constants/theme-dark.css
+++ b/packages/twenty-ui/src/theme-constants/theme-dark.css
@@ -149,6 +149,7 @@
--t-box-shadow-color: rgba(0, 0, 0, 0.6);
--t-box-shadow-light:
0px 2px 4px 0px rgba(0, 0, 0, 0.04), 0px 0px 4px 0px rgba(0, 0, 0, 0.08);
+ --t-box-shadow-sidebar: -4px 4px 4px 0px rgba(0, 0, 0, 0.03);
--t-box-shadow-strong:
2px 4px 16px 0px rgba(0, 0, 0, 0.16), 0px 2px 4px 0px rgba(0, 0, 0, 0.08);
--t-box-shadow-underline: 0px 1px 0px 0px rgba(0, 0, 0, 0.32);
diff --git a/packages/twenty-ui/src/theme-constants/theme-light.css b/packages/twenty-ui/src/theme-constants/theme-light.css
index c903b110e67..7729288abbb 100644
--- a/packages/twenty-ui/src/theme-constants/theme-light.css
+++ b/packages/twenty-ui/src/theme-constants/theme-light.css
@@ -150,6 +150,7 @@
--t-box-shadow-light:
0px 2px 4px 0px color(display-p3 0 0 0 / 0.039),
0px 0px 4px 0px color(display-p3 0 0 0 / 0.078);
+ --t-box-shadow-sidebar: -4px 4px 4px 0px rgba(0, 0, 0, 0.005);
--t-box-shadow-strong:
2px 4px 16px 0px color(display-p3 0 0 0 / 0.161),
0px 2px 4px 0px color(display-p3 0 0 0 / 0.078);
diff --git a/packages/twenty-ui/src/theme-constants/themeCssVariables.ts b/packages/twenty-ui/src/theme-constants/themeCssVariables.ts
index 3326aac3ec4..2608bdb0e4d 100644
--- a/packages/twenty-ui/src/theme-constants/themeCssVariables.ts
+++ b/packages/twenty-ui/src/theme-constants/themeCssVariables.ts
@@ -191,6 +191,7 @@ export const themeCssVariables = {
boxShadow: {
color: 'var(--t-box-shadow-color)',
light: 'var(--t-box-shadow-light)',
+ sidebar: 'var(--t-box-shadow-sidebar)',
strong: 'var(--t-box-shadow-strong)',
underline: 'var(--t-box-shadow-underline)',
superHeavy: 'var(--t-box-shadow-super-heavy)',
diff --git a/packages/twenty-ui/src/theme-constants/themeTypes.ts b/packages/twenty-ui/src/theme-constants/themeTypes.ts
index e73fe154a89..bf0351648d4 100644
--- a/packages/twenty-ui/src/theme-constants/themeTypes.ts
+++ b/packages/twenty-ui/src/theme-constants/themeTypes.ts
@@ -190,6 +190,7 @@ export type ThemeType = {
boxShadow: {
color: string;
light: string;
+ sidebar: string;
strong: string;
underline: string;
superHeavy: string;
diff --git a/packages/twenty-ui/src/theme/constants/ThemeDark.ts b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
index 3c4c2872884..1c7b4707456 100644
--- a/packages/twenty-ui/src/theme/constants/ThemeDark.ts
+++ b/packages/twenty-ui/src/theme/constants/ThemeDark.ts
@@ -160,6 +160,7 @@ export const THEME_DARK: typeof THEME_LIGHT = {
color: 'rgba(0, 0, 0, 0.6)',
light:
'0px 2px 4px 0px rgba(0, 0, 0, 0.04), 0px 0px 4px 0px rgba(0, 0, 0, 0.08)',
+ sidebar: '-4px 4px 4px 0px rgba(0, 0, 0, 0.03)',
strong:
'2px 4px 16px 0px rgba(0, 0, 0, 0.16), 0px 2px 4px 0px rgba(0, 0, 0, 0.08)',
underline: '0px 1px 0px 0px rgba(0, 0, 0, 0.32)',
diff --git a/packages/twenty-ui/src/theme/constants/ThemeLight.ts b/packages/twenty-ui/src/theme/constants/ThemeLight.ts
index 9370ee3f00a..01bc755c785 100644
--- a/packages/twenty-ui/src/theme/constants/ThemeLight.ts
+++ b/packages/twenty-ui/src/theme/constants/ThemeLight.ts
@@ -159,6 +159,7 @@ export const THEME_LIGHT = {
color: 'color(display-p3 0 0 0 / 0.039)',
light:
'0px 2px 4px 0px color(display-p3 0 0 0 / 0.039), 0px 0px 4px 0px color(display-p3 0 0 0 / 0.078)',
+ sidebar: '-4px 4px 4px 0px rgba(0, 0, 0, 0.005)',
strong:
'2px 4px 16px 0px color(display-p3 0 0 0 / 0.161), 0px 2px 4px 0px color(display-p3 0 0 0 / 0.078)',
underline: '0px 1px 0px 0px color(display-p3 0 0 0 / 0.361)',