import React, { FC } from "react"; import classNames from "classnames"; import { atomsStore, CurrentDashboardSectionIdAtom, leftSidebarWidthAtom, MobileSidebarOpenAtom, ModelAtom, ModelBaseAtom, sidebarEdgeOffsetAtom } from "./atoms"; import { useAtomValue } from "jotai"; import { TreeDashboardSection } from "./TreeDashboardSections"; import { useAtom } from "jotai/index"; import { EmulatedButton } from "./EmulatedButton"; import { __, CouponsPlus, hasProInstalled } from "../globals"; import { useIsMobile, useViewPortDimensionsStyle } from "./hooks"; export type TreeMenusProps = {} export const TreeMenus: FC = ({ }) => { const width = useAtomValue(leftSidebarWidthAtom) const edgeOffset = useAtomValue(sidebarEdgeOffsetAtom) const [currentSectionId, setCurrentSectionId] = useAtom(CurrentDashboardSectionIdAtom) const [isMobileSidebarOpen, setIsMobileSidebarOpen] = useAtom(MobileSidebarOpenAtom) const isMobile = useIsMobile() const { top: wpAdminBarTop, left: wpAdminMenuLeft } = useViewPortDimensionsStyle() const menuItems = [ { id: TreeDashboardSection.Offers, label: __('Offers'), icon: }, { id: TreeDashboardSection.Presets, label: __('Presets'), icon: }, { id: TreeDashboardSection.Url, label: 'URL', icon: }, { id: TreeDashboardSection.Advanced, label: __('Preferences'), icon: }, ] const handleMenuItemClick = (id: TreeDashboardSection) => { setCurrentSectionId(id) if (isMobile) { setIsMobileSidebarOpen(false) } } const sidebarContent = ( <> ) // Mobile: iOS-style bottom tab bar with frosted glass if (isMobile) { return (
{menuItems.map(item => ( ))}
) } // Desktop: Original Menus return sidebarContent }; export const switchToClassic = () => { atomsStore.set(ModelAtom, 'classic') } const switchToLegacy = () => { atomsStore.set(ModelAtom, 'rows') }