Skip to content

Build your personal knowledge base with Trilium Notes

style(geomap): gather the other ways of opening a marker behind one button

Elian Doran4eeab7608acc
diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.css b/apps/client/src/widgets/collections/geomap/DetailPane.css
index 7feaa27333..88fce16105 100644
--- a/apps/client/src/widgets/collections/geomap/DetailPane.css
+++ b/apps/client/src/widgets/collections/geomap/DetailPane.css
@@ -175,30 +175,6 @@
align-items: center;
gap: 4px;
- /*
- * The two halves of the split read as the one control they are: the way in, and the arrow
- * offering the other ways.
- *
- * A button group joins its own children — squares the corners where they meet and pulls the
- * second onto the first's border — but the dropdown brings a wrapper of its own, so neither
- * rule reaches the arrow and it stands off as a rounded box of its own. Joined by hand here.
- */
- .geo-detail-pane-open {
- > .geo-detail-pane-open-note {
- border-start-end-radius: 0;
- border-end-end-radius: 0;
- }
-
- > .dropdown {
- margin-inline-start: -1px;
-
- > .btn {
- border-start-start-radius: 0;
- border-end-start-radius: 0;
- }
- }
- }
-
/* Those that write rather than read stand apart from the ones being reached for repeatedly, so
the pointer cannot land on one of them by being a moment early. The gap falls before the first
of them, which is the colour: they are drawn together or not at all, a read-only map having
diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx b/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx
index 45b45862b2..33f93e44b6 100644
--- a/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx
+++ b/apps/client/src/widgets/collections/geomap/DetailPane.spec.tsx
@@ -435,9 +435,7 @@ describe("DetailPane", () => {
try {
await openPaneFor(note, map);
- // The half of the split that is a button in its own right, the rest being behind its
- // arrow.
- container?.querySelector<HTMLButtonElement>(".geo-detail-pane-open-note")?.click();
+ press("bx-log-in");
expect(openInCurrentNoteContext).toHaveBeenCalledWith(expect.anything(), notePath);
// Latitude first, as a geo URI is written and as the map's own menu hands one over —
@@ -452,20 +450,20 @@ describe("DetailPane", () => {
});
/**
- * The rest live behind the split's arrow, and are the same ways a link offers anywhere in
+ * The rest are gathered behind one button, and are the same ways a link offers anywhere in
* the app — which is how a split view, the one worth having beside a map, comes to be
- * offered at all: the row of buttons this replaced never had one.
+ * offered at all: the three buttons this replaced never had one.
*
* The pane names them itself, the shared menu wanting an event it cannot be handed before
* anything is pressed, so what is pinned here is that the two lists stay the same list. Add
* a fifth way to open a link and this fails until the pane offers it too.
*/
- it("offers behind the split exactly the ways a link is opened anywhere else", async () => {
+ it("gathers the rest of the ways of opening it, exactly as a link offers them", async () => {
const note = buildNote({ title: "Somewhere", "#geolocation": "1,2" });
const map = fakeMap();
await openPaneFor(note, map);
- expect(container?.querySelector(".dropdown-toggle-split")).toBeTruthy();
+ expect(container?.querySelector(".geo-detail-pane-more")).toBeTruthy();
expect(OTHER_WAYS_TO_OPEN.map((way) => way.command)).toEqual(
linkContextMenu.getItems(new MouseEvent("click"))
.map((item) => ("command" in item ? item.command : undefined)));
@@ -692,7 +690,7 @@ describe("DetailPane", () => {
// The ways of reading the note stay; the one that writes it does not.
expect(pane()).toBeTruthy();
- expect(container?.querySelector(".geo-detail-pane-open-note")).toBeTruthy();
+ expect(container?.querySelector(".geo-detail-pane-actions button.bx-log-in")).toBeTruthy();
expect(removeButton()).toBeNull();
});
});
diff --git a/apps/client/src/widgets/collections/geomap/DetailPane.tsx b/apps/client/src/widgets/collections/geomap/DetailPane.tsx
index 7fe3df5c8d..0db8d7085c 100644
--- a/apps/client/src/widgets/collections/geomap/DetailPane.tsx
+++ b/apps/client/src/widgets/collections/geomap/DetailPane.tsx
@@ -17,7 +17,6 @@ import TitleRow from "../../layout/TitleRow";
import NoteDetail from "../../NoteDetail";
import PromotedAttributes from "../../PromotedAttributes";
import ActionButton from "../../react/ActionButton";
-import Button, { ButtonGroup } from "../../react/Button";
import Dropdown from "../../react/Dropdown";
import { FormListItem } from "../../react/FormList";
import { useLegacyComponentElement, useNoteColorClass, useNoteContext, useNoteLabel, useStaticTooltip } from "../../react/hooks";
@@ -353,43 +352,44 @@ function MarkerActions({ note, isReadOnly, onRelocate }: { note: FNote; isReadOn
return (
<div className="geo-detail-pane-actions">
- <ButtonGroup className="geo-detail-pane-open">
- <Button
- className="geo-detail-pane-open-note"
- // Flat, as everything else in the row is: a filled button beside five bare icons
- // reads as the one thing on the pane worth pressing, which it is not.
- kind="lowProfile"
- size="small"
- icon="bx-log-in"
- text={t("geo-map.open-note")}
- // Handed the event: `openInCurrentNoteContext` reads the target tab off the
- // element clicked, which lands the note in the tab the map is in.
- onClick={(e) => notePath && openInCurrentNoteContext(e as MouseEvent, notePath)}
- disabled={!notePath}
- />
+ <ActionButton
+ icon="bx bx-log-in"
+ text={t("geo-map.open-note")}
+ // Handed the event: `openInCurrentNoteContext` reads the target tab off the element
+ // clicked, which lands the note in the tab the map is in.
+ onClick={(e) => notePath && openInCurrentNoteContext(e as MouseEvent, notePath)}
+ disabled={!notePath}
+ />
- <Dropdown
- buttonClassName="dropdown-toggle-split tn-low-profile btn-sm"
- title={t("geo-map.more-ways-to-open")}
- noSelectButtonStyle
- noDropdownListStyle
- // The panel clips what overflows it, so a menu nested in the row would be cut off
- // at its edge; and the panel's backdrop filter would flatten the menu's own.
- portalToBody
- disabled={!notePath}
- >
- {OTHER_WAYS_TO_OPEN.map(({ command, icon, title }) => (
- <FormListItem
- key={command}
- icon={icon}
- onClick={(e) => notePath && linkContextMenu.handleLinkContextMenuItem(
- command, e as MouseEvent, notePath, {}, hoistedNoteId ?? null)}
- >
- {title()}
- </FormListItem>
- ))}
- </Dropdown>
- </ButtonGroup>
+ {/* The other ways of opening it, gathered behind one button rather than spread across
+ three: they are one act with three destinations.
+
+ A dropdown and not the menu the marker's own right-click raises — that one is shown
+ at a point and dismissed by the next press on the document, and the press that opened
+ it from inside the panel is that press. */}
+ <Dropdown
+ className="geo-detail-pane-more"
+ buttonClassName="bx bx-dots-horizontal-rounded"
+ title={t("geo-map.more-ways-to-open")}
+ iconAction
+ hideToggleArrow
+ noDropdownListStyle
+ // The panel clips what overflows it, so a menu nested in the row would be cut off at
+ // its edge; and the panel's backdrop filter would flatten the menu's own.
+ portalToBody
+ disabled={!notePath}
+ >
+ {OTHER_WAYS_TO_OPEN.map(({ command, icon, title }) => (
+ <FormListItem
+ key={command}
+ icon={icon}
+ onClick={(e) => notePath && linkContextMenu.handleLinkContextMenuItem(
+ command, e as MouseEvent, notePath, {}, hoistedNoteId ?? null)}
+ >
+ {title()}
+ </FormListItem>
+ ))}
+ </Dropdown>
<ActionButton
icon="bx bx-map-alt"