增加分栏后可以全屏和还原的功能

This commit is contained in:
allen2fuc
2026-05-13 17:46:05 +08:00
parent b3d3f0edcb
commit db4d8e5090
6 changed files with 67 additions and 11 deletions
+14 -4
View File
@@ -8,7 +8,7 @@
============================================================ */
import { useDevice } from "@/contexts/DeviceContext";
import { cn } from "@/lib/utils";
import { useAIDrawer } from "@/contexts/AIDrawerContext";
import { readAndClearAiSplitRestorePath, useAIDrawer } from "@/contexts/AIDrawerContext";
import { useIsLgUp } from "@/hooks/useIsLgUp";
import localeZh from "@/locales/data-zh.json";
import localeZhHK from "@/locales/data-zh-HK.json";
@@ -42,7 +42,7 @@ const NAV_ITEMS: NavItem[] = [
];
export default function BottomNav() {
const [location] = useLocation();
const [location, setLocation] = useLocation();
const isLgUp = useIsLgUp();
const { open: aiDrawerOpen, setOpen: setAiDrawerOpen } = useAIDrawer();
const { deviceState } = useDevice();
@@ -160,13 +160,23 @@ export default function BottomNav() {
tabIndex={0}
className="cursor-pointer select-none"
onClick={() => {
if (location === "/ai") return;
if (location === "/ai") {
const path = readAndClearAiSplitRestorePath();
setLocation(path);
setAiDrawerOpen(true);
return;
}
setAiDrawerOpen((o) => !o);
}}
onKeyDown={(e) => {
if (e.key !== "Enter" && e.key !== " ") return;
e.preventDefault();
if (location === "/ai") return;
if (location === "/ai") {
const path = readAndClearAiSplitRestorePath();
setLocation(path);
setAiDrawerOpen(true);
return;
}
setAiDrawerOpen((o) => !o);
}}
>