mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 01:39:13 +00:00
feat(web): move from react-router to @tanstack/router (#1338)
* fix(auth): invalid cookie handling and wrongful basic auth invalidation * fix(auth): fix test to reflect new HTTP status code * fix(auth/web): do not throw on error * fix(http): replace http codes in middleware to prevent basic auth invalidation fix typo in comment * fix test * fix(web): api client handle 403 * refactor(http): auth_test use testify.assert * refactor(http): set session opts after valid login * refactor(http): send more client headers * fix(http): test * refactor(web): move router to tanstack/router * refactor(web): use route loaders and suspense * refactor(web): useSuspense for settings * refactor(web): invalidate cookie in middleware * fix: loclfile * fix: load filter/id * fix(web): login, onboard, types, imports * fix(web): filter load * fix(web): build errors * fix(web): ts-expect-error * fix(tests): filter_test.go * fix(filters): tests * refactor: remove duplicate spinner components refactor: ReleaseTable.tsx loading animation refactor: remove dedicated `pendingComponent` for `settingsRoute` * fix: refactor missed SectionLoader to RingResizeSpinner * fix: substitute divides with borders to account for unloaded elements * fix(api): action status URL param * revert: action status URL param add comment * fix(routing): notfound handling and split files * fix(filters): notfound get params * fix(queries): colon * fix(queries): comments ts-ignore * fix(queries): extract queryKeys * fix(queries): remove err * fix(routes): move zob schema inline * fix(auth): middleware and redirect to login * fix(auth): failing test * fix(logs): invalidate correct key * fix(logs): invalidate correct key * fix(logs): invalidate correct key * fix: JSX element stealing focus from searchbar * reimplement empty release table state text * fix(context): use deep-copy * fix(releases): empty state and filter input warnings * fix(releases): empty states * fix(auth): onboarding * fix(cache): invalidate queries --------- Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
This commit is contained in:
parent
cc9656cd41
commit
1a23b69bcf
64 changed files with 2543 additions and 2091 deletions
|
@ -1,67 +0,0 @@
|
|||
/*
|
||||
* Copyright (c) 2021 - 2024, Ludvig Lundgren and the autobrr contributors.
|
||||
* SPDX-License-Identifier: GPL-2.0-or-later
|
||||
*/
|
||||
|
||||
import { Suspense } from "react";
|
||||
import { BrowserRouter, Outlet, Route, Routes } from "react-router-dom";
|
||||
|
||||
import { baseUrl } from "@utils";
|
||||
|
||||
import { Header } from "@components/header";
|
||||
import { SectionLoader } from "@components/SectionLoader";
|
||||
import { NotFound } from "@components/alerts/NotFound";
|
||||
|
||||
import { Logs } from "@screens/Logs";
|
||||
import { Releases } from "@screens/Releases";
|
||||
import { Settings } from "@screens/Settings";
|
||||
import { Dashboard } from "@screens/Dashboard";
|
||||
import { Login, Onboarding } from "@screens/auth";
|
||||
import { Filters, FilterDetails } from "@screens/filters";
|
||||
import * as SettingsSubPage from "@screens/settings/index";
|
||||
|
||||
const BaseLayout = () => (
|
||||
<div className="min-h-screen">
|
||||
<Header />
|
||||
<Suspense fallback={<SectionLoader $size="xlarge" />}>
|
||||
<Outlet />
|
||||
</Suspense>
|
||||
</div>
|
||||
);
|
||||
|
||||
export const LocalRouter = ({ isLoggedIn }: { isLoggedIn: boolean }) => (
|
||||
<BrowserRouter basename={baseUrl()}>
|
||||
{isLoggedIn ? (
|
||||
<Routes>
|
||||
<Route path="*" element={<NotFound />} />
|
||||
<Route element={<BaseLayout />}>
|
||||
<Route index element={<Dashboard />} />
|
||||
<Route path="logs" element={<Logs />} />
|
||||
<Route path="releases" element={<Releases />} />
|
||||
<Route path="filters">
|
||||
<Route index element={<Filters />} />
|
||||
<Route path=":filterId/*" element={<FilterDetails />} />
|
||||
</Route>
|
||||
<Route path="settings" element={<Settings />}>
|
||||
<Route index element={<SettingsSubPage.Application />} />
|
||||
<Route path="logs" element={<SettingsSubPage.Logs />} />
|
||||
<Route path="api-keys" element={<SettingsSubPage.Api />} />
|
||||
<Route path="indexers" element={<SettingsSubPage.Indexer />} />
|
||||
<Route path="feeds" element={<SettingsSubPage.Feed />} />
|
||||
<Route path="irc" element={<SettingsSubPage.Irc />} />
|
||||
<Route path="clients" element={<SettingsSubPage.DownloadClient />} />
|
||||
<Route path="notifications" element={<SettingsSubPage.Notification />} />
|
||||
<Route path="releases" element={<SettingsSubPage.Release />} />
|
||||
<Route path="regex-playground" element={<SettingsSubPage.RegexPlayground />} />
|
||||
<Route path="account" element={<SettingsSubPage.Account />} />
|
||||
</Route>
|
||||
</Route>
|
||||
</Routes>
|
||||
) : (
|
||||
<Routes>
|
||||
<Route path="/onboard" element={<Onboarding />} />
|
||||
<Route path="*" element={<Login />} />
|
||||
</Routes>
|
||||
)}
|
||||
</BrowserRouter>
|
||||
);
|
Loading…
Add table
Add a link
Reference in a new issue