From e8158aadec7330dfecef08e5429d094f5a4deb98 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 31 Jan 2026 19:19:39 +0200 Subject: [PATCH] feat(mobile/tab_switcher): display number of tabs in launch bar --- .../src/widgets/launch_bar/launch_bar_widgets.tsx | 5 +++-- .../src/widgets/mobile_widgets/TabSwitcher.css | 14 ++++++++++++++ .../src/widgets/mobile_widgets/TabSwitcher.tsx | 9 ++++++--- apps/client/src/widgets/react/ActionButton.tsx | 11 ++++++----- 4 files changed, 29 insertions(+), 10 deletions(-) diff --git a/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx b/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx index 0cb7c9906f..bb4a053c89 100644 --- a/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx +++ b/apps/client/src/widgets/launch_bar/launch_bar_widgets.tsx @@ -1,3 +1,4 @@ +import clsx from "clsx"; import { createContext } from "preact"; import { useContext } from "preact/hooks"; @@ -18,12 +19,12 @@ export interface LauncherNoteProps { launcherNote: FNote; } -export function LaunchBarActionButton(props: Omit) { +export function LaunchBarActionButton({ className, ...props }: Omit) { const { isHorizontalLayout } = useContext(LaunchBarContext); return ( setShown(true)} + data-tab-count={mainNoteContexts.length > 99 ? "∞" : mainNoteContexts.length} /> - {createPortal(, document.body)} + {createPortal(, document.body)} ); } -function TabBarModal({ shown, setShown }: { +function TabBarModal({ mainNoteContexts, shown, setShown }: { + mainNoteContexts: NoteContext[]; shown: boolean; setShown: (newValue: boolean) => void; }) { const [ fullyShown, setFullyShown ] = useState(false); - const mainNoteContexts = useMainNoteContexts(); const selectTab = useCallback((noteContextToActivate: NoteContext) => { appContext.tabManager.activateNoteContext(noteContextToActivate.ntxId); setShown(false); diff --git a/apps/client/src/widgets/react/ActionButton.tsx b/apps/client/src/widgets/react/ActionButton.tsx index ba5430f381..feb5972ef4 100644 --- a/apps/client/src/widgets/react/ActionButton.tsx +++ b/apps/client/src/widgets/react/ActionButton.tsx @@ -1,10 +1,11 @@ -import { useEffect, useRef, useState } from "preact/hooks"; -import { CommandNames } from "../../components/app_context"; -import { useStaticTooltip } from "./hooks"; -import keyboard_actions from "../../services/keyboard_actions"; import { HTMLAttributes } from "preact"; +import { useEffect, useRef, useState } from "preact/hooks"; -export interface ActionButtonProps extends Pick, "onClick" | "onAuxClick" | "onContextMenu"> { +import { CommandNames } from "../../components/app_context"; +import keyboard_actions from "../../services/keyboard_actions"; +import { useStaticTooltip } from "./hooks"; + +export interface ActionButtonProps extends Pick, "onClick" | "onAuxClick" | "onContextMenu" | "style"> { text: string; titlePosition?: "top" | "right" | "bottom" | "left"; icon: string;