From bfc04e9033ec2d4728cda361b53d76758bcef231 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Sun, 8 Oct 2023 19:06:59 +0800 Subject: [PATCH] feat: add hideHeader in url params --- src/client/pages/Layout.tsx | 74 +++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 35 deletions(-) diff --git a/src/client/pages/Layout.tsx b/src/client/pages/Layout.tsx index 53155b1..09db1a0 100644 --- a/src/client/pages/Layout.tsx +++ b/src/client/pages/Layout.tsx @@ -1,11 +1,12 @@ import React from 'react'; -import { Outlet } from 'react-router-dom'; +import { Outlet, useSearchParams } from 'react-router-dom'; import { NavItem } from '../components/NavItem'; import { UserOutlined } from '@ant-design/icons'; import { Button, Dropdown } from 'antd'; import { useUserStore } from '../store/user'; export const Layout: React.FC = React.memo(() => { + const [params] = useSearchParams(); const workspaces = useUserStore((state) => { const userInfo = state.info; if (userInfo) { @@ -19,46 +20,49 @@ export const Layout: React.FC = React.memo(() => { return []; }); + const showHeader = !params.has('hideHeader'); return (
-
-
Tianji
-
- - - - - -
+ {showHeader && ( +
+
Tianji
+
+ + + + + +
-
+
-
- ({ - key: w.id, - label: `${w.name}${w.current ? '(current)' : ''}`, - disabled: w.current, - })), - }, - { - key: 'logout', - label: 'Logout', - }, - ], - }} - > -
-
+ )}