Skip to content

feat(reports): orientation, cards per row and condensed card options - #61

Merged
Morialkar merged 1 commit into
mainfrom
feat/reports-layout-options
Aug 1, 2026
Merged

feat(reports): orientation, cards per row and condensed card options#61
Morialkar merged 1 commit into
mainfrom
feat/reports-layout-options

Conversation

@Morialkar

Copy link
Copy Markdown
Owner

Stacked on #60 — please merge that one first; this branch targets it, not main.

Answers the question that came out of #60: is one card per page a fixed rule, or was that specific to a 16-field view?

It was the view

Density is driven by card height. Measured on real Ouvrages records, 40 at a time:

Fields in the view Records per page
1 4.0
2 3.6
4 2.7
8 1.9
16 (the "Test" view) 1.0

Two things cap it: long titles that wrap to three lines (the same concise view on a short-title table gives 5.0 instead of 3.6), and fixed card chrome — an 80px column floor plus padding and margins — which dominates once the content is small.

What this adds

Three layout options, carried through save, preview, print and PDF:

  • orientation — portrait or landscape, applied to Dompdf's paper and to the document's @page rule, so printing the iframe uses the same sheet
  • card_columns — 1 to 4 cards side by side, laid out as a grid
  • compact_cards — drops the column floor and tightens padding, margins and title size

Measured on short-title records, 40 at a time:

Setting Records per page
default 5.0
2 columns 8.0
2 columns + condensed 10.0
4 columns + condensed + landscape 13.3

Two notes on the design

More columns is not always denser. On the long-title table, 4 columns is worse than 3 (5.0 vs 5.7) because narrow cards wrap titles harder. That is why these are exposed as options rather than picked automatically — the right setting depends on the data.

I did not implement a fixed "N cards per page". The renderer already packs as many cards as physically fit, so there is no idle space to reclaim; forcing a higher count would mean shrinking cards until content is silently clipped. Cards-per-row reaches the same goal without truncating anything.

The card options only appear once a view is selected; orientation stays available since it applies to table layouts too.

Verification

  • 189 API tests (4 new): the three keys survive a save; out-of-range values are rejected with 422; the grid emits 2 rows of 3 for 6 records where 1 column emits 6; landscape reaches both @page and the PDF MediaBox (842x595, wider than tall); condensed swaps the 80px floor for 0
  • 78 client tests (2 new): the controls feed orientation, card_columns and compact_cards into the export payload, and the card options stay hidden without a view
  • density figures above measured by rendering real records through Dompdf in the API container
  • Pint, tsc -b, ESLint, Prettier all clean

The live UI walkthrough is the one thing I have not re-run — restarting the dev server dropped my session, and I do not enter passwords. The wiring is covered by the tests above and every option is verified end to end at the API level.

Card layouts printed one record per page for wide views, which wastes paper
on concise ones. Measured on real records, density is driven by card height,
not by a fixed rule: 4.0 records per page with a single field, 1.0 with
sixteen.

Add three layout options that carry through save, preview, print and PDF:

- orientation: portrait or landscape, applied both to Dompdf's paper and to
  the document's @page rule so the browser prints the iframe the same way
- card_columns: 1 to 4 cards side by side, laid out as a grid
- compact_cards: drops the 80px column floor and tightens padding, margins
  and the title size

Measured on a table with short titles, 40 records: 5.0 per page by default,
8.0 at two columns, 10.0 with condensed cards, 13.3 at four columns in
landscape.

More columns is not always denser — narrow cards wrap long titles — so the
options are exposed rather than guessed at, and the card ones only appear
when a view is selected.
@Morialkar
Morialkar changed the base branch from feat/reports-unified-print-pdf to main August 1, 2026 20:06
@Morialkar
Morialkar merged commit b47bce5 into main Aug 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant