Page updates: v1.10.3 to v1.10.6 #20

Merged
ngu-git-admin merged 19 commits from page-updates into main 2026-10-01 09:23:31 +01:00
2 changed files with 41 additions and 4 deletions
Showing only changes of commit 01de6272f3 - Show all commits

View file

@ -66,6 +66,16 @@
border-left: 1px solid var(--pl-rule);
}
/* Everyone on one line (fitsOneRow in PeopleTiles.tsx): the groups
share it by head count, and the tiles narrow to fit. */
.pl__groups[data-row="one"] {
flex-wrap: nowrap;
}
.pl__groups[data-row="one"] .pl__group {
flex: var(--pl-share) 1 0;
}
.pl__group-head {
display: flex;
flex-direction: column;

View file

@ -56,7 +56,10 @@ import "./PeopleTiles.css";
* Rows fill (balancedColumns): as many tiles across as fit, never
* fewer than 2 or more than 10, one fewer when that would leave a
* lone tile on the last row. When 2 don't fit at full size they
* shrink.
* shrink. And when everyone (every group, leads and members alike)
* fits on one line with tiles at ONE_ROW_SHRINK of full width or
* wider, they all share that one line instead (fitsOneRow): a
* board of 7 reads as one row, not 5 and 2.
*
* Details open in a panel right under the tile, over what follows
* (flipped to end at the tile's right edge when it would run off
@ -484,6 +487,9 @@ export function PeopleTilesView({
}
const open = openKey ? findByKey(resolvedGroups, openKey) : null;
const oneRow =
room !== null && overflow !== "scroll" &&
fitsOneRow(resolvedGroups.map((group) => group.people.length), room.width, room.tile, room.gap);
const anchored = overflow !== "scroll";
const closePanel = () => {
setOpenKey(null);
@ -537,13 +543,17 @@ export function PeopleTilesView({
{...rest}
>
<span ref={probeRef} className="pl__probe" aria-hidden="true" />
<div className="pl__groups">
<div className="pl__groups" data-row={oneRow ? "one" : undefined}>
{resolvedGroups.map((group) => (
<section
key={group.id}
className="pl__group"
style={
group.accent ? ({ "--pl-accent": group.accent } as CSSProperties) : undefined
{
...(group.accent ? { "--pl-accent": group.accent } : null),
// Sharing one line: each group's width follows its head count.
...(oneRow ? { "--pl-share": group.people.length } : null),
} as CSSProperties
}
aria-label={group.label || undefined}
>
@ -559,7 +569,9 @@ export function PeopleTilesView({
style={
room
? ({
"--pl-cols": balancedColumns(group.people.length, room.width, room.tile, room.gap),
"--pl-cols": oneRow
? group.people.length
: balancedColumns(group.people.length, room.width, room.tile, room.gap),
} as CSSProperties)
: undefined
}
@ -834,6 +846,21 @@ function Chevron() {
/* ── Helpers ─────────────────────────────────────────────────── */
/* How small a tile may get so a whole list shares one line. */
export const ONE_ROW_SHRINK = 0.75;
/* Whether every group fits side by side on one line, 10 tiles at most,
with tiles no smaller than ONE_ROW_SHRINK of full width. Groups are
divided by a gap, padding and a 1px rule (PeopleTiles.css). */
export function fitsOneRow(counts: number[], width: number, tile: number, gap: number): boolean {
const total = counts.reduce((sum, n) => sum + n, 0);
if (total < 2 || total > 10) return false;
const smallest = tile * ONE_ROW_SHRINK;
const tiles = counts.reduce((sum, n) => sum + n * smallest + (n - 1) * gap, 0);
const dividers = (counts.length - 1) * (gap * 3 + 1);
return tiles + dividers <= width;
}
/* Tiles across a row: as many as fit, at least 2 and at most 10
(never more than there are). If that would leave one tile alone on
the last row, one fewer across, so the last row has two: 7 that fit