mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Compare commits
No commits in common. "3411783401bccabd6e4e45b2cda5d2f029a4390c" and "55cec2e0559151183627dcae93c737c3022dcbd4" have entirely different histories.
3411783401
...
55cec2e055
@ -21,8 +21,7 @@
|
|||||||
"useSortedClasses": "error"
|
"useSortedClasses": "error"
|
||||||
},
|
},
|
||||||
"a11y": {
|
"a11y": {
|
||||||
"useKeyWithClickEvents": "off",
|
"useKeyWithClickEvents": "off"
|
||||||
"noLabelWithoutControl": "off"
|
|
||||||
},
|
},
|
||||||
"security": {
|
"security": {
|
||||||
"noDangerouslySetInnerHtml": "off"
|
"noDangerouslySetInnerHtml": "off"
|
||||||
|
@ -4,28 +4,23 @@ import { Button } from "@/components/ui/button"
|
|||||||
import {
|
import {
|
||||||
DropdownMenu,
|
DropdownMenu,
|
||||||
DropdownMenuContent,
|
DropdownMenuContent,
|
||||||
|
DropdownMenuItem,
|
||||||
DropdownMenuTrigger,
|
DropdownMenuTrigger,
|
||||||
} from "@/components/ui/dropdown-menu"
|
} from "@/components/ui/dropdown-menu"
|
||||||
import { CheckIcon, MinusIcon, Moon, Sun } from "lucide-react"
|
import { cn } from "@/lib/utils"
|
||||||
|
import { CheckCircleIcon } from "@heroicons/react/20/solid"
|
||||||
|
import { Moon, Sun } from "lucide-react"
|
||||||
import { useTranslations } from "next-intl"
|
import { useTranslations } from "next-intl"
|
||||||
import { useTheme } from "next-themes"
|
import { useTheme } from "next-themes"
|
||||||
import { useId } from "react"
|
|
||||||
import { RadioGroup, RadioGroupItem } from "./ui/radio-group"
|
|
||||||
|
|
||||||
const items = [
|
|
||||||
{ value: "light", label: "Light", image: "/ui-light.png" },
|
|
||||||
{ value: "dark", label: "Dark", image: "/ui-dark.png" },
|
|
||||||
{ value: "system", label: "System", image: "/ui-system.png" },
|
|
||||||
]
|
|
||||||
|
|
||||||
export function ModeToggle() {
|
export function ModeToggle() {
|
||||||
const { setTheme, theme } = useTheme()
|
const { setTheme, theme } = useTheme()
|
||||||
const t = useTranslations("ThemeSwitcher")
|
const t = useTranslations("ThemeSwitcher")
|
||||||
|
|
||||||
const handleSelect = (newTheme: string) => {
|
const handleSelect = (e: Event, newTheme: string) => {
|
||||||
|
e.preventDefault()
|
||||||
setTheme(newTheme)
|
setTheme(newTheme)
|
||||||
}
|
}
|
||||||
const id = useId()
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<DropdownMenu>
|
<DropdownMenu>
|
||||||
@ -40,40 +35,31 @@ export function ModeToggle() {
|
|||||||
<span className="sr-only">Toggle theme</span>
|
<span className="sr-only">Toggle theme</span>
|
||||||
</Button>
|
</Button>
|
||||||
</DropdownMenuTrigger>
|
</DropdownMenuTrigger>
|
||||||
<DropdownMenuContent className="px-3 pt-3 pb-2" align="end">
|
<DropdownMenuContent className="flex flex-col gap-0.5" align="end">
|
||||||
<fieldset className="space-y-4">
|
<DropdownMenuItem
|
||||||
<RadioGroup className="flex gap-3" defaultValue={theme} onValueChange={handleSelect}>
|
className={cn("rounded-b-[5px]", {
|
||||||
{items.map((item) => (
|
"gap-3 bg-muted font-semibold": theme === "light",
|
||||||
<label key={`${id}-${item.value}`}>
|
})}
|
||||||
<RadioGroupItem
|
onSelect={(e) => handleSelect(e, "light")}
|
||||||
id={`${id}-${item.value}`}
|
>
|
||||||
value={item.value}
|
{t("Light")} {theme === "light" && <CheckCircleIcon className="size-4" />}
|
||||||
className="peer sr-only after:absolute after:inset-0"
|
</DropdownMenuItem>
|
||||||
/>
|
<DropdownMenuItem
|
||||||
<img
|
className={cn("rounded-[5px]", {
|
||||||
src={item.image}
|
"gap-3 bg-muted font-semibold": theme === "dark",
|
||||||
alt={item.label}
|
})}
|
||||||
width={88}
|
onSelect={(e) => handleSelect(e, "dark")}
|
||||||
height={70}
|
>
|
||||||
className="relative cursor-pointer overflow-hidden rounded-[8px] border border-neutral-300 shadow-xs outline-none transition-[color,box-shadow] peer-focus-visible:ring-[3px] peer-focus-visible:ring-ring/50 peer-data-disabled:cursor-not-allowed peer-data-[state=checked]:bg-accent peer-data-disabled:opacity-50 dark:border-neutral-700"
|
{t("Dark")} {theme === "dark" && <CheckCircleIcon className="size-4" />}
|
||||||
/>
|
</DropdownMenuItem>
|
||||||
<span className="group mt-2 flex items-center gap-1 peer-data-[state=unchecked]:text-muted-foreground/70">
|
<DropdownMenuItem
|
||||||
<CheckIcon
|
className={cn("rounded-t-[5px]", {
|
||||||
size={16}
|
"gap-3 bg-muted font-semibold": theme === "system",
|
||||||
className="group-peer-data-[state=unchecked]:hidden"
|
})}
|
||||||
aria-hidden="true"
|
onSelect={(e) => handleSelect(e, "system")}
|
||||||
/>
|
>
|
||||||
<MinusIcon
|
{t("System")} {theme === "system" && <CheckCircleIcon className="size-4" />}
|
||||||
size={16}
|
</DropdownMenuItem>
|
||||||
className="group-peer-data-[state=checked]:hidden"
|
|
||||||
aria-hidden="true"
|
|
||||||
/>
|
|
||||||
<span className="font-medium text-xs">{t(item.label)}</span>
|
|
||||||
</span>
|
|
||||||
</label>
|
|
||||||
))}
|
|
||||||
</RadioGroup>
|
|
||||||
</fieldset>
|
|
||||||
</DropdownMenuContent>
|
</DropdownMenuContent>
|
||||||
</DropdownMenu>
|
</DropdownMenu>
|
||||||
)
|
)
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
"use client"
|
|
||||||
|
|
||||||
import { cn } from "@/lib/utils"
|
|
||||||
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group"
|
|
||||||
import type * as React from "react"
|
|
||||||
|
|
||||||
function RadioGroup({
|
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Root>) {
|
|
||||||
return (
|
|
||||||
<RadioGroupPrimitive.Root
|
|
||||||
data-slot="radio-group"
|
|
||||||
className={cn("grid gap-3", className)}
|
|
||||||
{...props}
|
|
||||||
/>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
function RadioGroupItem({
|
|
||||||
className,
|
|
||||||
...props
|
|
||||||
}: React.ComponentProps<typeof RadioGroupPrimitive.Item>) {
|
|
||||||
return (
|
|
||||||
<RadioGroupPrimitive.Item
|
|
||||||
data-slot="radio-group-item"
|
|
||||||
className={cn(
|
|
||||||
"aspect-square size-4 shrink-0 rounded-full border border-input shadow-xs outline-none transition-shadow focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:aria-invalid:ring-destructive/40",
|
|
||||||
className,
|
|
||||||
)}
|
|
||||||
{...props}
|
|
||||||
>
|
|
||||||
<RadioGroupPrimitive.Indicator className="flex items-center justify-center text-current">
|
|
||||||
<svg
|
|
||||||
role="img"
|
|
||||||
aria-label="Radio indicator"
|
|
||||||
width="6"
|
|
||||||
height="6"
|
|
||||||
viewBox="0 0 6 6"
|
|
||||||
fill="currentcolor"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
>
|
|
||||||
<circle cx="3" cy="3" r="3" />
|
|
||||||
</svg>
|
|
||||||
</RadioGroupPrimitive.Indicator>
|
|
||||||
</RadioGroupPrimitive.Item>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
export { RadioGroup, RadioGroupItem }
|
|
@ -4,7 +4,7 @@ import getEnv from "./lib/env-entry"
|
|||||||
export const localeItems = [
|
export const localeItems = [
|
||||||
{ code: "en", name: "English" },
|
{ code: "en", name: "English" },
|
||||||
{ code: "ja", name: "日本語" },
|
{ code: "ja", name: "日本語" },
|
||||||
{ code: "zh-TW", name: "中文繁體" },
|
{ code: "zh-t", name: "中文繁體" },
|
||||||
{ code: "zh", name: "中文简体" },
|
{ code: "zh", name: "中文简体" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
23
package.json
23
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nezha-dash",
|
"name": "nezha-dash",
|
||||||
"version": "2.9.2",
|
"version": "2.9.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 3040",
|
"dev": "next dev -p 3040",
|
||||||
@ -21,7 +21,6 @@
|
|||||||
"@radix-ui/react-navigation-menu": "^1.2.5",
|
"@radix-ui/react-navigation-menu": "^1.2.5",
|
||||||
"@radix-ui/react-popover": "^1.1.6",
|
"@radix-ui/react-popover": "^1.1.6",
|
||||||
"@radix-ui/react-progress": "^1.1.2",
|
"@radix-ui/react-progress": "^1.1.2",
|
||||||
"@radix-ui/react-radio-group": "^1.2.3",
|
|
||||||
"@radix-ui/react-separator": "^1.1.2",
|
"@radix-ui/react-separator": "^1.1.2",
|
||||||
"@radix-ui/react-slot": "^1.1.2",
|
"@radix-ui/react-slot": "^1.1.2",
|
||||||
"@radix-ui/react-switch": "^1.1.3",
|
"@radix-ui/react-switch": "^1.1.3",
|
||||||
@ -29,8 +28,8 @@
|
|||||||
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
"@trivago/prettier-plugin-sort-imports": "^5.2.2",
|
||||||
"@types/crypto-js": "^4.2.2",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/d3-geo": "^3.1.0",
|
"@types/d3-geo": "^3.1.0",
|
||||||
"@types/luxon": "^3.6.0",
|
"@types/luxon": "^3.4.2",
|
||||||
"babel-plugin-react-compiler": "^19.0.0-beta-e993439-20250328",
|
"babel-plugin-react-compiler": "^19.0.0-beta-e552027-20250112",
|
||||||
"caniuse-lite": "^1.0.30001707",
|
"caniuse-lite": "^1.0.30001707",
|
||||||
"class-variance-authority": "^0.7.1",
|
"class-variance-authority": "^0.7.1",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
@ -42,33 +41,33 @@
|
|||||||
"flag-icons": "^7.3.2",
|
"flag-icons": "^7.3.2",
|
||||||
"i18n-iso-countries": "^7.14.0",
|
"i18n-iso-countries": "^7.14.0",
|
||||||
"lucide-react": "^0.474.0",
|
"lucide-react": "^0.474.0",
|
||||||
"luxon": "^3.6.1",
|
"luxon": "^3.6.0",
|
||||||
"maxmind": "^4.3.24",
|
"maxmind": "^4.3.24",
|
||||||
"next": "^15.2.4",
|
"next": "^15.2.4",
|
||||||
"next-auth": "^5.0.0-beta.25",
|
"next-auth": "^5.0.0-beta.25",
|
||||||
"next-intl": "^4.0.2",
|
"next-intl": "^4.0.2",
|
||||||
"next-runtime-env": "^3.3.0",
|
"next-runtime-env": "^3.2.2",
|
||||||
"next-themes": "^0.4.6",
|
"next-themes": "^0.4.6",
|
||||||
"react": "^19.1.0",
|
"react": "^19.0.0",
|
||||||
"react-device-detect": "^2.2.3",
|
"react-device-detect": "^2.2.3",
|
||||||
"react-dom": "^19.1.0",
|
"react-dom": "^19.0.0",
|
||||||
"react-intersection-observer": "^9.16.0",
|
"react-intersection-observer": "^9.16.0",
|
||||||
"react-wrap-balancer": "^1.1.1",
|
"react-wrap-balancer": "^1.1.1",
|
||||||
"recharts": "^2.15.1",
|
"recharts": "^2.15.1",
|
||||||
"sharp": "^0.33.5",
|
"sharp": "^0.33.5",
|
||||||
"swr": "^2.3.3",
|
"swr": "^2.3.3",
|
||||||
"tailwind-merge": "^3.1.0",
|
"tailwind-merge": "^3.0.2",
|
||||||
"tailwindcss-animate": "^1.0.7"
|
"tailwindcss-animate": "^1.0.7"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@biomejs/biome": "1.9.4",
|
"@biomejs/biome": "1.9.4",
|
||||||
"@next/bundle-analyzer": "^15.2.4",
|
"@next/bundle-analyzer": "^15.2.4",
|
||||||
"@tailwindcss/postcss": "^4.1.0",
|
"@tailwindcss/postcss": "^4.0.16",
|
||||||
"@types/node": "^22.13.17",
|
"@types/node": "^22.13.13",
|
||||||
"@types/react": "^19.0.12",
|
"@types/react": "^19.0.12",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"postcss": "^8.5.3",
|
"postcss": "^8.5.3",
|
||||||
"tailwindcss": "^4.1.0",
|
"tailwindcss": "^4.0.16",
|
||||||
"typescript": "^5.8.2",
|
"typescript": "^5.8.2",
|
||||||
"vercel": "^41.4.1"
|
"vercel": "^41.4.1"
|
||||||
},
|
},
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 364 B |
Binary file not shown.
Before Width: | Height: | Size: 370 B |
Binary file not shown.
Before Width: | Height: | Size: 414 B |
Loading…
Reference in New Issue
Block a user