fix(twenty-front): restore the pinned create button and scope the primary to one action

- The header's right group now grows instead of sizing to content, so the
  pinned-buttons inline layout keeps its width and New Company no longer
  collapses into a hidden overflow.
- Only the leading pinned action renders as primary, threaded through an
  isPrimaryAction prop and applied to both the text and icon button paths,
  instead of hardcoding every pinned button to primary.
This commit is contained in:
Félix Malfait
2026-06-07 15:32:19 +02:00
parent 83162b1b80
commit dae999ca8d
4 changed files with 23 additions and 9 deletions
@@ -31,12 +31,14 @@ const StyledPreviewWrapper = styled.div`
type CommandMenuItemRendererProps = {
item: CommandMenuItemFieldsFragment;
isPrimaryAction?: boolean;
};
type CommandMenuItemButtonRendererProps = CommandMenuItemRendererProps;
const CommandMenuItemButtonRenderer = ({
item,
isPrimaryAction = false,
}: CommandMenuItemButtonRendererProps) => {
const { commandMenuContextApi, isInPreviewMode } =
useContext(CommandMenuContext);
@@ -60,7 +62,10 @@ const CommandMenuItemButtonRenderer = ({
if (isInPreviewMode) {
return (
<StyledPreviewWrapper>
<CommandMenuButton command={command} isPrimaryAction />
<CommandMenuButton
command={command}
isPrimaryAction={isPrimaryAction}
/>
</StyledPreviewWrapper>
);
}
@@ -70,7 +75,7 @@ const CommandMenuItemButtonRenderer = ({
command={command}
onClick={disabled ? undefined : handleClick}
disabled={disabled}
isPrimaryAction
isPrimaryAction={isPrimaryAction}
/>
);
};
@@ -168,11 +173,17 @@ const CommandMenuItemSelectableRenderer = ({
// oxlint-disable-next-line twenty/effect-components
export const CommandMenuItemRenderer = ({
item,
isPrimaryAction,
}: CommandMenuItemRendererProps) => {
const { displayType } = useContext(CommandMenuContext);
if (displayType === 'button') {
return <CommandMenuItemButtonRenderer item={item} />;
return (
<CommandMenuItemButtonRenderer
item={item}
isPrimaryAction={isPrimaryAction}
/>
);
}
if (displayType === 'listItem' || displayType === 'dropdownItem') {
@@ -68,7 +68,7 @@ export const PinnedCommandMenuItemButtons = () => {
<NodeDimension onDimensionChange={onContainerDimensionChange}>
<StyledContainer>
<StyledItemsContainer>
{pinnedInlineCommandMenuItems.map((item) => (
{pinnedInlineCommandMenuItems.map((item, index) => (
<StyledCommandMenuItemContainer
key={item.id}
layout
@@ -80,7 +80,10 @@ export const PinnedCommandMenuItemButtons = () => {
ease: 'easeInOut',
}}
>
<CommandMenuItemRenderer item={item} />
<CommandMenuItemRenderer
item={item}
isPrimaryAction={index === 0}
/>
</StyledCommandMenuItemContainer>
))}
</StyledItemsContainer>
@@ -65,8 +65,8 @@ export const CommandMenuButton = ({
<IconButton
Icon={command.Icon}
size="small"
variant="secondary"
accent={buttonAccent}
variant={isPrimaryAction ? 'primary' : 'secondary'}
accent={isPrimaryAction ? 'blue' : buttonAccent}
to={to}
onClick={onClick}
disabled={disabled}
@@ -27,7 +27,6 @@ const StyledHeader = styled.div`
box-sizing: border-box;
display: flex;
gap: ${themeCssVariables.spacing[2]};
justify-content: space-between;
min-height: ${SIDE_PANEL_TOP_BAR_HEIGHT}px;
padding: 0 ${themeCssVariables.spacing[3]};
width: 100%;
@@ -54,9 +53,10 @@ const StyledTitle = styled.div`
const StyledRight = styled.div`
align-items: center;
display: flex;
flex-shrink: 0;
flex: 1;
gap: ${themeCssVariables.spacing[2]};
justify-content: flex-end;
min-width: 0;
`;
export const PageCardHeader = ({