Skip to content

Commit da10003

Browse files
committed
comments: adjust table column flex properties for better responsiveness and update initial table height calculation
1 parent 8731ab9 commit da10003

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

ui/src/components/ContentMapper/index.scss

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -706,12 +706,13 @@ div .table-row {
706706
}
707707

708708
// Target actual column containers. Honour the per-column `width` venus applies inline
709-
// from the `columns` config (flex-basis: auto reads that width) instead of forcing every
710-
// column to an equal `flex: 1 1 0`. Columns with an explicit width hold it; the last
711-
// column (no width in config) grows to fill the remaining space.
709+
// from the `columns` config (flex-basis: auto reads that width) as the STARTING size,
710+
// instead of forcing every column to an equal `flex: 1 1 0`. flex-shrink:1 (+ min-width:0)
711+
// lets the fixed-width columns give way on narrow viewports so the row never exceeds the
712+
// available width and forces a horizontal scrollbar; they hold their width when there's room.
712713
.Table__head__column,
713714
.Table__body__column {
714-
flex: 0 0 auto;
715+
flex: 0 1 auto;
715716
min-width: 0 !important;
716717
display: flex !important;
717718
align-items: center;

ui/src/components/ContentMapper/useMeasuredTableHeight.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ const MIN_USABLE_HEIGHT = 80; // floor for the table body so it never collapses/
3333
// Fallback for the bounded box height (matches .entry-asset-mapper's calc(100vh - 246px) cap),
3434
// used only when the box isn't mounted/measured yet.
3535
const BOX_HEIGHT_FALLBACK = 246;
36+
// Reserve when no chrome is measured yet (toggle defaults to 0). Same terms as measure()'s
37+
// `reserve` so the pre-measure guess uses the hook's own box model, not a stray constant.
38+
const RESERVE_FALLBACK = PANEL_FALLBACK + FOOTER_FALLBACK + PAGINATION_AND_BUFFER;
3639
const BOX_SELECTOR = '.entry-asset-mapper';
3740
const TOGGLE_SELECTOR = '.mapper-view-toggle';
3841

@@ -41,7 +44,11 @@ export function useMeasuredTableHeight(
4144
deps: unknown[],
4245
{ panelSelector, footerSelector }: MeasuredTableHeightOptions,
4346
): number {
44-
const [tableHeight, setTableHeight] = useState<number>(() => window.innerHeight - 520);
47+
// Pre-measure guess: same model as measure() (box fallback − reserve), clamped to the floor
48+
// so the one frame react-window renders before the effect runs never gets a negative height.
49+
const [tableHeight, setTableHeight] = useState<number>(() =>
50+
Math.max(MIN_USABLE_HEIGHT, window.innerHeight - BOX_HEIGHT_FALLBACK - RESERVE_FALLBACK),
51+
);
4552

4653
useEffect(() => {
4754
const measure = () => {

0 commit comments

Comments
 (0)