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
feat(options): declutter shortcuts header
Elian Doran9454c5cf5065
diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.jsonindex e1845f8e7c..3b166e3f04 100644--- a/apps/client/src/translations/en/translation.json+++ b/apps/client/src/translations/en/translation.json@@ -1722,8 +1722,8 @@"shortcuts": {"keyboard_shortcuts": "Keyboard Shortcuts","type_text_to_filter": "Type text to filter shortcuts...",- "reload_app": "Reload app to apply changes",- "set_all_to_default": "Set all shortcuts to the default",+ "reload_app": "Reload app",+ "set_all_to_default": "Reset all","confirm_reset": "Do you really want to reset all keyboard shortcuts to the default?","no_results": "No shortcuts found matching '{{filter}}'","modified_from_default": "This shortcut has been changed from its default.",diff --git a/apps/client/src/widgets/dialogs/OptionsDialog.css b/apps/client/src/widgets/dialogs/OptionsDialog.cssindex 90a29c692d..71cf137228 100644--- a/apps/client/src/widgets/dialogs/OptionsDialog.css+++ b/apps/client/src/widgets/dialogs/OptionsDialog.css@@ -37,13 +37,6 @@ body.desktop .modal.options-dialog .modal-main > .modal-header {margin: auto;}-/* Push the page content below the floating header. The variable is also read by the theme- (theme-next/pages.css) and zeroed on pages that manage their own spacing (e.g. shortcuts). */-body.desktop .modal.options-dialog .note-detail-content-widget-content.options {- --options-first-item-top-margin: 60px;- padding-top: var(--options-first-item-top-margin);-}-/* The dialog fills the full mobile page (isFullPageOnMobile), so the body stretches instead ofusing the fixed desktop height. Applies to both the master-detail and the tablet layout. */body.mobile .modal.options-dialog .modal-body {diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.css b/apps/client/src/widgets/type_widgets/options/shortcuts.cssindex db5073b3b1..79d5d1a45f 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.css+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.css@@ -9,13 +9,26 @@border-bottom: 1px solid var(--main-border-color);margin-bottom: 1em;display: flex;- align-items: center;+ flex-direction: column;gap: 1em;- > :first-child {- flex: 1;+ .shortcut-header-row {+ display: flex;+ align-items: center;+ gap: 0.5em;++ &:first-of-type {+ margin-inline-end: 3em;+ justify-content: flex-end;+ }++ /* Search row (last): the search box grows so the filter button sits at the trailing edge. */+ &.shortcut-header-row:last-child > :first-child {+ flex: 1;+ }}+.dropdown {flex: 0 0 auto;}@@ -25,9 +38,11 @@color: var(--link-color);}- /* Prominent danger badge flagging that conflicts exist; click to filter to them. */+ /* Prominent danger badge flagging that conflicts exist; click to filter to them.+ Pushed to the trailing edge of the second row, away from the buttons. */.shortcut-conflicts-badge {flex: 0 0 auto;+ margin-inline-end: auto;--color: var(--icon-button-danger-color, #d9534f);}@@ -38,18 +53,6 @@}}- > footer {- position: sticky;- bottom: 0;- left: 0;- right: 0;- background: var(--main-background-color);- padding-block: 0.5em;- border-top: 1px solid var(--main-border-color);- display: flex;- justify-content: space-between;- }-.shortcut-modified-indicator {display: inline-block;width: 0.5em;diff --git a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx b/apps/client/src/widgets/type_widgets/options/shortcuts.tsxindex d4a78c9146..6aa817ffd1 100644--- a/apps/client/src/widgets/type_widgets/options/shortcuts.tsx+++ b/apps/client/src/widgets/type_widgets/options/shortcuts.tsx@@ -107,37 +107,51 @@ export default function ShortcutSettings() {return (<div className="shortcuts-options-section"><header>- <FormTextBox- placeholder={t("shortcuts.type_text_to_filter")}- currentValue={filter} onChange={(value) => setFilter(value)}- />- {conflicts.size > 0 &&- <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")}- outline- onClick={() => setActiveFilter(activeFilter === "conflicts" ? null : "conflicts")}- />}- <Dropdown- buttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}- hideToggleArrow- noSelectButtonStyle- noDropdownListStyle- iconAction- title={t("shortcuts.filter")}- dropdownRef={filterDropdownRef}- dropdownContainerClassName={isMobile() ? "mobile-bottom-menu" : undefined}- >- <FilterContent- activeFilter={activeFilter}- onSelect={selectFilter}- conflictCount={conflicts.size}- globalCount={globalCount}- modifiedCount={modifiedCount}+ <div class="shortcut-header-row">+ {conflicts.size > 0 &&+ <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")}+ outline+ onClick={() => setActiveFilter(activeFilter === "conflicts" ? null : "conflicts")}+ />}+ <Button+ text={t("shortcuts.reload_app")}+ onClick={reloadFrontendApp}+ size="micro"+ />+ <Button+ text={t("shortcuts.set_all_to_default")}+ onClick={resetShortcuts}+ size="micro"+ />+ </div>+ <div class="shortcut-header-row">+ <FormTextBox+ placeholder={t("shortcuts.type_text_to_filter")}+ currentValue={filter} onChange={(value) => setFilter(value)}/>- </Dropdown>+ <Dropdown+ buttonClassName={`bx bx-filter-alt ${activeFilter ? "active" : ""}`}+ hideToggleArrow+ noSelectButtonStyle+ noDropdownListStyle+ iconAction+ title={t("shortcuts.filter")}+ dropdownRef={filterDropdownRef}+ dropdownContainerClassName={isMobile() ? "mobile-bottom-menu" : undefined}+ >+ <FilterContent+ activeFilter={activeFilter}+ onSelect={selectFilter}+ conflictCount={conflicts.size}+ globalCount={globalCount}+ modifiedCount={modifiedCount}+ />+ </Dropdown>+ </div></header>{filteredGroups.length > 0@@ -168,18 +182,6 @@ export default function ShortcutSettings() {text={t("shortcuts.no_matches")}/>)}-- <footer>- <Button- text={t("shortcuts.reload_app")}- onClick={reloadFrontendApp}- />-- <Button- text={t("shortcuts.set_all_to_default")}- onClick={resetShortcuts}- />- </footer></div>);}