diff --git a/web/app/components/app-sidebar/index.tsx b/web/app/components/app-sidebar/index.tsx index 67ede5110..65e35b78a 100644 --- a/web/app/components/app-sidebar/index.tsx +++ b/web/app/components/app-sidebar/index.tsx @@ -1,15 +1,15 @@ import React, { useEffect } from 'react' import { useShallow } from 'zustand/react/shallow' -import { RiLayoutRight2Line } from '@remixicon/react' -import { LayoutRight2LineMod } from '../base/icons/src/public/knowledge' -import NavLink from './navLink' +import { RiLayoutLeft2Line, RiLayoutRight2Line } from '@remixicon/react' import type { NavIcon } from './navLink' +import NavLink from './navLink' import AppBasic from './basic' import AppInfo from './app-info' 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' @@ -27,7 +27,16 @@ export type IAppDetailNavProps = { extraInfo?: (modeState: string) => React.ReactNode } -const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigation, extraInfo, iconType = 'app' }: 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, @@ -47,6 +56,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 (
{iconType === 'app' && ( - + )} {iconType === 'dataset' && (
-
+
@@ -108,13 +127,13 @@ const AppDetailNav = ({ title, desc, isExternal, icon, icon_background, navigati `} >
handleToggle(appSidebarExpand)} > { expand - ? - : + ? + : }
diff --git a/web/app/components/base/logo/logo-site.tsx b/web/app/components/base/logo/logo-site.tsx index 4b0e026af..fd2ef1c02 100644 --- a/web/app/components/base/logo/logo-site.tsx +++ b/web/app/components/base/logo/logo-site.tsx @@ -9,9 +9,10 @@ type LogoSiteProps = { const LogoSite: FC = ({ className, }) => { + const baseUrl = process.env.NEXT_PUBLIC_BASE_URL return ( logo diff --git a/web/app/components/header/header-wrapper.tsx b/web/app/components/header/header-wrapper.tsx index dd0ec77b8..ff9a48fbc 100644 --- a/web/app/components/header/header-wrapper.tsx +++ b/web/app/components/header/header-wrapper.tsx @@ -1,5 +1,5 @@ 'use client' -import { usePathname } from 'next/navigation' +import { usePathname, useSearchParams } from 'next/navigation' import s from './index.module.css' import classNames from '@/utils/classnames' @@ -11,8 +11,16 @@ const HeaderWrapper = ({ children, }: HeaderWrapperProps) => { const pathname = usePathname() + const searchParams = useSearchParams() const isBordered = ['/apps', '/datasets', '/datasets/create', '/tools'].includes(pathname) + // 当不携带 header 参数时,或者 header 参数为 1 时,显示 header + const headerParam = searchParams.get('header') + const showHeader = !headerParam || headerParam === '1' + + // console.log('headerParam: ', headerParam, !headerParam, (headerParam === '1')) + // console.log('showHeader: ', showHeader) + if (!showHeader) return null return (
{ config.plugins.push(codeInspectorPlugin({ bundler: 'webpack' })) return config diff --git a/web/package.json b/web/package.json index b01466ded..a1f161cd7 100644 --- a/web/package.json +++ b/web/package.json @@ -22,8 +22,7 @@ "test": "jest", "test:watch": "jest --watch", "storybook": "storybook dev -p 6006", - "build-storybook": "storybook build", - "preinstall": "npx only-allow pnpm" + "build-storybook": "storybook build" }, "dependencies": { "@babel/runtime": "^7.22.3", @@ -213,4 +212,4 @@ "@types/react-dom": "19.0.4", "@storybook/test": "8.5.0" } -} \ No newline at end of file +}