Compare commits

..

No commits in common. "c267b489e4b369bed833185087e7f9be2469ecdd" and "80c45008223f1bd1ffae26f8f5f6d2f08c5cb7b7" have entirely different histories.

5 changed files with 12 additions and 16 deletions

View File

@ -1,7 +1,7 @@
name: Build and push Docker image name: Build and push Docker image
permissions: permissions:
contents: write contents: read
on: on:
push: push:
tags: tags:

View File

@ -1,6 +1,6 @@
name: Auto Fix Lint and Format name: Auto Fix Lint and Format
permissions: permissions:
contents: write contents: read
pull-requests: write pull-requests: write
on: on:

BIN
bun.lockb

Binary file not shown.

View File

@ -20,8 +20,10 @@ export default function Switch({
const tagRefs = useRef(allTag.map(() => createRef<HTMLDivElement>())) const tagRefs = useRef(allTag.map(() => createRef<HTMLDivElement>()))
const t = useTranslations("ServerListClient") const t = useTranslations("ServerListClient")
const locale = useLocale() const locale = useLocale()
const [indicator, setIndicator] = useState<{ x: number; w: number } | null>(null) const [indicator, setIndicator] = useState<{ x: number; w: number }>({
const [isFirstRender, setIsFirstRender] = useState(true) x: 0,
w: 0,
})
useEffect(() => { useEffect(() => {
const savedTag = sessionStorage.getItem("selectedTag") const savedTag = sessionStorage.getItem("selectedTag")
@ -57,13 +59,7 @@ export default function Switch({
w: currentTagElement.offsetWidth, w: currentTagElement.offsetWidth,
}) })
} }
}, [nowTag, locale])
if (isFirstRender) {
setTimeout(() => {
setIsFirstRender(false)
}, 50)
}
}, [nowTag, locale, allTag, isFirstRender])
useEffect(() => { useEffect(() => {
const currentTagElement = tagRefs.current[allTag.indexOf(nowTag)]?.current const currentTagElement = tagRefs.current[allTag.indexOf(nowTag)]?.current
@ -88,14 +84,14 @@ export default function Switch({
className="scrollbar-hidden z-50 flex flex-col items-start overflow-x-scroll rounded-[50px]" 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"> <div className="relative flex items-center gap-1 rounded-[50px] bg-stone-100 p-[3px] dark:bg-stone-800">
{indicator && ( {indicator.w > 0 && (
<div <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" 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={{ style={{
borderRadius: 24, borderRadius: 24,
width: `${indicator.w}px`, width: `${indicator.w}px`,
transform: `translateX(${indicator.x}px)`, transform: `translateX(${indicator.x}px)`,
transition: isFirstRender ? "none" : "all 0.5s cubic-bezier(0.4, 0, 0.2, 1)", transition: "all 0.5s cubic-bezier(0.4, 0, 0.2, 1)",
}} }}
/> />
)} )}

View File

@ -1,9 +1,9 @@
{ {
"name": "nezha-dash", "name": "nezha-dash",
"version": "2.9.0", "version": "2.8.3",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev -p 3040", "dev": "next dev --turbopack -p 3040",
"start": "node .next/standalone/server.js", "start": "node .next/standalone/server.js",
"lint": "biome lint", "lint": "biome lint",
"lint:fix": "biome lint --fix", "lint:fix": "biome lint --fix",