From 1480d79a75ad8ef99c0ad18a1b96f3c2f570ad13 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 19 Jan 2025 20:19:21 +0200 Subject: [PATCH] chore(client/ts): port left_pane_toggle --- src/public/app/components/app_context.ts | 2 ++ .../buttons/{left_pane_toggle.js => left_pane_toggle.ts} | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) rename src/public/app/widgets/buttons/{left_pane_toggle.js => left_pane_toggle.ts} (86%) diff --git a/src/public/app/components/app_context.ts b/src/public/app/components/app_context.ts index 80ca032d0..833c96d1c 100644 --- a/src/public/app/components/app_context.ts +++ b/src/public/app/components/app_context.ts @@ -102,6 +102,8 @@ export type CommandMappings = { openNoteInNewTab: CommandData; openNoteInNewSplit: CommandData; openNoteInNewWindow: CommandData; + hideLeftPane: CommandData; + showLeftPane: CommandData; openInTab: ContextMenuCommandData; openNoteInSplit: ContextMenuCommandData; diff --git a/src/public/app/widgets/buttons/left_pane_toggle.js b/src/public/app/widgets/buttons/left_pane_toggle.ts similarity index 86% rename from src/public/app/widgets/buttons/left_pane_toggle.js rename to src/public/app/widgets/buttons/left_pane_toggle.ts index a5bf2d37e..f8869ad13 100644 --- a/src/public/app/widgets/buttons/left_pane_toggle.js +++ b/src/public/app/widgets/buttons/left_pane_toggle.ts @@ -2,9 +2,11 @@ import options from "../../services/options.js"; import splitService from "../../services/resizer.js"; import CommandButtonWidget from "./command_button.js"; import { t } from "../../services/i18n.js"; +import type { EventData } from "../../components/app_context.js"; export default class LeftPaneToggleWidget extends CommandButtonWidget { - constructor(isHorizontalLayout) { + + constructor(isHorizontalLayout: boolean) { super(); this.class(isHorizontalLayout ? "toggle-button" : "launcher-button"); @@ -32,7 +34,7 @@ export default class LeftPaneToggleWidget extends CommandButtonWidget { splitService.setupLeftPaneResizer(options.is("leftPaneVisible")); } - entitiesReloadedEvent({ loadResults }) { + entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) { if (loadResults.isOptionReloaded("leftPaneVisible")) { this.refreshIcon(); }