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
client/collections/board: tweak appearance
Adorian Doran346cf215ba1c
diff --git a/apps/client/src/widgets/collections/board/card_template_pill.tsx b/apps/client/src/widgets/collections/board/card_template_pill.tsxindex 0aba9cf3da..f42ce21c77 100644--- a/apps/client/src/widgets/collections/board/card_template_pill.tsx+++ b/apps/client/src/widgets/collections/board/card_template_pill.tsx@@ -3,6 +3,7 @@ import { useMemo, useState } from "preact/hooks";import { t } from "../../../services/i18n";import Dropdown from "../../react/Dropdown";import { FormListItem } from "../../react/FormList";+import Icon from "../../react/Icon";import { type NoteTypeOption } from "../../../services/note_types";/**@@ -33,9 +34,15 @@ export default function CardTemplatePill({ offered, current, onSelect, onMore, o<FormListItemkey={template.id}icon={template.icon}- active={template.id === current?.id}onClick={() => onSelect(template)}- >{template.title}</FormListItem>+ >+ {template.title}+ {/* Ticked rather than highlighted: a highlighted row reads as the one under the+ pointer. The icon each template carries stays where it is. */}+ {template.id === current?.id && (+ <Icon className="card-template-current" icon="bx bx-check" />+ )}+ </FormListItem>)), [ offered, current, onSelect ]);// The name alone stands in the pill: the field already carries the icon the card itself willdiff --git a/apps/client/src/widgets/collections/board/index.css b/apps/client/src/widgets/collections/board/index.cssindex 233fe34c5d..191356b67d 100644--- a/apps/client/src/widgets/collections/board/index.css+++ b/apps/client/src/widgets/collections/board/index.css@@ -685,6 +685,18 @@ body.mobile .board-view-container .board-add-column {color: var(--main-text-color);}+/* The menu is drawn at the end of the page, so it is named rather than nested in the board. The+ tick stands at the trailing edge, where a shortcut would. */+.tn-dropdown-portal.card-template-pill .dropdown-item {+ display: flex;+ align-items: center;+}++.tn-dropdown-portal.card-template-pill .card-template-current {+ margin-inline-start: auto;+ padding-inline-start: 1.5em;+}+.board-view-container .card-template-pill .card-template-name {overflow: hidden;text-overflow: ellipsis;diff --git a/apps/client/src/widgets/collections/board/index.spec.tsx b/apps/client/src/widgets/collections/board/index.spec.tsxindex 4d6f54c556..11ed8a17ae 100644--- a/apps/client/src/widgets/collections/board/index.spec.tsx+++ b/apps/client/src/widgets/collections/board/index.spec.tsx@@ -2230,6 +2230,10 @@ describe("Board column rename", () => {expect(items.map(item => item.textContent?.trim())).toEqual(["Text", "Markdown", "Canvas", "Spreadsheet", "board_view.more-templates"]);+ // The one a card would be made from is ticked, rather than standing out by its background.+ expect(items.map(item => !!item.querySelector(".card-template-current")))+ .toEqual([ true, false, false, false, false ]);+ expect(items.some(item => item.classList.contains("active"))).toBe(false);await act(async () => {items[2].click();@@ -2238,6 +2242,9 @@ describe("Board column rename", () => {// Stored on the board, so the next editor opens on it as well.expect(saved.at(-1)?.template).toBe("type:canvas:application/json");+ expect([ ...(menu?.querySelectorAll(".dropdown-item") ?? []) ]+ .map(item => !!item.querySelector(".card-template-current")))+ .toEqual([ false, false, true, false, false ]);await type(editor, "Drawn");await act(async () => {