import React, { useCallback, useState } from 'react' import NavLink from './navLink' import type { NavIcon } from './navLink' import AppBasic from './basic' import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints' import { AlignLeft01, AlignRight01, } from '@/app/components/base/icons/src/vender/line/layout' export type IAppDetailNavProps = { iconType?: 'app' | 'dataset' | 'notion' title: string desc: string icon: string icon_background: string navigation: Array<{ name: string href: string icon: NavIcon selectedIcon: NavIcon }> extraInfo?: React.ReactNode } const AppDetailNav = ({ title, desc, icon, icon_background, navigation, extraInfo, iconType = 'app' }: IAppDetailNavProps) => { const localeMode = localStorage.getItem('app-detail-collapse-or-expand') || 'expand' const media = useBreakpoints() const isMobile = media === MediaType.mobile const mode = isMobile ? 'collapse' : 'expand' const [modeState, setModeState] = useState(isMobile ? mode : localeMode) const expand = modeState === 'expand' const handleToggle = useCallback(() => { setModeState((prev) => { const next = prev === 'expand' ? 'collapse' : 'expand' localStorage.setItem('app-detail-collapse-or-expand', next) return next }) }, []) return (
{ !isMobile && (
{ expand ? : }
) }
) } export default React.memo(AppDetailNav)