feat: improve inline settings handling for mobile responsiveness (#34)

* feat: improve inline settings handling for mobile responsiveness

* chore: auto-fix linting and formatting issues
This commit is contained in:
仓鼠 2025-03-12 09:18:31 +08:00 committed by GitHub
parent 99d349b0ed
commit 1a38ce8c77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -62,12 +62,26 @@ export default function Servers() {
}, [])
useEffect(() => {
const checkInlineSettings = () => {
const isMobile = window.innerWidth < 768
if (!isMobile) {
const inlineState = localStorage.getItem("inline")
if (window.ForceCardInline) {
setInline("1")
} else if (inlineState !== null) {
setInline(inlineState)
}
}
}
checkInlineSettings()
window.addEventListener("resize", checkInlineSettings)
return () => {
window.removeEventListener("resize", checkInlineSettings)
}
}, [])
useEffect(() => {