mirror of
https://github.com/woodchen-ink/nezha-dash-v1.git
synced 2025-07-18 17:41:56 +08:00
feat: add global configuration flags for services, card layout, and map display
This commit is contained in:
parent
ee0eee378b
commit
c87663f2e1
@ -4,6 +4,9 @@ declare global {
|
|||||||
interface Window {
|
interface Window {
|
||||||
CustomBackgroundImage: string
|
CustomBackgroundImage: string
|
||||||
CustomMobileBackgroundImage: string
|
CustomMobileBackgroundImage: string
|
||||||
|
ForceShowServices: boolean
|
||||||
|
ForceCardInline: boolean
|
||||||
|
ForceShowMap: boolean
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,18 +53,31 @@ export default function Servers() {
|
|||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const showServicesState = localStorage.getItem("showServices")
|
const showServicesState = localStorage.getItem("showServices")
|
||||||
if (showServicesState !== null) {
|
if (window.ForceShowServices) {
|
||||||
|
setShowServices("1")
|
||||||
|
} else if (showServicesState !== null) {
|
||||||
setShowServices(showServicesState)
|
setShowServices(showServicesState)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const inlineState = localStorage.getItem("inline")
|
const inlineState = localStorage.getItem("inline")
|
||||||
if (inlineState !== null) {
|
if (window.ForceCardInline) {
|
||||||
|
setInline("1")
|
||||||
|
} else if (inlineState !== null) {
|
||||||
setInline(inlineState)
|
setInline(inlineState)
|
||||||
}
|
}
|
||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const showMapState = localStorage.getItem("showMap")
|
||||||
|
if (window.ForceShowMap) {
|
||||||
|
setShowMap("1")
|
||||||
|
} else if (showMapState !== null) {
|
||||||
|
setShowMap(showMapState)
|
||||||
|
}
|
||||||
|
}, [])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedGroup = sessionStorage.getItem("selectedGroup") || "All"
|
const savedGroup = sessionStorage.getItem("selectedGroup") || "All"
|
||||||
setCurrentGroup(savedGroup)
|
setCurrentGroup(savedGroup)
|
||||||
@ -212,6 +225,7 @@ export default function Servers() {
|
|||||||
<button
|
<button
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setShowMap(showMap === "0" ? "1" : "0")
|
setShowMap(showMap === "0" ? "1" : "0")
|
||||||
|
localStorage.setItem("showMap", showMap === "0" ? "1" : "0")
|
||||||
}}
|
}}
|
||||||
className={cn(
|
className={cn(
|
||||||
"rounded-[50px] bg-white dark:bg-stone-800 cursor-pointer p-[10px] transition-all border border-stone-200 dark:border-stone-700 hover:bg-stone-100 dark:hover:bg-stone-700",
|
"rounded-[50px] bg-white dark:bg-stone-800 cursor-pointer p-[10px] transition-all border border-stone-200 dark:border-stone-700 hover:bg-stone-100 dark:hover:bg-stone-700",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user