Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(options): use the shared Badge component for the conflicts badge
Elian Doran4b336ef2db31
diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.mdindex 98dd01986f..2186597155 100644--- a/.github/copilot-instructions.md+++ b/.github/copilot-instructions.md@@ -126,6 +126,7 @@ Common UI components are available in `apps/client/src/widgets/react/` — **alw- `Slider` - Range slider with label- `Checkbox`, `RadioButton` - Form controls- `CollapsibleSection` - Expandable content sections+- `Badge` - Colored pill/label with optional icon, tooltip, and `onClick` (for counts, status flags); set its color via the `--color` CSS variable on a wrapper class, not inline styles. `BadgeWithDropdown` pairs a badge with a dropdown menu**Do not use Bootstrap utility classes** (e.g. `form-control-sm`, `form-select-sm`, `input-group`) on these components — they manage their own styling internally. If you need to adjust sizing or layout, use props provided by the component or CSS custom properties, not Bootstrap overrides.diff --git a/CLAUDE.md b/CLAUDE.mdindex 6e15c1cae6..40580abd56 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -131,6 +131,7 @@ Common UI components are available in `apps/client/src/widgets/react/` — **alw- `Slider` - Range slider with label- `Checkbox`, `RadioButton` - Form controls- `CollapsibleSection` - Expandable content sections+- `Badge` - Colored pill/label with optional icon, tooltip, and `onClick` (for counts, status flags); set its color via the `--color` CSS variable on a wrapper class, not inline styles. `BadgeWithDropdown` pairs a badge with a dropdown menuFluent builder pattern: `.child()`, `.class()`, `.css()` chaining with position-based ordering.diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.css b/apps/client/src/widgets/type_widgets/options/shortcuts.cssindex 27e0015050..939383ce62 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.css+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.css@@ -25,28 +25,14 @@color: var(--link-color);}- /* Prominent pill flagging that conflicts exist; click to filter to them. */+ /* Prominent danger pill flagging that conflicts exist; click to filter to them. */.shortcut-conflicts-badge {flex: 0 0 auto;- display: inline-flex;- align-items: center;- gap: 0.35em;- border: 1px solid var(--icon-button-danger-color, #d9534f);- border-radius: 999px;- padding: 0.2em 0.7em;- font-size: 0.85em;- font-weight: 600;- white-space: nowrap;- color: var(--icon-button-danger-color, #d9534f);- background: transparent;- cursor: pointer;- transition: background-color 0.15s, color 0.15s;+ --color: var(--icon-button-danger-color, #d9534f);}- .shortcut-conflicts-badge:hover,.shortcut-conflicts-badge.active {- color: var(--main-background-color);- background: var(--icon-button-danger-color, #d9534f);+ background-color: color-mix(in srgb, var(--color) 75%, black);}}diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsxindex e6eae5939e..1b694392c5 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx@@ -12,6 +12,7 @@ import { canonicalizeShortcut, KEYCODES_WITH_NO_MODIFIER } from "../../../servicimport toast from "../../../services/toast";import { arrayEqual, isElectron, isMobile, reloadFrontendApp } from "../../../services/utils";import ActionButton from "../../react/ActionButton";+import { Badge } from "../../react/Badge";import Button from "../../react/Button";import Dropdown from "../../react/Dropdown";import { FormDropdownDivider, FormListItem } from "../../react/FormList";@@ -114,15 +115,13 @@ export default function ShortcutSettings() {currentValue={filter} onChange={(value) => setFilter(value)}/>{conflicts.size > 0 &&- <button- type="button"- class={`shortcut-conflicts-badge ${activeFilter === "conflicts" ? "active" : ""}`}- title={t("shortcuts.conflicts_badge_tooltip")}+ <Badge+ className={`shortcut-conflicts-badge ${activeFilter === "conflicts" ? "active" : ""}`}+ icon="bx bx-error-circle"+ text={t("shortcuts.conflicts_badge", { count: conflicts.size })}+ tooltip={t("shortcuts.conflicts_badge_tooltip")}onClick={() => setActiveFilter(activeFilter === "conflicts" ? null : "conflicts")}- >- <span class="bx bx-error-circle" />- {t("shortcuts.conflicts_badge", { count: conflicts.size })}- </button>}+ />}<DropdownbuttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}hideToggleArrow