The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
Fix last widget bottom bar inconsistencies (#19440)
Baptiste Devessier9d96e529c8ce
diff --git a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.tsindex 7e41bc0e85c..3d924f755c4 100644--- a/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts+++ b/packages/twenty-front/src/modules/page-layout/widgets/hooks/useIsCurrentWidgetLastOfTab.ts@@ -2,9 +2,11 @@ import { useCurrentPageLayout } from '@/page-layout/hooks/useCurrentPageLayout';import { useIsPageLayoutInEditMode } from '@/page-layout/hooks/useIsPageLayoutInEditMode';import { buildWidgetVisibilityContext } from '@/page-layout/utils/buildWidgetVisibilityContext';import { filterVisibleWidgets } from '@/page-layout/utils/filterVisibleWidgets';+import { sortWidgetsByVerticalListPosition } from '@/page-layout/utils/sortWidgetsByVerticalListPosition';import { useLayoutRenderingContext } from '@/ui/layout/contexts/LayoutRenderingContext';import { useIsMobile } from '@/ui/utilities/responsive/hooks/useIsMobile';import { isDefined } from 'twenty-shared/utils';+import { PageLayoutTabLayoutMode } from '~/generated-metadata/graphql';export const useIsCurrentWidgetLastOfTab = (widgetId: string): boolean => {const { currentPageLayout } = useCurrentPageLayout();@@ -24,13 +26,18 @@ export const useIsCurrentWidgetLastOfTab = (widgetId: string): boolean => {return false;}- const visibleWidgets = isPageLayoutInEditMode+ const filteredWidgets = isPageLayoutInEditMode? tab.widgets: filterVisibleWidgets({widgets: tab.widgets,context: buildWidgetVisibilityContext({ isMobile, isInSidePanel }),});+ const visibleWidgets =+ tab.layoutMode === PageLayoutTabLayoutMode.VERTICAL_LIST+ ? sortWidgetsByVerticalListPosition(filteredWidgets)+ : filteredWidgets;+if (visibleWidgets.length === 0) {return false;}