diff --git a/package-lock.json b/package-lock.json index 1a043742..b8141f21 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,7 +19,7 @@ "react-dom": "^18.3.1", "react-hook-form": "^7.54.2", "react-i18next": "^15.2.0", - "react-router-dom": "^6.26.2", + "react-router": "^7.1.1", "react-toastify": "^11.0.2", "react-tooltip": "^5.28.0", "tailwind-merge": "^2.6.0" @@ -4180,15 +4180,6 @@ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0" } }, - "node_modules/@remix-run/router": { - "version": "1.19.2", - "resolved": "https://registry.npmjs.org/@remix-run/router/-/router-1.19.2.tgz", - "integrity": "sha512-baiMx18+IMuD1yyvOGaHM9QrVUPGGG0jC+z+IPHnRJWUAUvaKuWKyE8gjDj2rzv3sz9zOGoRSPgeBVHRhZnBlA==", - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@rollup/pluginutils": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.4.tgz", @@ -4922,7 +4913,6 @@ "version": "0.6.0", "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz", "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==", - "dev": true, "license": "MIT" }, "node_modules/@types/estree": { @@ -8661,35 +8651,36 @@ } }, "node_modules/react-router": { - "version": "6.26.2", - "resolved": "https://registry.npmjs.org/react-router/-/react-router-6.26.2.tgz", - "integrity": "sha512-tvN1iuT03kHgOFnLPfLJ8V95eijteveqdOSk+srqfePtQvqCExB8eHOYnlilbOcyJyKnYkr1vJvf7YqotAJu1A==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/react-router/-/react-router-7.1.1.tgz", + "integrity": "sha512-39sXJkftkKWRZ2oJtHhCxmoCrBCULr/HAH4IT5DHlgu/Q0FCPV0S4Lx+abjDTx/74xoZzNYDYbOZWlJjruyuDQ==", "license": "MIT", "dependencies": { - "@remix-run/router": "1.19.2" + "@types/cookie": "^0.6.0", + "cookie": "^1.0.1", + "set-cookie-parser": "^2.6.0", + "turbo-stream": "2.4.0" }, "engines": { - "node": ">=14.0.0" + "node": ">=20.0.0" }, "peerDependencies": { - "react": ">=16.8" + "react": ">=18", + "react-dom": ">=18" + }, + "peerDependenciesMeta": { + "react-dom": { + "optional": true + } } }, - "node_modules/react-router-dom": { - "version": "6.26.2", - "resolved": "https://registry.npmjs.org/react-router-dom/-/react-router-dom-6.26.2.tgz", - "integrity": "sha512-z7YkaEW0Dy35T3/QKPYB1LjMK2R1fxnHO8kWpUMTBdfVzZrWOiY9a7CtN8HqdWtDUWd5FY6Dl8HFsqVwH4uOtQ==", + "node_modules/react-router/node_modules/cookie": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-1.0.2.tgz", + "integrity": "sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==", "license": "MIT", - "dependencies": { - "@remix-run/router": "1.19.2", - "react-router": "6.26.2" - }, "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "react": ">=16.8", - "react-dom": ">=16.8" + "node": ">=18" } }, "node_modules/react-style-singleton": { @@ -9049,6 +9040,12 @@ "semver": "bin/semver.js" } }, + "node_modules/set-cookie-parser": { + "version": "2.7.1", + "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz", + "integrity": "sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ==", + "license": "MIT" + }, "node_modules/set-function-length": { "version": "1.2.2", "resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz", @@ -9827,6 +9824,12 @@ "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==", "license": "0BSD" }, + "node_modules/turbo-stream": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/turbo-stream/-/turbo-stream-2.4.0.tgz", + "integrity": "sha512-FHncC10WpBd2eOmGwpmQsWLDoK4cqsA/UT/GqNoaKOQnT8uzhtCbg3EoUDMvqpOSAI0S26mr0rkjzbOO6S3v1g==", + "license": "ISC" + }, "node_modules/type-fest": { "version": "4.31.0", "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.31.0.tgz", diff --git a/package.json b/package.json index 20540d2e..4a3f2b53 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "react-dom": "^18.3.1", "react-hook-form": "^7.54.2", "react-i18next": "^15.2.0", - "react-router-dom": "^6.26.2", + "react-router": "^7.1.1", "react-toastify": "^11.0.2", "react-tooltip": "^5.28.0", "tailwind-merge": "^2.6.0" diff --git a/src/App.test.tsx b/src/App.test.tsx index 77b1dadd..090d0eac 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -6,9 +6,9 @@ import { http, HttpResponse, server } from "./testServer"; const mockedUsedNavigate = vi.fn(); -vi.mock("react-router-dom", async () => { +vi.mock("react-router", async () => { // biome-ignore lint/suspicious/noExplicitAny: - const reactRouterDom: any = await vi.importActual("react-router-dom"); + const reactRouterDom: any = await vi.importActual("react-router"); return { ...reactRouterDom, useNavigate: () => mockedUsedNavigate }; }); diff --git a/src/App.tsx b/src/App.tsx index 2ffeecb4..ec3e74b4 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -13,7 +13,7 @@ import { useEffect, useState, } from "react"; -import { Route, Routes, useLocation, useNavigate } from "react-router-dom"; +import { Route, Routes, useLocation, useNavigate } from "react-router"; import Layout from "./layouts/Layout"; import LoadingScreen from "./layouts/LoadingScreen"; import SkeletonLoadingScreen from "./layouts/SkeletonLoadingScreen"; diff --git a/src/components/AppStatusItem.tsx b/src/components/AppStatusItem.tsx index af3c202a..f762b6cb 100644 --- a/src/components/AppStatusItem.tsx +++ b/src/components/AppStatusItem.tsx @@ -3,7 +3,7 @@ import type { AppStatus } from "@/models/app-status"; import { getHrefFromApp } from "@/utils"; import { availableApps } from "@/utils/availableApps"; import type { FC } from "react"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; type Props = { app: AppStatus; diff --git a/src/components/RequireAuth.tsx b/src/components/RequireAuth.tsx index c40deeeb..d5d879f5 100644 --- a/src/components/RequireAuth.tsx +++ b/src/components/RequireAuth.tsx @@ -1,6 +1,6 @@ import { AppContext } from "@/context/app-context"; import { type FC, type PropsWithChildren, useContext } from "react"; -import { Navigate, useLocation } from "react-router-dom"; +import { Navigate, useLocation } from "react-router"; // see https://reactrouter.com/docs/en/v6/examples/auth const RequireAuth: FC = ({ children }) => { diff --git a/src/components/RequireSetup.tsx b/src/components/RequireSetup.tsx index 935ffdbd..5a38b205 100644 --- a/src/components/RequireSetup.tsx +++ b/src/components/RequireSetup.tsx @@ -1,5 +1,5 @@ import type { FC, PropsWithChildren } from "react"; -import { Navigate } from "react-router-dom"; +import { Navigate } from "react-router"; type Props = { needsSetup: boolean; diff --git a/src/context/app-context.tsx b/src/context/app-context.tsx index 29905001..8ab1ca7c 100644 --- a/src/context/app-context.tsx +++ b/src/context/app-context.tsx @@ -16,7 +16,7 @@ import { useState, } from "react"; import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; import { toast } from "react-toastify"; import { SSEContext } from "./sse-context"; diff --git a/src/index.tsx b/src/index.tsx index 65f296ca..c5702167 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -8,7 +8,7 @@ import { NextUIProvider } from "@nextui-org/react"; import "i18next"; import { StrictMode } from "react"; import { createRoot } from "react-dom/client"; -import { BrowserRouter } from "react-router-dom"; +import { BrowserRouter } from "react-router"; import { ToastContainer } from "react-toastify"; import "react-tooltip/dist/react-tooltip.css"; diff --git a/src/layouts/BottomNav.tsx b/src/layouts/BottomNav.tsx index e6091ca3..7aa64dbb 100644 --- a/src/layouts/BottomNav.tsx +++ b/src/layouts/BottomNav.tsx @@ -5,7 +5,7 @@ import { } from "@heroicons/react/24/outline"; import type { FC } from "react"; import { useTranslation } from "react-i18next"; -import { NavLink } from "react-router-dom"; +import { NavLink } from "react-router"; const navLinkClasses = "text-white opacity-80"; const navLinkActiveClasses = "text-yellow-500 opacity-100"; diff --git a/src/layouts/Header.tsx b/src/layouts/Header.tsx index 9d1e94b1..5f73a702 100644 --- a/src/layouts/Header.tsx +++ b/src/layouts/Header.tsx @@ -17,7 +17,7 @@ import { } from "@nextui-org/react"; import { type Key, useContext } from "react"; import { useTranslation } from "react-i18next"; -import { NavLink } from "react-router-dom"; +import { NavLink } from "react-router"; export default function Header() { const { t } = useTranslation(); diff --git a/src/layouts/SideDrawer.tsx b/src/layouts/SideDrawer.tsx index 2fb5cfff..d70aaba6 100644 --- a/src/layouts/SideDrawer.tsx +++ b/src/layouts/SideDrawer.tsx @@ -12,7 +12,7 @@ import { import type { FC } from "react"; import { useContext } from "react"; import { useTranslation } from "react-i18next"; -import { NavLink } from "react-router-dom"; +import { NavLink } from "react-router"; const navLinkClasses = "flex md:flex-col lg:flex-row items-center justify-center py-4 w-full text-white opacity-80 hover:text-yellow-500"; diff --git a/src/pages/Apps/AppCard.tsx b/src/pages/Apps/AppCard.tsx index 075de520..02dbd12e 100644 --- a/src/pages/Apps/AppCard.tsx +++ b/src/pages/Apps/AppCard.tsx @@ -11,7 +11,7 @@ import { import { Button, Link, Tooltip } from "@nextui-org/react"; import { type FC, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; export type Props = { appInfo: App; diff --git a/src/pages/Apps/AppInfo.tsx b/src/pages/Apps/AppInfo.tsx index 3c8395b3..bd24c703 100644 --- a/src/pages/Apps/AppInfo.tsx +++ b/src/pages/Apps/AppInfo.tsx @@ -13,7 +13,7 @@ import { import { Button, Link } from "@nextui-org/react"; import { type FC, useCallback, useContext, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useNavigate, useParams } from "react-router-dom"; +import { useNavigate, useParams } from "react-router"; import { toast } from "react-toastify"; import ImageCarousel from "./ImageCarousel"; diff --git a/src/pages/Apps/AppPage.tsx b/src/pages/Apps/AppPage.tsx index c76cb3be..630045f3 100644 --- a/src/pages/Apps/AppPage.tsx +++ b/src/pages/Apps/AppPage.tsx @@ -3,7 +3,7 @@ import PageLoadingScreen from "@/layouts/PageLoadingScreen"; import { getHrefFromApp } from "@/utils"; import { availableApps } from "@/utils/availableApps"; import { type FC, useContext, useEffect, useState } from "react"; -import { useNavigate, useParams } from "react-router-dom"; +import { useNavigate, useParams } from "react-router"; export const AppInfo: FC = () => { const navigate = useNavigate(); diff --git a/src/pages/Apps/customApps/Electrs.tsx b/src/pages/Apps/customApps/Electrs.tsx index 7d50519e..f7acfca4 100644 --- a/src/pages/Apps/customApps/Electrs.tsx +++ b/src/pages/Apps/customApps/Electrs.tsx @@ -17,7 +17,7 @@ import { import { QRCodeSVG } from "qrcode.react"; import { useContext, useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; const Electrs = () => { const navigate = useNavigate(); diff --git a/src/pages/Login/index.tsx b/src/pages/Login/index.tsx index 03ba1776..f8732942 100644 --- a/src/pages/Login/index.tsx +++ b/src/pages/Login/index.tsx @@ -14,7 +14,7 @@ import { type FC, useContext, useEffect, useState } from "react"; import type { SubmitHandler } from "react-hook-form"; import { useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { useLocation, useNavigate } from "react-router-dom"; +import { useLocation, useNavigate } from "react-router"; interface IFormInputs { passwordInput: string; diff --git a/src/pages/Setup/SetupContext.tsx b/src/pages/Setup/SetupContext.tsx index 9314ea58..4d4319a3 100644 --- a/src/pages/Setup/SetupContext.tsx +++ b/src/pages/Setup/SetupContext.tsx @@ -11,7 +11,7 @@ import { } from "@/pages/Setup/setup-functions"; import type React from "react"; import { createContext, useCallback, useContext } from "react"; -import type { NavigateFunction } from "react-router-dom"; +import type { NavigateFunction } from "react-router"; interface SetupContextType { state: SetupState; diff --git a/src/pages/Setup/SyncScreen.tsx b/src/pages/Setup/SyncScreen.tsx index 730941a3..779b2b6d 100644 --- a/src/pages/Setup/SyncScreen.tsx +++ b/src/pages/Setup/SyncScreen.tsx @@ -25,7 +25,7 @@ import { HttpStatusCode } from "axios"; import { type ChangeEvent, useState } from "react"; import { useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; type Props = { // biome-ignore lint/suspicious/noExplicitAny: diff --git a/src/pages/Setup/index.tsx b/src/pages/Setup/index.tsx index 7e22fc39..bcdefa94 100644 --- a/src/pages/Setup/index.tsx +++ b/src/pages/Setup/index.tsx @@ -3,7 +3,7 @@ import SetupProvider from "@/pages/Setup/SetupContext"; import SetupScreenRenderer from "@/pages/Setup/SetupScreenRenderer"; import { setupMonitoringLoop } from "@/pages/Setup/setup-functions"; import { useCallback, useEffect, useState } from "react"; -import { useNavigate } from "react-router-dom"; +import { useNavigate } from "react-router"; export default function Setup() { const [state, setState] = useState(initialState); diff --git a/src/pages/Setup/setup-functions.ts b/src/pages/Setup/setup-functions.ts index 990765d8..bde1dbe4 100644 --- a/src/pages/Setup/setup-functions.ts +++ b/src/pages/Setup/setup-functions.ts @@ -7,7 +7,7 @@ import { import { ACCESS_TOKEN } from "@/utils"; import { instance } from "@/utils/interceptor"; import { HttpStatusCode } from "axios"; -import type { NavigateFunction } from "react-router-dom"; +import type { NavigateFunction } from "react-router"; type UpdateState = (newState: Partial) => void; diff --git a/src/utils/test-utils.tsx b/src/utils/test-utils.tsx index 2fc89ca6..d3fc244d 100644 --- a/src/utils/test-utils.tsx +++ b/src/utils/test-utils.tsx @@ -12,7 +12,7 @@ import i18n from "@/i18n/test_config"; import { type RenderOptions, render } from "@testing-library/react"; import type { FC, PropsWithChildren, ReactElement } from "react"; import { I18nextProvider } from "react-i18next"; -import { BrowserRouter } from "react-router-dom"; +import { BrowserRouter } from "react-router"; type Props = { sseProps: SSEContextType;