|
|
@@ -22,6 +22,8 @@ import { AuthPage } from "./auth";
|
|
|
import { getClientConfig } from "../config/client";
|
|
|
import { type ClientApi, getClientApi } from "../client/api";
|
|
|
import { useAccessStore } from "../store";
|
|
|
+import { Button } from "antd";
|
|
|
+import { MenuOutlined } from "@ant-design/icons";
|
|
|
|
|
|
export function Loading() {
|
|
|
/** second版本注释掉进度条 */
|
|
|
@@ -241,8 +243,9 @@ function Screen() {
|
|
|
const isArtifact = location.pathname.includes(Path.Artifacts);
|
|
|
const isAuth = location.pathname === Path.Auth;
|
|
|
|
|
|
-
|
|
|
const isMobileScreen = useMobileScreen();
|
|
|
+ const [showSidebar, setShowSidebar] = useState(false);
|
|
|
+
|
|
|
const shouldTightBorder =
|
|
|
getClientConfig()?.isApp || (config.tightBorder && !isMobileScreen);
|
|
|
|
|
|
@@ -250,6 +253,11 @@ function Screen() {
|
|
|
loadAsyncGoogleFont();
|
|
|
}, []);
|
|
|
|
|
|
+ // 路由切换时关闭侧边栏
|
|
|
+ useEffect(() => {
|
|
|
+ setShowSidebar(false);
|
|
|
+ }, [location.pathname]);
|
|
|
+
|
|
|
if (isArtifact) {
|
|
|
return (
|
|
|
<Routes>
|
|
|
@@ -261,14 +269,37 @@ function Screen() {
|
|
|
const renderContent = () => {
|
|
|
if (isAuth) return <AuthPage />;
|
|
|
|
|
|
-
|
|
|
return (
|
|
|
<>
|
|
|
- {
|
|
|
- location.pathname !== '/' &&
|
|
|
- <SideBar className={(location.pathname === '/knowledgeChat' || location.pathname === '/deepseekChat') ? styles["sidebar-show"] : ""} />
|
|
|
- }
|
|
|
+ {location.pathname !== '/' && !location.search.includes('showMenu=false') && (
|
|
|
+ <>
|
|
|
+ <SideBar
|
|
|
+ className={
|
|
|
+ (isMobileScreen && showSidebar) ||
|
|
|
+ (!isMobileScreen && (location.pathname === '/knowledgeChat' || location.pathname === '/deepseekChat'))
|
|
|
+ ? styles["sidebar-show"]
|
|
|
+ : ""
|
|
|
+ }
|
|
|
+ />
|
|
|
+ {isMobileScreen && showSidebar && (
|
|
|
+ <div
|
|
|
+ className={styles["sidebar-mask"]}
|
|
|
+ onClick={() => setShowSidebar(false)}
|
|
|
+ />
|
|
|
+ )}
|
|
|
+ </>
|
|
|
+ )}
|
|
|
<WindowContent>
|
|
|
+ {isMobileScreen && location.pathname !== '/' && !location.search.includes('showMenu=false') && (
|
|
|
+ <div className={styles["mobile-menu-button"]}>
|
|
|
+ <Button
|
|
|
+ type="text"
|
|
|
+ icon={<MenuOutlined />}
|
|
|
+ onClick={() => setShowSidebar(!showSidebar)}
|
|
|
+ className={styles["menu-trigger-button"]}
|
|
|
+ />
|
|
|
+ </div>
|
|
|
+ )}
|
|
|
<Routes>
|
|
|
<Route path='/' element={<HomeApp />} />
|
|
|
<Route path='/knowledgeChat' element={<Chat />} />
|