Fix last widget bottom bar inconsistencies (#19440)
Widgets weren't sorted
This commit is contained in:
committed by
GitHub
parent
e9310555fb
commit
9d96e529c8
+8
-1
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user