1b2f079359
https://github.com/user-attachments/assets/130f12d7-5cef-4b83-912f-a9d42241f69f ~~This could be considered a POC 😅~~ addressing - https://github.com/twentyhq/core-team-issues/issues/1400 https://github.com/twentyhq/core-team-issues/issues/1403
19 lines
569 B
TypeScript
19 lines
569 B
TypeScript
import { type Layouts } from 'react-grid-layout';
|
|
import { GRID_BUFFER_ROWS } from '../constants/GridBufferRows';
|
|
import { GRID_MIN_ROWS } from '../constants/GridMinRows';
|
|
|
|
export const calculateTotalGridRows = (
|
|
layouts: Layouts,
|
|
minRows = GRID_MIN_ROWS,
|
|
bufferRows = GRID_BUFFER_ROWS,
|
|
): number => {
|
|
const allLayouts = [...(layouts.desktop || []), ...(layouts.mobile || [])];
|
|
|
|
const contentRows =
|
|
allLayouts.length === 0
|
|
? 0
|
|
: Math.max(...allLayouts.map((item) => item.y + item.h));
|
|
|
|
return Math.max(minRows, contentRows + bufferRows);
|
|
};
|