[Dashboards] - Add scroll wrapper (#14561)

## Summary
  - Fixed nested scrolls and sticky tabs in dashboard view
  - Drag select now auto-scrolls via ScrollWrapper context

## Changes
- Wrapped content in ScrollWrapper which provides context ID
automatically
  - Removed overflow from grid container to fix nested scrolls
This commit is contained in:
nitin
2025-09-17 19:09:22 +05:30
committed by GitHub
parent d841b0d0db
commit 09b9071182
2 changed files with 22 additions and 5 deletions
@@ -32,8 +32,6 @@ const StyledGridContainer = styled.div`
box-sizing: border-box;
flex: 1;
min-height: 100%;
overflow-y: auto;
overflow-x: hidden;
position: relative;
padding: ${({ theme }) => theme.spacing(2)};
width: 100%;
@@ -2,13 +2,27 @@ import { PageLayoutGridLayout } from '@/page-layout/components/PageLayoutGridLay
import { useCurrentPageLayout } from '@/page-layout/hooks/useCurrentPageLayout';
import { getTabListInstanceIdFromPageLayoutId } from '@/page-layout/utils/getTabListInstanceIdFromPageLayoutId';
import { TabList } from '@/ui/layout/tab-list/components/TabList';
import { ScrollWrapper } from '@/ui/utilities/scroll/components/ScrollWrapper';
import styled from '@emotion/styled';
import { isDefined } from 'twenty-shared/utils';
const StyledContainer = styled.div`
display: flex;
flex-direction: column;
height: 100%;
width: 100%;
overflow: hidden;
background: ${({ theme }) => theme.background.primary};
`;
const StyledTabList = styled(TabList)`
padding-left: ${({ theme }) => theme.spacing(2)};
`;
const StyledScrollWrapper = styled(ScrollWrapper)`
flex: 1;
`;
export const PageLayoutRendererContent = () => {
const { currentPageLayout } = useCurrentPageLayout();
@@ -17,7 +31,7 @@ export const PageLayoutRendererContent = () => {
}
return (
<>
<StyledContainer>
<StyledTabList
tabs={currentPageLayout.tabs}
behaveAsLinks={false}
@@ -25,7 +39,12 @@ export const PageLayoutRendererContent = () => {
currentPageLayout.id,
)}
/>
<PageLayoutGridLayout />
</>
<StyledScrollWrapper
componentInstanceId={`scroll-wrapper-page-layout-${currentPageLayout.id}`}
defaultEnableXScroll={false}
>
<PageLayoutGridLayout />
</StyledScrollWrapper>
</StyledContainer>
);
};