9d7f0c405f
Fast-follows for the new layout — the remaining open sub-issues of
twentyhq/core-team-issues#2478.
## Changes
- **Command menu items should not have extra right padding**
(twentyhq/core-team-issues#2500)
`SidePanelList` set `width: calc(100% - spacing[4])` on top of its own
8px left/right padding. Under the global `box-sizing: border-box`, that
extra `-16px` shrinks the list and, because it's left-aligned, dumps the
whole gap on the right. Switched to `width: 100%` so item highlights
inset 8px symmetrically. This is shared by every side-panel list — they
all had the same right-only gutter, so they're all corrected the same
way.
- **Field options should not be cropped and should keep row gaps**
(twentyhq/core-team-issues#2503)
The option row used a fixed `height: spacing[6]`, so under border-box
the `6px` vertical padding was absorbed and consecutive rows sat flush.
Changed `height` → `min-height` so the padding separates the rows again.
- **Logs table with filters should use Background secondary**
(twentyhq/core-team-issues#2505)
The Logs filter card and the upgrade card defaulted to a transparent
background, showing the white page through. Passed
`backgroundColor={themeCssVariables.background.secondary}`, matching
`SettingsTableCard`. The results table stays on the primary surface, per
the Figma reference.
- **Command menu back chevron** (twentyhq/core-team-issues#2504)
`SidePanelTopBar` showed a back chevron whenever the nav stack had more
than one entry. A command-menu page is the root of a fresh command-menu
session, so it now only shows the chevron when it was opened from
another command-menu page. Every other side-panel page keeps standard
history-based back navigation, so workflow / page-layout / record stacks
are unaffected.
## Verification
- oxlint (`--type-aware`, full `src/`): 0 errors
- oxfmt: clean
- tsgo typecheck: no errors in the changed files (the one reported error
is pre-existing in `RestPlayground.tsx`, which this PR does not touch)
- Verified live at apple.localhost:
- #2500 — command menu item highlight insets measured 8px left / 8px
right (was 8 / 24)
- #2503 — option rows render at 38px tall with ~14px gaps, text no
longer cropped
- #2505 — filter + upgrade cards compute to background-secondary;
results table stays on primary
- #2504 — direct command menu shows the close-X with no chevron; pages
opened from the command menu still show the chevron
## Open question for review (#2504)
The issue also describes the page-header three-dots toggle: *"the three
dots icon button should remain visible if the side panel is on a page
that is not a child of the command menu (AI chat, or a page opened
directly)."* Today that toggle morphs to an X for any non-command-menu
side-panel page (e.g. Ask AI). Honoring that touches the shared
`SidePanelToggleButton`, and there's a related decision: search / Ask AI
opened from the command menu currently reset the nav stack rather than
push, so they don't get a "back to command menu" chevron. I left those
out here since they're a behavior change to a shared control with a
product call attached — happy to follow up once you confirm the intended
toggle behavior.
Closes twentyhq/core-team-issues#2500
Closes twentyhq/core-team-issues#2503
Closes twentyhq/core-team-issues#2505
Refs twentyhq/core-team-issues#2504
Refs twentyhq/core-team-issues#2478
85 lines
2.8 KiB
TypeScript
85 lines
2.8 KiB
TypeScript
import { SidePanelDefaultSelectionEffect } from '@/side-panel/components/SidePanelDefaultSelectionEffect';
|
|
import { SIDE_PANEL_SELECTABLE_LIST_ID } from '@/side-panel/constants/SidePanelSelectableListId';
|
|
import { SIDE_PANEL_TOP_BAR_HEIGHT } from '@/side-panel/constants/SidePanelTopBarHeight';
|
|
import { SIDE_PANEL_LIST_PADDING } from '@/side-panel/constants/SidePanelListPadding';
|
|
import { SIDE_PANEL_FOCUS_ID } from '@/side-panel/constants/SidePanelFocusId';
|
|
import { hasUserSelectedSidePanelListItemState } from '@/side-panel/states/hasUserSelectedSidePanelListItemState';
|
|
import { SelectableList } from '@/ui/layout/selectable-list/components/SelectableList';
|
|
import { useSetAtomState } from '@/ui/utilities/state/jotai/hooks/useSetAtomState';
|
|
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
|
|
import { styled } from '@linaria/react';
|
|
import { t } from '@lingui/core/macro';
|
|
import {
|
|
MOBILE_VIEWPORT,
|
|
themeCssVariables,
|
|
} from 'twenty-ui-deprecated/theme-constants';
|
|
|
|
export type SidePanelListProps = {
|
|
selectableItemIds: string[];
|
|
children: React.ReactNode;
|
|
loading?: boolean;
|
|
noResults?: boolean;
|
|
noResultsText?: string;
|
|
};
|
|
|
|
const StyledInnerList = styled.div`
|
|
max-height: calc(
|
|
100dvh - ${SIDE_PANEL_TOP_BAR_HEIGHT}px - ${SIDE_PANEL_LIST_PADDING * 2}px
|
|
);
|
|
padding-left: ${themeCssVariables.spacing[2]};
|
|
padding-right: ${themeCssVariables.spacing[2]};
|
|
padding-top: ${themeCssVariables.spacing[2]};
|
|
width: 100%;
|
|
|
|
@media (min-width: ${MOBILE_VIEWPORT}px) {
|
|
max-height: calc(
|
|
100dvh - ${SIDE_PANEL_TOP_BAR_HEIGHT}px - ${SIDE_PANEL_LIST_PADDING * 2}px
|
|
);
|
|
}
|
|
`;
|
|
|
|
const StyledEmpty = styled.div`
|
|
align-items: center;
|
|
color: ${themeCssVariables.font.color.light};
|
|
display: flex;
|
|
font-size: ${themeCssVariables.font.size.md};
|
|
height: 64px;
|
|
justify-content: center;
|
|
white-space: pre-wrap;
|
|
`;
|
|
|
|
export const SidePanelList = ({
|
|
selectableItemIds,
|
|
children,
|
|
loading = false,
|
|
noResults = false,
|
|
noResultsText,
|
|
}: SidePanelListProps) => {
|
|
const setHasUserSelectedSidePanelListItem = useSetAtomState(
|
|
hasUserSelectedSidePanelListItemState,
|
|
);
|
|
|
|
return (
|
|
<>
|
|
<SidePanelDefaultSelectionEffect selectableItemIds={selectableItemIds} />
|
|
<ScrollWrapper componentInstanceId={`scroll-wrapper-side-panel`}>
|
|
<StyledInnerList>
|
|
<SelectableList
|
|
selectableListInstanceId={SIDE_PANEL_SELECTABLE_LIST_ID}
|
|
focusId={SIDE_PANEL_FOCUS_ID}
|
|
selectableItemIdArray={selectableItemIds}
|
|
onSelect={() => {
|
|
setHasUserSelectedSidePanelListItem(true);
|
|
}}
|
|
>
|
|
{children}
|
|
{noResults && !loading && (
|
|
<StyledEmpty>{noResultsText ?? t`No results found`}</StyledEmpty>
|
|
)}
|
|
</SelectableList>
|
|
</StyledInnerList>
|
|
</ScrollWrapper>
|
|
</>
|
|
);
|
|
};
|