mirror of
https://github.com/hamster1963/nezha-dash.git
synced 2025-04-24 21:10:45 +08:00
perf: use router.replace
This commit is contained in:
parent
b02e995a99
commit
9cedaf0c5a
@ -1,36 +1,6 @@
|
|||||||
|
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import Header from "@/app/[locale]/(main)/header";
|
import Header from "@/app/[locale]/(main)/header";
|
||||||
import Footer from "./footer";
|
import Footer from "./footer";
|
||||||
import type { Metadata } from "next";
|
|
||||||
import { Inter as FontSans } from "next/font/google";
|
|
||||||
import { ThemeProvider } from "next-themes";
|
|
||||||
import { Viewport } from "next";
|
|
||||||
import { cn } from "@/lib/utils";
|
|
||||||
import { PublicEnvScript } from "next-runtime-env";
|
|
||||||
|
|
||||||
const fontSans = FontSans({
|
|
||||||
subsets: ["latin"],
|
|
||||||
variable: "--font-sans",
|
|
||||||
});
|
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
|
||||||
manifest: "/manifest.json",
|
|
||||||
title: "NezhaDash",
|
|
||||||
description: "A dashboard for nezha",
|
|
||||||
appleWebApp: {
|
|
||||||
capable: true,
|
|
||||||
title: "NezhaDash",
|
|
||||||
statusBarStyle: "black-translucent",
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const viewport: Viewport = {
|
|
||||||
width: "device-width",
|
|
||||||
initialScale: 1,
|
|
||||||
maximumScale: 1,
|
|
||||||
userScalable: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
type DashboardProps = {
|
type DashboardProps = {
|
||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
|
@ -40,10 +40,10 @@ export function LanguageSwitcher() {
|
|||||||
pathname === currentLocalePath ||
|
pathname === currentLocalePath ||
|
||||||
pathname === `${currentLocalePath}/`
|
pathname === `${currentLocalePath}/`
|
||||||
) {
|
) {
|
||||||
router.push(newLocalePath);
|
router.replace(newLocalePath);
|
||||||
} else {
|
} else {
|
||||||
const newPath = constructLocalePath(pathname, newLocale);
|
const newPath = constructLocalePath(pathname, newLocale);
|
||||||
router.push(newPath);
|
router.replace(newPath);
|
||||||
}
|
}
|
||||||
router.refresh();
|
router.refresh();
|
||||||
};
|
};
|
||||||
|
@ -14,7 +14,7 @@ const withPWA = withPWAInit({
|
|||||||
|
|
||||||
/** @type {import('next').NextConfig} */
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
// output: "standalone",
|
output: "standalone",
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
};
|
};
|
||||||
export default withPWA(withNextIntl(nextConfig));
|
export default withPWA(withNextIntl(nextConfig));
|
||||||
|
@ -22,7 +22,7 @@
|
|||||||
"@radix-ui/react-tooltip": "^1.1.2",
|
"@radix-ui/react-tooltip": "^1.1.2",
|
||||||
"@types/luxon": "^3.4.2",
|
"@types/luxon": "^3.4.2",
|
||||||
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
"@typescript-eslint/eslint-plugin": "^7.18.0",
|
||||||
"caniuse-lite": "^1.0.30001663",
|
"caniuse-lite": "^1.0.30001664",
|
||||||
"class-variance-authority": "^0.7.0",
|
"class-variance-authority": "^0.7.0",
|
||||||
"clsx": "^2.1.1",
|
"clsx": "^2.1.1",
|
||||||
"country-flag-icons": "^1.5.13",
|
"country-flag-icons": "^1.5.13",
|
||||||
@ -47,7 +47,7 @@
|
|||||||
"eslint-plugin-turbo": "^2.1.2",
|
"eslint-plugin-turbo": "^2.1.2",
|
||||||
"eslint-plugin-unused-imports": "^4.1.4",
|
"eslint-plugin-unused-imports": "^4.1.4",
|
||||||
"@next/bundle-analyzer": "^14.2.13",
|
"@next/bundle-analyzer": "^14.2.13",
|
||||||
"@types/node": "^22.7.0",
|
"@types/node": "^22.7.2",
|
||||||
"@types/react": "^18.3.9",
|
"@types/react": "^18.3.9",
|
||||||
"@types/react-dom": "^18.3.0",
|
"@types/react-dom": "^18.3.0",
|
||||||
"autoprefixer": "^10.4.20",
|
"autoprefixer": "^10.4.20",
|
||||||
|
Loading…
Reference in New Issue
Block a user