From 5e4f529b266347220c6fa904a86ec2f0b91dbff8 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Fri, 29 Aug 2025 12:40:16 +0300 Subject: [PATCH] chore(react/global_menu): advanced submenu toggle on mobile --- apps/client/src/widgets/react/FormList.tsx | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/react/FormList.tsx b/apps/client/src/widgets/react/FormList.tsx index 7b44ad69d..fb5318631 100644 --- a/apps/client/src/widgets/react/FormList.tsx +++ b/apps/client/src/widgets/react/FormList.tsx @@ -1,10 +1,11 @@ import { Dropdown as BootstrapDropdown, Tooltip } from "bootstrap"; import { ComponentChildren } from "preact"; import Icon from "./Icon"; -import { useEffect, useMemo, useRef, type CSSProperties } from "preact/compat"; +import { useEffect, useMemo, useRef, useState, type CSSProperties } from "preact/compat"; import "./FormList.css"; import { CommandNames } from "../../components/app_context"; import { useStaticTooltip } from "./hooks"; +import { isMobile } from "../../services/utils"; interface FormListOpts { children: ComponentChildren; @@ -145,14 +146,25 @@ export function FormDropdownDivider() { } export function FormDropdownSubmenu({ icon, title, children }: { icon: string, title: ComponentChildren, children: ComponentChildren }) { + const [ openOnMobile, setOpenOnMobile ] = useState(false); + return ( -
  • - +
  • + { + e.stopPropagation(); + + if (isMobile()) { + setOpenOnMobile(!openOnMobile); + } + }} + > {title} -