Skip to content

Commit 7c960e0

Browse files
committed
fix: disable AI on mobile
1 parent 837230b commit 7c960e0

File tree

5 files changed

+32
-7
lines changed

5 files changed

+32
-7
lines changed

src/app/layout.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import React, { Suspense } from "react"
99
import { AppRouterCacheProvider } from "@mui/material-nextjs/v15-appRouter"
1010
import InitColorSchemeScript from "@mui/material/InitColorSchemeScript"
1111

12-
import AIModal from "@/components/AIModal"
1312
import GlobalComponents from "@/components/GlobalComponents"
1413
import ScrollToTop from "@/components/ScrollToTop"
1514
import WebVitals from "@/components/WebVitals"
@@ -74,7 +73,6 @@ export default function RootLayout({ children }: { children: React.ReactNode })
7473
<BridgeContextProvider>
7574
{children}
7675
<GlobalComponents></GlobalComponents>
77-
<AIModal></AIModal>
7876
</BridgeContextProvider>
7977
</RainbowProvider>
8078
</VersionChecker>

src/components/AIModal/Operation.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const Operation = props => {
8888
lineHeight: "1.6rem",
8989
padding: "0.4rem 0.8rem",
9090
backgroundColor: "text.primary",
91-
marginTop: "0.8rem",
91+
marginTop: "0.8rem !important",
9292
"& .MuiTooltip-arrow": {
9393
color: "#101010",
9494
},

src/components/AIModal/index.tsx

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ const AIModal = () => {
5656
}
5757
}, [aiModalVisible])
5858

59+
// useLayoutEffect(() => {
60+
// function adjustLayout() {
61+
// const viewportHeight = window.visualViewport!.height || "100vh"
62+
// modalRef.current!.style.height = `${viewportHeight}px`
63+
// }
64+
// function preventTouchScroll(e) {
65+
// e.preventDefault()
66+
// }
67+
68+
// if (isMobile) {
69+
// document.body.addEventListener("touchmove", preventTouchScroll)
70+
// window.visualViewport!.addEventListener("resize", adjustLayout)
71+
// }
72+
73+
// return () => {
74+
// if (isMobile) {
75+
// window.visualViewport!.removeEventListener("resize", adjustLayout)
76+
// document.body.removeEventListener("touchmove", preventTouchScroll)
77+
// }
78+
// }
79+
// }, [isMobile])
80+
5981
const handleChangeSearchText = e => {
6082
setSearchText(e.target.value)
6183
}
@@ -185,7 +207,6 @@ const AIModal = () => {
185207
})
186208
})
187209
}
188-
189210
return (
190211
<AnimatePresence>
191212
{aiModalVisible ? (
@@ -194,10 +215,11 @@ const AIModal = () => {
194215
position: "fixed",
195216
zIndex: "var(--mui-zIndex-modal)",
196217
right: [0, "2.5rem"],
197-
top: [0, "7.5rem"],
218+
top: ["unset", "7.5rem"],
219+
bottom: [0, "unset"],
198220

199221
width: ["100%", "46.8rem"],
200-
height: ["100%", "calc(100svh - 7.5rem - 10rem)"],
222+
height: ["100vh", "calc(100svh - 7.5rem - 10rem)"],
201223
borderRadius: [0, "1.6rem"],
202224

203225
display: "flex",

src/components/GlobalComponents/index.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1+
import { isDesktop } from "react-device-detect"
2+
13
import TxHistoryDialog from "@/app/bridge/TxHistoryDialog"
24

5+
import AIModal from "../AIModal"
6+
37
const GlobalComponents = () => {
48
return (
59
<>
610
<TxHistoryDialog></TxHistoryDialog>
11+
{isDesktop && <AIModal></AIModal>}
712
</>
813
)
914
}

src/components/Header/mobile_header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ const MobileHeader = ({ currentMenu }) => {
181181
<Box sx={{ margin: "-0.8rem 2rem 0" }}>
182182
{renderList()}
183183
{!isSepolia && <MobileGasPriceViewer dark={dark}></MobileGasPriceViewer>}
184-
{!isSepolia && <AskAI isMobile></AskAI>}
184+
{/* {!isSepolia && <AskAI isMobile></AskAI>} */}
185185
</Box>
186186
</Box>
187187
)}

0 commit comments

Comments
 (0)