增加AI页面在其它页面的展示

This commit is contained in:
allen2fuc
2026-05-08 18:15:52 +08:00
parent 9817ecca33
commit 68f06344dc
9 changed files with 334 additions and 15 deletions
+20
View File
@@ -0,0 +1,20 @@
import { useEffect, useState } from "react";
/** Matches Tailwind `lg:` (1024px). Used for desktop-only UI such as the AI split panel. */
export function useIsLgUp() {
const [lgUp, setLgUp] = useState(
() =>
typeof window !== "undefined" &&
window.matchMedia("(min-width: 1024px)").matches,
);
useEffect(() => {
const mql = window.matchMedia("(min-width: 1024px)");
const sync = () => setLgUp(mql.matches);
mql.addEventListener("change", sync);
sync();
return () => mql.removeEventListener("change", sync);
}, []);
return lgUp;
}