mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
Merge branch 'main' into cloudflare-dev
This commit is contained in:
commit
a105992323
@ -5,15 +5,13 @@ import ServerDetailChartClient from "@/app/(main)/ClientComponents/ServerDetailC
|
|||||||
import ServerDetailClient from "@/app/(main)/ClientComponents/ServerDetailClient";
|
import ServerDetailClient from "@/app/(main)/ClientComponents/ServerDetailClient";
|
||||||
import TabSwitch from "@/components/TabSwitch";
|
import TabSwitch from "@/components/TabSwitch";
|
||||||
import { Separator } from "@/components/ui/separator";
|
import { Separator } from "@/components/ui/separator";
|
||||||
import { useTranslations } from "next-intl";
|
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
export default function Page({ params }: { params: { id: string } }) {
|
export default function Page({ params }: { params: { id: string } }) {
|
||||||
const t = useTranslations("TabSwitch");
|
|
||||||
|
|
||||||
const tabs = [t("Detail"), t("Network")];
|
const tabs = ["Detail", "Network"];
|
||||||
const [currentTab, setCurrentTab] = useState(tabs[0]);
|
const [currentTab, setCurrentTab] = useState(tabs[0]);
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto grid w-full max-w-5xl gap-2">
|
<div className="mx-auto grid w-full max-w-5xl gap-2">
|
||||||
|
@ -7,7 +7,6 @@ import { Skeleton } from "@/components/ui/skeleton";
|
|||||||
import getEnv from "@/lib/env-entry";
|
import getEnv from "@/lib/env-entry";
|
||||||
import { DateTime } from "luxon";
|
import { DateTime } from "luxon";
|
||||||
import { useTranslations } from "next-intl";
|
import { useTranslations } from "next-intl";
|
||||||
import { useLocale } from "next-intl";
|
|
||||||
import Image from "next/image";
|
import Image from "next/image";
|
||||||
import { useRouter } from "next/navigation";
|
import { useRouter } from "next/navigation";
|
||||||
import React, { useEffect, useRef, useState } from "react";
|
import React, { useEffect, useRef, useState } from "react";
|
||||||
@ -63,7 +62,7 @@ function Header() {
|
|||||||
|
|
||||||
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts
|
// https://github.com/streamich/react-use/blob/master/src/useInterval.ts
|
||||||
const useInterval = (callback: Function, delay?: number | null) => {
|
const useInterval = (callback: Function, delay?: number | null) => {
|
||||||
const savedCallback = useRef<Function>(() => {});
|
const savedCallback = useRef<Function>(() => { });
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
savedCallback.current = callback;
|
savedCallback.current = callback;
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,9 @@
|
|||||||
import ServerList from "@/components/ServerList";
|
import ServerList from "@/components/ServerList";
|
||||||
import ServerOverview from "@/components/ServerOverview";
|
import ServerOverview from "@/components/ServerOverview";
|
||||||
import { unstable_setRequestLocale } from "next-intl/server";
|
|
||||||
|
|
||||||
export const runtime = 'edge';
|
export const runtime = 'edge';
|
||||||
|
|
||||||
export default function Home({
|
export default function Home() {
|
||||||
params: { locale },
|
|
||||||
}: {
|
|
||||||
params: { locale: string };
|
|
||||||
}) {
|
|
||||||
unstable_setRequestLocale(locale);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6">
|
<div className="mx-auto grid w-full max-w-5xl gap-4 md:gap-6">
|
||||||
<ServerOverview />
|
<ServerOverview />
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
import { cn } from "@/lib/utils";
|
import { cn } from "@/lib/utils";
|
||||||
import { motion } from "framer-motion";
|
import { motion } from "framer-motion";
|
||||||
import React, { useState } from "react";
|
import { useTranslations } from "next-intl";
|
||||||
|
import React from "react";
|
||||||
|
|
||||||
export default function TabSwitch({
|
export default function TabSwitch({
|
||||||
tabs,
|
tabs,
|
||||||
@ -13,6 +14,7 @@ export default function TabSwitch({
|
|||||||
currentTab: string;
|
currentTab: string;
|
||||||
setCurrentTab: (tab: string) => void;
|
setCurrentTab: (tab: string) => void;
|
||||||
}) {
|
}) {
|
||||||
|
const t = useTranslations("TabSwitch");
|
||||||
return (
|
return (
|
||||||
<div className="z-50 flex flex-col items-start rounded-[50px]">
|
<div className="z-50 flex flex-col items-start rounded-[50px]">
|
||||||
<div className="flex items-center gap-1 rounded-[50px] bg-stone-100 p-[3px] dark:bg-stone-800">
|
<div className="flex items-center gap-1 rounded-[50px] bg-stone-100 p-[3px] dark:bg-stone-800">
|
||||||
@ -38,7 +40,7 @@ export default function TabSwitch({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<div className="relative z-20 flex items-center gap-1">
|
<div className="relative z-20 flex items-center gap-1">
|
||||||
<p className="whitespace-nowrap">{tab}</p>
|
<p className="whitespace-nowrap">{t(tab)}</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
"use client"
|
|
||||||
|
|
||||||
import Footer from "@/app/[locale]/(main)/footer";
|
|
||||||
import Header from "@/app/[locale]/(main)/header";
|
|
||||||
|
|
||||||
import { getCsrfToken } from "next-auth/react"
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
|
|
||||||
export function SignIn() {
|
|
||||||
const [csrfToken, setCsrfToken] = useState("")
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
async function loadProviders() {
|
|
||||||
const csrf = await getCsrfToken()
|
|
||||||
setCsrfToken(csrf)
|
|
||||||
}
|
|
||||||
loadProviders()
|
|
||||||
}, [])
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
|
||||||
<div className="flex min-h-screen w-full flex-col">
|
|
||||||
<main className="flex min-h-[calc(100vh_-_theme(spacing.16))] flex-1 flex-col gap-4 bg-muted/40 p-4 md:p-10 md:pt-8">
|
|
||||||
<Header />
|
|
||||||
<form
|
|
||||||
className="flex flex-col items-center justify-start gap-4 p-4 "
|
|
||||||
method="post"
|
|
||||||
action="/api/auth/callback/credentials"
|
|
||||||
>
|
|
||||||
<input type="hidden" name="csrfToken" value={csrfToken} />
|
|
||||||
<section className="flex flex-col items-start gap-2">
|
|
||||||
<label className="flex flex-col items-start gap-1 ">
|
|
||||||
<p className="text-base font-semibold">请输入页面密码</p>
|
|
||||||
<input
|
|
||||||
className="px-1 border-[1px] rounded-[5px]"
|
|
||||||
name="password"
|
|
||||||
type="password"
|
|
||||||
/>
|
|
||||||
</label>
|
|
||||||
<button className=" px-1.5 py-0.5 w-fit text-sm font-semibold rounded-[8px] border bg-card hover:brightness-95 transition-all text-card-foreground shadow-lg shadow-neutral-200/40 dark:shadow-none">
|
|
||||||
确认
|
|
||||||
</button>
|
|
||||||
</section>
|
|
||||||
</form>
|
|
||||||
<Footer />
|
|
||||||
</main>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "nezha-dash",
|
"name": "nezha-dash",
|
||||||
"version": "0.8.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "next dev -p 3020",
|
"dev": "next dev -p 3020",
|
||||||
|
Loading…
Reference in New Issue
Block a user