mirror of
https://github.com/Buriburizaem0n/nezha-dash-v1.git
synced 2026-02-04 20:50:08 +00:00
feat: save group selected
This commit is contained in:
@@ -37,6 +37,13 @@ export default function GroupSwitch({
|
||||
}
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
const savedGroup = sessionStorage.getItem("selectedGroup")
|
||||
if (savedGroup && tabs.includes(savedGroup)) {
|
||||
setCurrentTab(savedGroup)
|
||||
}
|
||||
}, [tabs, setCurrentTab])
|
||||
|
||||
useEffect(() => {
|
||||
const currentTagRef = tagRefs.current[tabs.indexOf(currentTab)]
|
||||
|
||||
|
||||
@@ -60,7 +60,13 @@ function Header() {
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-5xl">
|
||||
<section className="flex items-center justify-between header-top">
|
||||
<section onClick={() => navigate("/")} className="cursor-pointer flex items-center sm:text-base text-sm font-medium">
|
||||
<section
|
||||
onClick={() => {
|
||||
sessionStorage.removeItem("selectedGroup")
|
||||
navigate("/")
|
||||
}}
|
||||
className="cursor-pointer flex items-center sm:text-base text-sm font-medium"
|
||||
>
|
||||
<div className="mr-1 flex flex-row items-center justify-start header-logo">
|
||||
<img
|
||||
width={40}
|
||||
|
||||
Reference in New Issue
Block a user