Skip to content

Build your personal knowledge base with Trilium Notes

fix(attributes): give a phone its cards back and let the selection bar stand on top

Elian Doran596133e27efa
diff --git a/apps/client/src/widgets/dialogs/note_attributes.css b/apps/client/src/widgets/dialogs/note_attributes.css
index c8cb9376cb..93de86c108 100644
--- a/apps/client/src/widgets/dialogs/note_attributes.css
+++ b/apps/client/src/widgets/dialogs/note_attributes.css
@@ -111,6 +111,15 @@ body.mobile .modal.note-attributes-modal {
min-width: 0;
padding: 0;
+ /* Nor a menu's standing above the app. `body.mobile .dropdown-menu` lifts every menu to 3000
+ so that one opening floats over everything; this list opens over nothing, it sits in a
+ card. The rule that un-fixes its position (`body.mobile .modal-dialog .dropdown-menu`)
+ leaves that 3000 behind, and it does not lie idle as it would on any ordinary static box:
+ the list is a flex item of the panel, and a flex item takes its z-index whether it is
+ positioned or not. So the rows stood at 3000 and the selection's bar — a sticky 1 — was
+ drawn underneath them, which is what a row scrolling past it looked like it was doing. */
+ z-index: auto !important;
+
/* The card is the surface now, so the rows keep only what tells them apart from one another: the
dividers between them, and whatever a row is being pressed or read in. */
.attribute-row {
diff --git a/apps/client/src/widgets/sidebar/AttributeList.css b/apps/client/src/widgets/sidebar/AttributeList.css
index 039e9507ef..9edd1b2116 100644
--- a/apps/client/src/widgets/sidebar/AttributeList.css
+++ b/apps/client/src/widgets/sidebar/AttributeList.css
@@ -142,14 +142,21 @@
/* The glyph the checkbox stands in for — badge and all, which would otherwise hang off its corner
saying something about an attribute that is not what the checkbox is asking. Hidden rather than
- left out, so the slot keeps the width the icon gave it. */
-.attribute-list-panel .attribute-row:hover .attribute-kind > .tn-icon,
-.attribute-list-panel.selecting .attribute-kind > .tn-icon {
+ left out, so the slot keeps the width the icon gave it.
+
+ Only where there is a checkbox to stand in for it, which is a pointer's rows: a phone marks a
+ picked row by turning its icon into a check (see AttributeRow), so its unpicked rows keep theirs
+ — and would otherwise be stripped of a badge that says the attribute is Trilium's own or its
+ field promoted, neither of which the picking is about. The wrapper holding the icon is what
+ these are about; on a phone the icon is itself `.attribute-kind`, hence the `.tn-icon` it always
+ carries telling the two apart. */
+.attribute-list-panel .attribute-row:hover .attribute-kind:not(.tn-icon) > .tn-icon,
+.attribute-list-panel.selecting .attribute-kind:not(.tn-icon) > .tn-icon {
visibility: hidden;
}
-.attribute-list-panel .attribute-row:hover .attribute-kind::after,
-.attribute-list-panel.selecting .attribute-kind::after {
+.attribute-list-panel .attribute-row:hover .attribute-kind:not(.tn-icon)::after,
+.attribute-list-panel.selecting .attribute-kind:not(.tn-icon)::after {
display: none;
}
@@ -197,6 +204,15 @@
var(--card-background-color, var(--accented-background-color)));
}
+/* The same island over a ground that is already carrying that wash. Where a run is a card of its own
+ — a phone (see AttributeSection) — the card paints exactly the fill composited above, so the bar
+ mixed to the card's own colour and disappeared into it, leaving its border to do all the work. The
+ plain surface instead, which is what those cards are washed over: the island reads as lifted off
+ them rather than as one more of them. */
+body.mobile .attribute-selection-bar {
+ background-image: none;
+}
+
.attribute-selection-bar .attribute-selection-count {
/* Pushes the buttons to the trailing edge, where the values read from. */
margin-inline-end: auto;
@@ -288,6 +304,22 @@
of what the run is called, not as a column of its own. Sized and worn as the note tree wears the
count of a node's hidden children (see note_tree.css) — the same wash, a shade of the ink over the
page rather than a colour, and small enough to be answered rather than announced. */
+/* The same figure where a run is a card of its own rather than a heading of one — a phone (see
+ AttributeSection). Scoped by its own class rather than by the panel: the heading it sits in is the
+ card's, which stands outside the list. The card's name is set uppercase and letter-spaced, neither
+ of which a number takes any part in. */
+.attribute-run-count {
+ margin-inline-start: 6px;
+ padding: 0.1em 0.5em;
+ border-radius: 0.5em;
+ color: var(--muted-text-color);
+ font-size: 0.7rem;
+ font-weight: normal;
+ letter-spacing: 0;
+ text-transform: none;
+ vertical-align: middle;
+}
+
.attribute-list-panel .attribute-group-count {
flex-shrink: 0;
/* The heading's own gap sets it off; the base badge's margin would set it adrift of the name. */
diff --git a/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx
new file mode 100644
index 0000000000..ef1386ebc0
--- /dev/null
+++ b/apps/client/src/widgets/sidebar/AttributeList.mobile.spec.tsx
@@ -0,0 +1,175 @@
+import { render } from "preact";
+import { act } from "preact/test-utils";
+import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
+
+import FNote from "../../entities/fnote";
+
+// What this file is for: the panel draws its runs one way for a pointer and another for a thumb, and
+// the device is read once at module load (see `IS_MOBILE`), so the two cannot be told apart within a
+// single file. Everything else about the panel is covered against a pointer in AttributeList.spec.
+vi.mock("../../services/utils", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../../services/utils")>()),
+ isMobile: () => true
+}));
+
+const shownNote = vi.hoisted(() => ({ current: null as FNote | null }));
+vi.mock("../react/hooks", async (importOriginal) => ({
+ ...(await importOriginal<typeof import("../react/hooks")>()),
+ useActiveNoteContext: () => ({ note: shownNote.current })
+}));
+
+const showContextMenu = vi.hoisted(() => vi.fn(async () => {}));
+vi.mock("../../menus/context_menu", () => ({ default: { show: showContextMenu } }));
+vi.mock("../../services/dialog", () => ({ default: { confirm: vi.fn(async () => true) } }));
+vi.mock("../../services/toast", () => ({ default: { showMessage: vi.fn(), showError: vi.fn() } }));
+
+import FAttribute, { FAttributeRow } from "../../entities/fattribute";
+import froca from "../../services/froca";
+import noteAttributeCache from "../../services/note_attribute_cache";
+import options from "../../services/options";
+import server from "../../services/server";
+import { buildNote } from "../../test/easy-froca";
+import AttributeList from "./AttributeList";
+
+describe("AttributeList on a phone", () => {
+ let container: HTMLElement;
+
+ beforeEach(() => {
+ vi.clearAllMocks();
+ options.set("rightPaneCollapsedItems", "[]");
+ server.put = (async () => ({})) as unknown as typeof server.put;
+ server.post = (async () => ({ results: [], count: 0 })) as unknown as typeof server.post;
+ container = document.createElement("div");
+ document.body.appendChild(container);
+ });
+
+ afterEach(() => {
+ render(null, container);
+ container.remove();
+ vi.useRealTimers();
+ });
+
+ it("draws a card per run rather than the tree a pointer gets", () => {
+ renderPanel(noteWithRuns());
+
+ // A card each, as the panel had before its runs became headings of one card: the tree that
+ // gathers them is a pointer's affordance — hairlines, hover, a fold — drawn for a pane a hand
+ // wide, and a phone has neither the pointer nor the want of room.
+ expect(container.querySelectorAll(".attribute-group")).toHaveLength(0);
+ expect(container.querySelectorAll(".attribute-group-header")).toHaveLength(0);
+ expect(sectionIds()).toEqual([ "attributes-owned", "attributes-inherited", "attributes-definitions" ]);
+
+ // Each card names its run and counts it beside the name, as the headings do on a desktop.
+ expect(section("attributes-owned").querySelector(".attribute-run-count")?.textContent).toBe("2");
+ expect(section("attributes-definitions").querySelector(".attribute-run-count")?.textContent).toBe("2");
+
+ // The rows themselves are unchanged — menu items, which is what a phone's lists are made of.
+ expect(namesIn(section("attributes-owned"))).toEqual([ "author", "template" ]);
+ expect(section("attributes-owned").querySelector(".attribute-row")?.className).toContain("dropdown-item");
+ });
+
+ it("keeps the ways in on the cards' own headers, there being no row to hover for one", () => {
+ renderPanel(noteWithRuns());
+
+ // The panel's own two ride on the first card, there being no header above the cards; the
+ // menu is also the only way to a relation here, whose creation editor is a pointer's.
+ expect(iconsIn(header("attributes-owned"))).toEqual([ "bx bx-help-circle", "bx bx-plus" ]);
+ // A run that can be added to says so in its own header, definitions included; one that
+ // cannot — the inherited, which are another note's — says nothing.
+ expect(iconsIn(header("attributes-definitions"))).toEqual([ "bx bx-plus" ]);
+ expect(iconsIn(header("attributes-inherited"))).toEqual([]);
+
+ // The ghost row at the foot of a run is a hover affordance, so it stays on the desktop.
+ expect(container.querySelector(".attribute-add-row")).toBeNull();
+ });
+
+ it("still picks rows out, by the press held down, and says what can be done with them", () => {
+ vi.useFakeTimers();
+ renderPanel(noteWithRuns());
+
+ const row = section("attributes-owned").querySelector(".attribute-row");
+ act(() => {
+ row?.dispatchEvent(new Event("touchstart", { bubbles: true }));
+ });
+ // Held long enough, the press picks the row out rather than opening it.
+ act(() => void vi.advanceTimersByTime(600));
+
+ expect(row?.className).toContain("selected");
+ // The mark a menu item is checked with, in the slot the kind icon holds — a phone has no
+ // checkbox to put there.
+ expect(row?.querySelector(".bx-check")).not.toBeNull();
+ expect(container.querySelector(".attribute-list-panel")?.className).toContain("selecting");
+
+ // The bar stands after the cards, the rows it acts on being picked out among any of them.
+ const bar = container.querySelector(".attribute-selection-bar");
+ expect(bar).not.toBeNull();
+ expect(iconsIn(bar)).toEqual([ "bx bx-copy", "bx bx-trash", "bx bx-x" ]);
+ expect(bar?.compareDocumentPosition(section("attributes-definitions")))
+ .toBe(Node.DOCUMENT_POSITION_PRECEDING);
+ });
+
+ function renderPanel(note: FNote) {
+ shownNote.current = note;
+ act(() => render(<AttributeList />, container));
+ }
+
+ function sectionIds() {
+ return [ ...container.querySelectorAll(".options-section") ]
+ .map((el) => [ ...el.classList ].find((name) => name.startsWith("attributes-")));
+ }
+
+ function section(id: string) {
+ const el = container.querySelector<HTMLElement>(`.options-section.${id}`);
+ expect(el, id).not.toBeNull();
+ return el as HTMLElement;
+ }
+
+ function header(id: string) {
+ return section(id).querySelector<HTMLElement>(".options-section-header");
+ }
+});
+
+function namesIn(root: Element) {
+ return [ ...root.querySelectorAll(".attribute-name") ].map((name) => name.textContent);
+}
+
+/** The icons a header (or the selection bar) offers, which is what its buttons are known by: the
+ * titles are translated, and translations stay unloaded in these tests. */
+function iconsIn(root: Element | null) {
+ return [ ...(root?.querySelectorAll(".bx") ?? []) ]
+ .map((icon) => [ ...icon.classList ].filter((name) => name.startsWith("bx")).join(" "));
+}
+
+/** A note with all three of the runs a phone can be shown, each holding more than one row. */
+function noteWithRuns() {
+ buildNote({ id: "tpl", title: "Template" });
+ const note = buildNote({
+ id: "phone-subject",
+ title: "Subject",
+ "#author": "Elian",
+ "~template": "tpl",
+ "#label:priority": "promoted,single,date"
+ });
+
+ noteAttributeCache.attributes[note.noteId] = [
+ ...note.getOwnedAttributes(),
+ inherited({ name: "inheritedLabel", value: "x" }),
+ inherited({ name: "archived", value: "" }),
+ inherited({ name: "label:status", value: "promoted,multi" })
+ ];
+
+ return note;
+}
+
+function inherited(row: Partial<FAttributeRow>) {
+ return new FAttribute(froca, {
+ attributeId: `inh-${row.name}`,
+ noteId: "tpl",
+ type: "label",
+ name: "",
+ value: "",
+ position: 0,
+ isInheritable: true,
+ ...row
+ } as FAttributeRow);
+}
diff --git a/apps/client/src/widgets/sidebar/AttributeList.tsx b/apps/client/src/widgets/sidebar/AttributeList.tsx
index 06a7a7ef00..ee669d3bd4 100644
--- a/apps/client/src/widgets/sidebar/AttributeList.tsx
+++ b/apps/client/src/widgets/sidebar/AttributeList.tsx
@@ -662,12 +662,138 @@ export default function AttributeList() {
onSaveAndClose: detail?.isOwned ? commit : undefined,
onDelete: detail?.isOwned ? () => void deleteAttribute(detail.attribute) : undefined
};
- const sectionList = (
- // One card holding the lot, the sections being headings within it rather than cards of their
- // own: they are one list to the eye and one list to a selection — a range runs from any row to
- // any other — and four headers is a great deal of a hand-wide pane to spend on saying which
- // run is which. It also leaves the selection's own bar somewhere to belong: a bar at the foot
- // of one card among several belonged to a card the picked rows need not have been in at all.
+ // The runs the panel is made of, in the order it draws them — the same runs either way it is
+ // drawn (see below), so what a run is and what it holds is settled in one place.
+ const runs: AttributeRun[] = [ {
+ id: "attributes-owned",
+ title: t("attribute_list_panel.section_owned"),
+ count: sections.owned.length,
+ // The note's own values read from the trailing edge, as the inherited ones' do — the two
+ // runs of plain attributes reading as one ledger. Nothing stands in for the run holding
+ // nothing: its count says it is empty and its way in says what there is to do about it.
+ rows: <AttributeRowList rows={sections.owned} alignValuesEnd {...rowProps} />,
+ add: { kind: "label", text: t("attribute_list_panel.add_attribute") }
+ } ];
+
+ if (sections.inherited.length > 0) {
+ runs.push({
+ id: "attributes-inherited",
+ title: t("attribute_list_panel.section_inherited"),
+ count: sections.inherited.length,
+ rows: <AttributeRowList rows={sections.inherited} alignValuesEnd {...rowProps} />
+ });
+ }
+
+ if (sections.definitions.length > 0) {
+ runs.push({
+ id: "attributes-definitions",
+ title: t("attribute_list_panel.section_definitions"),
+ count: sections.definitions.length,
+ // The definitions keep prose order: their "value" is a summary of settings rather than a
+ // value, so there is no column of values for it to line up in.
+ rows: <AttributeRowList rows={sections.definitions} {...rowProps} />,
+ add: { kind: "label-definition", text: t("attribute_list_panel.add_definition") }
+ });
+ }
+
+ if (internalRows.length > 0) {
+ runs.push({
+ id: "attributes-internal",
+ title: t("attribute_list_panel.section_internal"),
+ count: internalRows.length,
+ rows: <AttributeRowList rows={internalRows} readOnly {...rowProps} />
+ });
+ }
+
+ // At the foot of the runs, the rows it acts on being picked out anywhere among them. It holds
+ // there while they are scrolled (see the stylesheet), so it is the one thing both ways of
+ // drawing them share: a phone picks rows out by holding one down, a pointer by the checkbox or
+ // a modifier, and either way what can be done about it is said in the one place.
+ const selectionBar = note && isSelecting && (
+ <AttributeSelectionBar
+ count={selection.size}
+ canDelete={selectedAttributes().every((candidate) => owned.current.includes(candidate))}
+ canPaste={getHeldAttributes().length > 0}
+ onCopy={() => void copyPickedAttributes(selectedAttributes())}
+ onPaste={() => void applyPaste(getHeldAttributes())}
+ onDelete={() => void deleteSelection(selectedAttributes())}
+ onClear={clearSelection}
+ />
+ );
+
+ // Presses inside a run do not dismiss the popup (see `parent` above), which leaves closing on a
+ // press next to a row up to this handler. A run is also what the note's own attributes are pasted
+ // onto, so it offers pasting beside its rows as well as on them.
+ const panelProps = {
+ onClick: commit,
+ onContextMenu: showPanelMenu,
+ ...clipboardProps
+ };
+
+ const sectionList = IS_MOBILE ? (
+ // A card each, as the panel had before its runs became headings of one card. What made them
+ // headings was a pane a hand wide, where four card headers were a great deal of it to spend
+ // on saying which run is which — and the tree that gathered them was drawn for a pointer, in
+ // hairlines and hover. A phone has neither: the panel is a sheet the width of the screen,
+ // which has the room, and the card is already how everything else on it says that things
+ // belong together (see the settings pages). So the runs are cards again here, and the tree
+ // is left to the pane that needed it.
+ <>
+ {runs.map((run, index) => (
+ <AttributeSection
+ key={run.id}
+ id={run.id}
+ title={run.title}
+ count={run.count}
+ buttons={note && (index === 0 ? (
+ // The panel's own two ride on the first card: there is no header above the
+ // cards to put them in, and the note's own attributes are what the panel is
+ // opened for. The menu is also the only way to a relation on a phone, whose
+ // rows are pressed rather than typed into — hence every kind, not just this
+ // run's.
+ <>
+ <HelpButton helpPage={ATTRIBUTE_HELP_PAGE} />
+ <AddAttributeButton
+ text={t("attribute_editor.add_a_new_attribute")}
+ attrTypes={ALL_ATTRIBUTE_KINDS}
+ onSelect={addAttribute}
+ />
+ </>
+ ) : run.add && (
+ // A run that can be added to says so in its own header, which is where a
+ // card keeps what is done to it. The ghost row a pointer gets is a hover
+ // affordance, so it stays on the desktop.
+ <ActionButton
+ icon="bx bx-plus"
+ text={run.add.text}
+ onClick={(e) => {
+ e.stopPropagation();
+ addAttribute(run.add?.kind ?? "label", e);
+ }}
+ />
+ ))}
+ >
+ <div
+ class={clsx("attribute-list-panel", isSelecting && "selecting")}
+ // The popup anchors to the panel, and the first card is the one it is
+ // opened over: the note's own attributes are what it edits.
+ ref={index === 0 ? containerRef : undefined}
+ {...panelProps}
+ >
+ {run.rows}
+ </div>
+ </AttributeSection>
+ ))}
+
+ {selectionBar}
+ </>
+ ) : (
+ // One card holding the lot, the runs being headings within it rather than cards of their
+ // own: they are one list to the eye and one list to a selection — a range runs from any row
+ // to any other — and four headers is a great deal of a hand-wide pane to spend on saying
+ // which run is which. It also leaves the selection's own bar somewhere to belong: a bar at
+ // the foot of one card among several belonged to a card the picked rows need not have been
+ // in at all.
//
// Collapsing moves to the headings with it. The card cannot be collapsed away, being all its
// tab has (see RightPanelWidget), which is what the context below says.
@@ -687,92 +813,27 @@ export default function AttributeList() {
</>
)}
>
- {/* Presses inside the list do not dismiss the popup (see `parent` above), which leaves
- closing on a press next to a row up to this handler. The whole list is what the
- note's own attributes are pasted onto, so it offers pasting beside its rows too. */}
<div
class={clsx("attribute-list-panel", isSelecting && "selecting")}
ref={containerRef}
- onClick={commit}
- onContextMenu={showPanelMenu}
- {...clipboardProps}
+ {...panelProps}
>
- {/* A heading of their own, as every other run has: the card names the panel
- rather than this run, so without one the note's own attributes read as
- belonging to no run at all. Their values read from the trailing edge, as the
- inherited ones' do — the two runs of plain attributes reading as one ledger. */}
- <AttributeGroup
- id="attributes-owned"
- title={t("attribute_list_panel.section_owned")}
- count={sections.owned.length}
- >
- {/* Nothing stands in for a run holding nothing: the heading's count says it
- is empty and the add row below says what there is to do about it, so a
- "no attributes" of any size would be the third telling of one fact. */}
- <AttributeRowList rows={sections.owned} alignValuesEnd {...rowProps} />
-
- {/* Inside the run it adds to rather than at the foot of everything, and put
- away with it. A phone adds from the header, page flow and all. */}
- {!IS_MOBILE && note && (
- <AddAttributeRow
- text={t("attribute_list_panel.add_attribute")}
- onAdd={(e) => addAttribute("label", e)}
- />
- )}
- </AttributeGroup>
-
- {sections.inherited.length > 0 && (
- <AttributeGroup
- id="attributes-inherited"
- title={t("attribute_list_panel.section_inherited")}
- count={sections.inherited.length}
- >
- <AttributeRowList rows={sections.inherited} alignValuesEnd {...rowProps} />
- </AttributeGroup>
- )}
+ {runs.map((run) => (
+ <AttributeGroup key={run.id} id={run.id} title={run.title} count={run.count}>
+ {run.rows}
- {sections.definitions.length > 0 && (
- // The definitions keep prose order: their "value" is a summary of settings
- // rather than a value, so there is no column of values for it to line up in.
- <AttributeGroup
- id="attributes-definitions"
- title={t("attribute_list_panel.section_definitions")}
- count={sections.definitions.length}
- >
- <AttributeRowList rows={sections.definitions} {...rowProps} />
-
- {!IS_MOBILE && note && (
+ {/* Inside the run it adds to rather than at the foot of everything, and
+ put away with it. */}
+ {run.add && note && (
<AddAttributeRow
- text={t("attribute_list_panel.add_definition")}
- onAdd={(e) => addAttribute("label-definition", e)}
+ text={run.add.text}
+ onAdd={(e) => addAttribute(run.add?.kind ?? "label", e)}
/>
)}
</AttributeGroup>
- )}
-
- {internalRows.length > 0 && (
- <AttributeGroup
- id="attributes-internal"
- title={t("attribute_list_panel.section_internal")}
- count={internalRows.length}
- >
- <AttributeRowList rows={internalRows} readOnly {...rowProps} />
- </AttributeGroup>
- )}
+ ))}
- {/* At the foot of the whole list, the rows it acts on being picked out anywhere
- in it. It holds there while the list is scrolled (see the stylesheet). */}
- {note && isSelecting && (
- <AttributeSelectionBar
- count={selection.size}
- canDelete={selectedAttributes().every((candidate) => owned.current.includes(candidate))}
- canPaste={getHeldAttributes().length > 0}
- onCopy={() => void copyPickedAttributes(selectedAttributes())}
- onPaste={() => void applyPaste(getHeldAttributes())}
- onDelete={() => void deleteSelection(selectedAttributes())}
- onClear={clearSelection}
- />
- )}
+ {selectionBar}
</div>
</AttributeSection>
</CollapsibleWidgets.Provider>
@@ -817,10 +878,31 @@ export default function AttributeList() {
);
}
+/**
+ * One run of the panel — a heading with its rows on a desktop, a card of its own on a phone. Held
+ * apart from either so that what the runs are, and which of them the note has at all, is settled
+ * once rather than twice over.
+ */
+interface AttributeRun {
+ /** What the run is known by: a class on it, and what a collapsed run is remembered under. */
+ id: string;
+ title: string;
+ count: number;
+ rows: ComponentChildren;
+ /** How the run is added to, for the runs that can be — the kind, and what to call adding it. */
+ add?: { kind: AttributeKind; text: string };
+}
+
interface AttributeSectionProps {
/** What the right pane remembers the section by, collapsed state and all. */
id: string;
title: string;
+ /**
+ * How many rows the section holds, where it stands for one run. A phone puts it beside the name
+ * in the card's own heading, the runs being cards there; the right pane's card names the whole
+ * panel and leaves counting to the headings within it.
+ */
+ count?: number;
children: ComponentChildren;
buttons?: ComponentChildren;
/** Passed on to {@link RightPanelWidget}, which is the only host that has room to give. */
@@ -832,11 +914,26 @@ interface AttributeSectionProps {
* a desktop, foldable and remembered as folded; the same card the settings pages are built from on a
* phone, where the panel is a page of its own and a title is read rather than pressed.
*/
-function AttributeSection({ id, title, children, buttons, grow }: AttributeSectionProps) {
+function AttributeSection({ id, title, count, children, buttons, grow }: AttributeSectionProps) {
if (IS_MOBILE) {
// The id names the section here too, as a class: it is what the right pane knows the section by,
// and there is no reason for a stylesheet (or a test) to know it by anything else.
- return <OptionsSection className={id} title={title} actions={buttons}>{children}</OptionsSection>;
+ return (
+ <OptionsSection
+ className={id}
+ title={
+ <>
+ {title}
+ {/* The figure the desktop headings wear, in a heading that is uppercase and
+ letter-spaced — which a number takes no part in (see the stylesheet). */}
+ {count !== undefined && <SimpleBadge className="attribute-run-count" title={count} />}
+ </>
+ }
+ actions={buttons}
+ >
+ {children}
+ </OptionsSection>
+ );
}
return (