mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Compare commits
3 Commits
80c4500822
...
c267b489e4
Author | SHA1 | Date | |
---|---|---|---|
|
c267b489e4 | ||
|
8a1ce73564 | ||
|
6b273622df |
4
.github/workflows/Deploy.yml
vendored
4
.github/workflows/Deploy.yml
vendored
@ -1,7 +1,7 @@
|
||||
name: Build and push Docker image
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
contents: write
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: Auto Fix Lint and Format
|
||||
permissions:
|
||||
contents: read
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
on:
|
||||
|
@ -20,10 +20,8 @@ export default function Switch({
|
||||
const tagRefs = useRef(allTag.map(() => createRef<HTMLDivElement>()))
|
||||
const t = useTranslations("ServerListClient")
|
||||
const locale = useLocale()
|
||||
const [indicator, setIndicator] = useState<{ x: number; w: number }>({
|
||||
x: 0,
|
||||
w: 0,
|
||||
})
|
||||
const [indicator, setIndicator] = useState<{ x: number; w: number } | null>(null)
|
||||
const [isFirstRender, setIsFirstRender] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
const savedTag = sessionStorage.getItem("selectedTag")
|
||||
@ -59,7 +57,13 @@ export default function Switch({
|
||||
w: currentTagElement.offsetWidth,
|
||||
})
|
||||
}
|
||||
}, [nowTag, locale])
|
||||
|
||||
if (isFirstRender) {
|
||||
setTimeout(() => {
|
||||
setIsFirstRender(false)
|
||||
}, 50)
|
||||
}
|
||||
}, [nowTag, locale, allTag, isFirstRender])
|
||||
|
||||
useEffect(() => {
|
||||
const currentTagElement = tagRefs.current[allTag.indexOf(nowTag)]?.current
|
||||
@ -84,14 +88,14 @@ export default function Switch({
|
||||
className="scrollbar-hidden z-50 flex flex-col items-start overflow-x-scroll rounded-[50px]"
|
||||
>
|
||||
<div className="relative flex items-center gap-1 rounded-[50px] bg-stone-100 p-[3px] dark:bg-stone-800">
|
||||
{indicator.w > 0 && (
|
||||
{indicator && (
|
||||
<div
|
||||
className="absolute top-[3px] left-0 z-10 h-[35px] bg-white shadow-black/5 shadow-lg dark:bg-stone-700 dark:shadow-white/5"
|
||||
style={{
|
||||
borderRadius: 24,
|
||||
width: `${indicator.w}px`,
|
||||
transform: `translateX(${indicator.x}px)`,
|
||||
transition: "all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",
|
||||
transition: isFirstRender ? "none" : "all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "nezha-dash",
|
||||
"version": "2.8.3",
|
||||
"version": "2.9.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev --turbopack -p 3040",
|
||||
"dev": "next dev -p 3040",
|
||||
"start": "node .next/standalone/server.js",
|
||||
"lint": "biome lint",
|
||||
"lint:fix": "biome lint --fix",
|
||||
|
Loading…
Reference in New Issue
Block a user