Skip to content

The open alternative to Salesforce, designed for AI.

Let lone widgets fill standalone pages (#27863)

Thomas des Francscb63d4fb77a6
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetCardShell.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetCardShell.tsx
index 45bb8ddb684..d794d0102d1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetCardShell.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/WidgetCardShell.tsx
@@ -7,9 +7,8 @@ import { WidgetContentRenderer } from '@/page-layout/widgets/components/WidgetCo
import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext';
import { type WidgetAccessDenialInfo } from '@/page-layout/widgets/types/WidgetAccessDenialInfo';
import { type WidgetCardVariant } from '@/page-layout/widgets/types/WidgetCardVariant';
-import { getWidgetContentPadding } from '@/page-layout/widgets/utils/getWidgetContentPadding';
+import { getWidgetCardContentPadding } from '@/page-layout/widgets/utils/getWidgetCardContentPadding';
import { isViewportFillingWidget } from '@/page-layout/widgets/utils/isViewportFillingWidget';
-import { isWidgetCardFlushInViewMode } from '@/page-layout/widgets/utils/isWidgetCardFlushInViewMode';
import { WidgetCard } from '@/page-layout/widgets/widget-card/components/WidgetCard';
import { WidgetCardContent } from '@/page-layout/widgets/widget-card/components/WidgetCardContent';
import { WidgetCardHeader } from '@/page-layout/widgets/widget-card/components/WidgetCardHeader';
@@ -62,7 +61,7 @@ export const WidgetCardShell = ({
onMouseLeave,
}: WidgetCardShellProps) => {
const theme = useTheme();
- const { layoutMode } = usePageLayoutContentContext();
+ const { layoutMode, presentation } = usePageLayoutContentContext();
const { currentPageLayout } = useCurrentPageLayoutOrThrow();
const isVerticalList = layoutMode === PageLayoutTabLayoutMode.VERTICAL_LIST;
@@ -71,12 +70,13 @@ export const WidgetCardShell = ({
isVerticalList &&
widget.type === WidgetType.IFRAME &&
!isViewportFillingWidget(widget);
- const contentPadding = isWidgetCardFlushInViewMode({
+ const contentPadding = getWidgetCardContentPadding({
isEditable,
+ pageLayoutType: currentPageLayout.type,
+ presentation,
variant,
- })
- ? getWidgetContentPadding(widget.type)
- : 'default';
+ widgetType: widget.type,
+ });
const dataTestId =
widget.type === WidgetType.FIELDS ? 'record-fields-widget' : widget.id;
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
index 8a02bc41570..fec1815ffc3 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/components/__stories__/WidgetRenderer.stories.tsx
@@ -3,7 +3,7 @@ import { useApolloClient } from '@apollo/client/react';
import { type MockedResponse } from '@apollo/client/testing';
import { type Meta, type StoryObj } from '@storybook/react-vite';
import { MemoryRouter } from 'react-router-dom';
-import { expect, within } from 'storybook/test';
+import { expect, waitFor, within } from 'storybook/test';
import { CatalogDecorator, type CatalogStory } from 'twenty-ui/testing';
import { currentUserWorkspaceState } from '@/auth/states/currentUserWorkspaceState';
@@ -14,6 +14,7 @@ import { type ObjectRecord } from '@/object-record/types/ObjectRecord';
import { PageLayoutContentProvider } from '@/page-layout/contexts/PageLayoutContentContext';
import { jotaiStore } from '@/ui/utilities/state/jotai/jotaiStore';
import { CoreObjectNameSingular } from 'twenty-shared/types';
+import { isDefined } from 'twenty-shared/utils';
import { setTestObjectMetadataItemsInMetadataStore } from '~/testing/utils/setTestObjectMetadataItemsInMetadataStore';
import { pageLayoutPersistedComponentState } from '@/page-layout/states/pageLayoutPersistedComponentState';
@@ -30,6 +31,8 @@ import { pageLayoutDraggingWidgetIdComponentState } from '@/page-layout/states/p
import { pageLayoutEditingWidgetIdComponentState } from '@/page-layout/states/pageLayoutEditingWidgetIdComponentState';
import { type PageLayout } from '@/page-layout/types/PageLayout';
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
+import { type TabPresentation } from '@/page-layout/types/TabPresentation';
+import { makeWidget } from '@/page-layout/testing/pageLayoutDraftFixtures';
import { WidgetComponentInstanceContext } from '@/page-layout/widgets/states/contexts/WidgetComponentInstanceContext';
import { widgetCardHoveredComponentFamilyState } from '@/page-layout/widgets/states/widgetCardHoveredComponentFamilyState';
import { LayoutRenderingProvider } from '@/ui/layout/contexts/LayoutRenderingContext';
@@ -39,6 +42,7 @@ import {
AxisNameDisplay,
BarChartLayout,
FieldDisplayMode,
+ FindOneFrontComponentDocument,
GraphOrderBy,
PageLayoutTabLayoutMode,
PageLayoutType,
@@ -84,6 +88,8 @@ const WIDGET_ID_TALL = 'widget-tall';
const WIDGET_ID_MANY_TO_ONE_RELATION = 'widget-relation-field';
const WIDGET_ID_ONE_TO_MANY_RELATION = 'widget-one-to-many-relation-field';
const WIDGET_ID_CATALOG = 'catalog-widget';
+const WIDGET_ID_FRONT_COMPONENT = 'widget-front-component';
+const FRONT_COMPONENT_ID = 'loading-front-component';
const TAB_ID_OVERVIEW = 'tab-overview';
const SIDE_PANEL_INSTANCE_ID = 'widget-side-panel';
@@ -170,6 +176,13 @@ const barChartGroupByQuery = generateGroupByAggregateQuery({
});
const graphqlMocks: MockedResponse[] = [
+ {
+ request: {
+ query: FindOneFrontComponentDocument,
+ variables: { id: FRONT_COMPONENT_ID },
+ },
+ delay: Infinity,
+ },
{
request: {
query: barChartGroupByQuery,
@@ -253,6 +266,213 @@ const meta: Meta<typeof WidgetRenderer> = {
export default meta;
type Story = StoryObj<typeof WidgetRenderer>;
+const FRONT_COMPONENT_WIDGET: PageLayoutWidget = {
+ ...makeWidget(WIDGET_ID_FRONT_COMPONENT, 0, TAB_ID_OVERVIEW),
+ type: WidgetType.FRONT_COMPONENT,
+ title: 'App',
+ configuration: {
+ __typename: 'FrontComponentConfiguration',
+ configurationType: WidgetConfigurationType.FRONT_COMPONENT,
+ frontComponentId: FRONT_COMPONENT_ID,
+ },
+};
+
+const NUMBER_CHART_WIDGET: PageLayoutWidget = {
+ ...makeWidget(WIDGET_ID_NUMBER_CHART, 0, TAB_ID_OVERVIEW),
+ type: WidgetType.GRAPH,
+ title: 'Sales Pipeline',
+ objectMetadataId: companyObjectMetadataItem.id,
+ configuration: {
+ __typename: 'AggregateChartConfiguration',
+ configurationType: WidgetConfigurationType.AGGREGATE_CHART,
+ aggregateOperation: AggregateOperations.COUNT,
+ aggregateFieldMetadataId: idField.id,
+ displayDataLabel: true,
+ },
+};
+
+const renderWidgetOnPage = ({
+ widget,
+ pageLayoutType,
+ presentation,
+ isInEditMode = false,
+}: {
+ widget: PageLayoutWidget;
+ pageLayoutType: PageLayoutType;
+ presentation: TabPresentation;
+ isInEditMode?: boolean;
+}): Story['render'] => {
+ return () => {
+ const pageLayoutData = createPageLayoutWithWidget(widget, pageLayoutType);
+
+ setTestObjectMetadataItemsInMetadataStore(
+ jotaiStore,
+ getTestEnrichedObjectMetadataItemsMock(),
+ );
+ jotaiStore.set(isMinimalMetadataReadyState.atom, true);
+ jotaiStore.set(
+ pageLayoutPersistedComponentState.atomFamily({
+ instanceId: PAGE_LAYOUT_TEST_INSTANCE_ID,
+ }),
+ pageLayoutData,
+ );
+ jotaiStore.set(
+ pageLayoutDraftComponentState.atomFamily({
+ instanceId: PAGE_LAYOUT_TEST_INSTANCE_ID,
+ }),
+ pageLayoutData,
+ );
+ jotaiStore.set(
+ isDashboardInEditModeComponentState.atomFamily({
+ instanceId: PAGE_LAYOUT_TEST_INSTANCE_ID,
+ }),
+ isInEditMode,
+ );
+
+ return (
+ <div style={{ width: 400, height: 240 }}>
+ <JestMetadataAndApolloMocksWrapper>
+ <CoreClientProviderWrapper>
+ <PageLayoutTestWrapper store={jotaiStore}>
+ <PageLayoutContentProvider
+ value={{
+ layoutMode: PageLayoutTabLayoutMode.VERTICAL_LIST,
+ presentation,
+ tabId: TAB_ID_OVERVIEW,
+ }}
+ >
+ <WidgetRenderer widget={widget} />
+ </PageLayoutContentProvider>
+ </PageLayoutTestWrapper>
+ </CoreClientProviderWrapper>
+ </JestMetadataAndApolloMocksWrapper>
+ </div>
+ );
+ };
+};
+
+const expectLoadingFrontComponentFrame = async ({
+ canvasElement,
+ outerFrame,
+}: {
+ canvasElement: HTMLElement;
+ outerFrame: boolean;
+}) => {
+ const card = await within(canvasElement).findByTestId(
+ WIDGET_ID_FRONT_COMPONENT,
+ );
+
+ await waitFor(() =>
+ expect(card.querySelector('[aria-busy="true"]')).toBeVisible(),
+ );
+
+ const loadingIndicator = card.querySelector('[aria-busy="true"]');
+ const containerStyles: CSSStyleDeclaration[] = [];
+
+ for (
+ let container = loadingIndicator?.parentElement;
+ isDefined(container) && container !== card;
+ container = container.parentElement
+ ) {
+ containerStyles.push(getComputedStyle(container));
+ }
+
+ expect(getComputedStyle(card).borderWidth).toBe(outerFrame ? '1px' : '0px');
+ expect(getComputedStyle(card).borderRadius === '0px').toBe(!outerFrame);
+ expect(containerStyles.some((style) => style.borderWidth !== '0px')).toBe(
+ false,
+ );
+ expect(containerStyles.some((style) => style.borderRadius !== '0px')).toBe(
+ false,
+ );
+};
+
+export const StandaloneFrontComponentLoading: Story = {
+ render: renderWidgetOnPage({
+ widget: FRONT_COMPONENT_WIDGET,
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'solo',
+ }),
+ play: async ({ canvasElement }) => {
+ const card = await within(canvasElement).findByTestId(
+ WIDGET_ID_FRONT_COMPONENT,
+ );
+
+ expect(card.querySelector('[aria-busy="true"]')).toBeNull();
+
+ for (const element of [card, ...card.querySelectorAll('*')]) {
+ const style = getComputedStyle(element);
+
+ expect(style.borderWidth).toBe('0px');
+ expect(style.borderRadius).toBe('0px');
+ expect(style.padding).toBe('0px');
+ }
+ },
+};
+
+export const StackedFrontComponentLoading: Story = {
+ render: renderWidgetOnPage({
+ widget: FRONT_COMPONENT_WIDGET,
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'stack',
+ }),
+ play: async ({ canvasElement }) => {
+ await expectLoadingFrontComponentFrame({
+ canvasElement,
+ outerFrame: true,
+ });
+ },
+};
+
+export const DashboardFrontComponentLoading: Story = {
+ render: renderWidgetOnPage({
+ widget: FRONT_COMPONENT_WIDGET,
+ pageLayoutType: PageLayoutType.DASHBOARD,
+ presentation: 'solo',
+ }),
+ play: StackedFrontComponentLoading.play,
+};
+
+export const EditingFrontComponentLoading: Story = {
+ render: renderWidgetOnPage({
+ widget: FRONT_COMPONENT_WIDGET,
+ pageLayoutType: PageLayoutType.DASHBOARD,
+ presentation: 'solo',
+ isInEditMode: true,
+ }),
+ play: StackedFrontComponentLoading.play,
+};
+
+export const RecordFrontComponentLoading: Story = {
+ render: renderWidgetOnPage({
+ widget: FRONT_COMPONENT_WIDGET,
+ pageLayoutType: PageLayoutType.RECORD_PAGE,
+ presentation: 'solo',
+ }),
+ play: async ({ canvasElement }) => {
+ await expectLoadingFrontComponentFrame({
+ canvasElement,
+ outerFrame: false,
+ });
+ },
+};
+
+export const StandaloneChart: Story = {
+ render: renderWidgetOnPage({
+ widget: NUMBER_CHART_WIDGET,
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'solo',
+ }),
+ play: async ({ canvasElement }) => {
+ const card = await within(canvasElement).findByTestId(
+ WIDGET_ID_NUMBER_CHART,
+ );
+
+ expect(getComputedStyle(card).borderWidth).toBe('0px');
+ expect(getComputedStyle(card).borderRadius).toBe('0px');
+ },
+};
+
export const WithNumberChart: Story = {
render: () => {
const widget: PageLayoutWidget = {
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx
index 5dcf060bfac..ebf021a9ac3 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx
+++ b/packages/twenty-front/src/modules/page-layout/widgets/front-component/components/FrontComponentWidgetRenderer.tsx
@@ -8,6 +8,7 @@ import { usePageLayoutContentContext } from '@/page-layout/contexts/PageLayoutCo
import { useIsPageLayoutInEditMode } from '@/page-layout/hooks/useIsPageLayoutInEditMode';
import { type PageLayoutWidget } from '@/page-layout/types/PageLayoutWidget';
import { PageLayoutWidgetNoDataDisplay } from '@/page-layout/widgets/components/PageLayoutWidgetNoDataDisplay';
+import { isFullPageWidget } from '@/page-layout/widgets/utils/isFullPageWidget';
import { isWidgetConfigurationOfType } from '@/side-panel/pages/page-layout/utils/isWidgetConfigurationOfType';
import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';
@@ -40,7 +41,7 @@ export const FrontComponentWidgetRenderer = ({
}: FrontComponentWidgetRendererProps) => {
const isPageLayoutInEditMode = useIsPageLayoutInEditMode();
const { presentation } = usePageLayoutContentContext();
- const { targetRecordIdentifier } = useLayoutRenderingContext();
+ const { layoutType, targetRecordIdentifier } = useLayoutRenderingContext();
const configuration = widget.configuration;
@@ -55,18 +56,25 @@ export const FrontComponentWidgetRenderer = ({
const selectedRecordIds = isDefined(targetRecordIdentifier?.id)
? [targetRecordIdentifier.id]
: undefined;
+ const isFullPageFrontComponent = isFullPageWidget({
+ pageLayoutType: layoutType,
+ presentation,
+ });
+ const loadingFallback = isFullPageFrontComponent ? null : (
+ <FrontComponentSkeletonLoader />
+ );
return (
<StyledContainer
isInEditMode={isPageLayoutInEditMode}
isSoloLayout={presentation === 'solo'}
>
- <Suspense fallback={<FrontComponentSkeletonLoader />}>
+ <Suspense fallback={loadingFallback}>
<FrontComponentRenderer
frontComponentId={frontComponentId}
selectedRecordIds={selectedRecordIds}
objectNameSingular={targetRecordIdentifier?.targetObjectNameSingular}
- loadingFallback={<FrontComponentSkeletonLoader />}
+ loadingFallback={loadingFallback}
/>
</Suspense>
</StyledContainer>
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useWidgetRendererState.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useWidgetRendererState.ts
index 40cef2bb59c..b1d677940cf 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useWidgetRendererState.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useWidgetRendererState.ts
@@ -93,6 +93,7 @@ export const useWidgetRendererState = (widget: PageLayoutWidget) => {
const variant = getWidgetCardVariant({
isSideColumnContext,
pageLayoutType: currentPageLayout.type,
+ presentation,
});
return {
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardContentPadding.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardContentPadding.test.ts
new file mode 100644
index 00000000000..a64bdcf0a13
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardContentPadding.test.ts
@@ -0,0 +1,40 @@
+import { getWidgetCardContentPadding } from '@/page-layout/widgets/utils/getWidgetCardContentPadding';
+import { PageLayoutType, WidgetType } from '~/generated-metadata/graphql';
+
+describe('getWidgetCardContentPadding', () => {
+ it('returns no padding for the only app of a standalone page', () => {
+ expect(
+ getWidgetCardContentPadding({
+ isEditable: false,
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'solo',
+ variant: 'flush',
+ widgetType: WidgetType.FRONT_COMPONENT,
+ }),
+ ).toBe('none');
+ });
+
+ it('returns default padding for a framed card', () => {
+ expect(
+ getWidgetCardContentPadding({
+ isEditable: false,
+ pageLayoutType: PageLayoutType.DASHBOARD,
+ presentation: 'stack',
+ variant: 'framed',
+ widgetType: WidgetType.WORKFLOW,
+ }),
+ ).toBe('default');
+ });
+
+ it('returns the widget type padding for a flush card in view mode', () => {
+ expect(
+ getWidgetCardContentPadding({
+ isEditable: false,
+ pageLayoutType: PageLayoutType.RECORD_PAGE,
+ presentation: 'solo',
+ variant: 'flush',
+ widgetType: WidgetType.WORKFLOW,
+ }),
+ ).toBe('none');
+ });
+});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts
index 9ade88de068..aa2e74be3d1 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/getWidgetCardVariant.test.ts
@@ -11,6 +11,7 @@ describe('getWidgetCardVariant', () => {
getWidgetCardVariant({
isSideColumnContext: false,
pageLayoutType,
+ presentation: 'stack',
}),
).toBe('framed');
});
@@ -24,6 +25,7 @@ describe('getWidgetCardVariant', () => {
getWidgetCardVariant({
isSideColumnContext: false,
pageLayoutType,
+ presentation: 'stack',
}),
).toBe('flush');
});
@@ -34,6 +36,17 @@ describe('getWidgetCardVariant', () => {
getWidgetCardVariant({
isSideColumnContext: true,
pageLayoutType: PageLayoutType.DASHBOARD,
+ presentation: 'stack',
+ }),
+ ).toBe('flush');
+ });
+
+ it("returns 'flush' for the only widget of a standalone page", () => {
+ expect(
+ getWidgetCardVariant({
+ isSideColumnContext: false,
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'solo',
}),
).toBe('flush');
});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/isFullPageWidget.test.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/isFullPageWidget.test.ts
new file mode 100644
index 00000000000..bed6a18d330
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/__tests__/isFullPageWidget.test.ts
@@ -0,0 +1,21 @@
+import { isFullPageWidget } from '@/page-layout/widgets/utils/isFullPageWidget';
+import { PageLayoutType } from '~/generated-metadata/graphql';
+
+describe('isFullPageWidget', () => {
+ it('returns true for the only widget of a standalone page', () => {
+ expect(
+ isFullPageWidget({
+ pageLayoutType: PageLayoutType.STANDALONE_PAGE,
+ presentation: 'solo',
+ }),
+ ).toBe(true);
+ });
+
+ it.each([
+ ['a stacked standalone page', PageLayoutType.STANDALONE_PAGE, 'stack'],
+ ['a solo record page tab', PageLayoutType.RECORD_PAGE, 'solo'],
+ ['a dashboard', PageLayoutType.DASHBOARD, 'stack'],
+ ] as const)('returns false on %s', (_label, pageLayoutType, presentation) => {
+ expect(isFullPageWidget({ pageLayoutType, presentation })).toBe(false);
+ });
+});
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardContentPadding.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardContentPadding.ts
new file mode 100644
index 00000000000..b41d66c6025
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardContentPadding.ts
@@ -0,0 +1,38 @@
+import { type TabPresentation } from '@/page-layout/types/TabPresentation';
+import { type WidgetCardVariant } from '@/page-layout/widgets/types/WidgetCardVariant';
+import {
+ getWidgetContentPadding,
+ type WidgetContentPadding,
+} from '@/page-layout/widgets/utils/getWidgetContentPadding';
+import { isFullPageWidget } from '@/page-layout/widgets/utils/isFullPageWidget';
+import { isWidgetCardFlushInViewMode } from '@/page-layout/widgets/utils/isWidgetCardFlushInViewMode';
+import { type PageLayoutType, WidgetType } from '~/generated-metadata/graphql';
+
+type GetWidgetCardContentPaddingParams = {
+ isEditable: boolean;
+ pageLayoutType: PageLayoutType | null;
+ presentation: TabPresentation;
+ variant: WidgetCardVariant;
+ widgetType: WidgetType;
+};
+
+export const getWidgetCardContentPadding = ({
+ isEditable,
+ pageLayoutType,
+ presentation,
+ variant,
+ widgetType,
+}: GetWidgetCardContentPaddingParams): WidgetContentPadding => {
+ if (
+ widgetType === WidgetType.FRONT_COMPONENT &&
+ isFullPageWidget({ pageLayoutType, presentation })
+ ) {
+ return 'none';
+ }
+
+ if (!isWidgetCardFlushInViewMode({ isEditable, variant })) {
+ return 'default';
+ }
+
+ return getWidgetContentPadding(widgetType);
+};
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts
index b9d87ce56f0..1707f7aa44a 100644
--- a/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/getWidgetCardVariant.ts
@@ -1,16 +1,23 @@
import { PageLayoutType } from '~/generated-metadata/graphql';
+import { type TabPresentation } from '@/page-layout/types/TabPresentation';
import { type WidgetCardVariant } from '@/page-layout/widgets/types/WidgetCardVariant';
+import { isFullPageWidget } from '@/page-layout/widgets/utils/isFullPageWidget';
type GetWidgetCardVariantParams = {
isSideColumnContext: boolean;
pageLayoutType: PageLayoutType | null;
+ presentation: TabPresentation;
};
export const getWidgetCardVariant = ({
isSideColumnContext,
pageLayoutType,
+ presentation,
}: GetWidgetCardVariantParams): WidgetCardVariant => {
- if (isSideColumnContext) {
+ if (
+ isSideColumnContext ||
+ isFullPageWidget({ pageLayoutType, presentation })
+ ) {
return 'flush';
}
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/utils/isFullPageWidget.ts b/packages/twenty-front/src/modules/page-layout/widgets/utils/isFullPageWidget.ts
new file mode 100644
index 00000000000..b12933a061e
--- /dev/null
+++ b/packages/twenty-front/src/modules/page-layout/widgets/utils/isFullPageWidget.ts
@@ -0,0 +1,13 @@
+import { type TabPresentation } from '@/page-layout/types/TabPresentation';
+import { PageLayoutType } from '~/generated-metadata/graphql';
+
+type IsFullPageWidgetParams = {
+ pageLayoutType: PageLayoutType | null;
+ presentation: TabPresentation;
+};
+
+export const isFullPageWidget = ({
+ pageLayoutType,
+ presentation,
+}: IsFullPageWidgetParams): boolean =>
+ pageLayoutType === PageLayoutType.STANDALONE_PAGE && presentation === 'solo';