mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 19:06:51 +08:00
feat: 增加可选性隐藏功能
- 目前可以隐藏 侧边栏,导航栏,发布按钮
This commit is contained in:
@@ -9,6 +9,7 @@ import DatasetInfo from './dataset-info'
|
||||
import useBreakpoints, { MediaType } from '@/hooks/use-breakpoints'
|
||||
import { useStore as useAppStore } from '@/app/components/app/store'
|
||||
import cn from '@/utils/classnames'
|
||||
import { useSearchParams } from 'next/navigation'
|
||||
|
||||
export type IAppDetailNavProps = {
|
||||
iconType?: 'app' | 'dataset' | 'notion'
|
||||
@@ -29,7 +30,7 @@ export type IAppDetailNavProps = {
|
||||
const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigation, extraInfo, iconType = 'app' }: IAppDetailNavProps) => {
|
||||
const { appSidebarExpand, setAppSiderbarExpand } = useAppStore(useShallow(state => ({
|
||||
appSidebarExpand: state.appSidebarExpand,
|
||||
setAppSiderbarExpand: state.setAppSiderbarExpand,
|
||||
setAppSiderbarExpand: state.setAppSiderbarExpand,
|
||||
})))
|
||||
const media = useBreakpoints()
|
||||
const isMobile = media === MediaType.mobile
|
||||
@@ -46,6 +47,15 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati
|
||||
}
|
||||
}, [appSidebarExpand, setAppSiderbarExpand])
|
||||
|
||||
const searchParams = useSearchParams()
|
||||
|
||||
// 从 router 查询参数,若有 sidebar选项,按照参数设置,没有的话,默认是展示内容
|
||||
const showSidebar = !(searchParams?.get('sidebar')) || (searchParams?.get('sidebar') === '1')
|
||||
|
||||
// console.log('searchParams?.get("sidebar"): ', searchParams?.get('sidebar'),!(searchParams?.get('sidebar')) , (searchParams?.get('sidebar') === '1'))
|
||||
// console.log('showSidebar: ', showSidebar)
|
||||
// 如果showSidebar为false,不显示
|
||||
if (!showSidebar) return null;
|
||||
return (
|
||||
<div
|
||||
className={`
|
||||
|
||||
Reference in New Issue
Block a user