mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: remove all legacy redirects from routes
Removed /fullscreen redirect, old color tool redirects, and legacy /:toolId redirect. Clean route table with only active routes.
This commit is contained in:
+2
-30
@@ -1,6 +1,6 @@
|
|||||||
import { APP_VERSION, TOOLS, en, shouldShowConsent } from "@snapotter/shared";
|
import { APP_VERSION, en, shouldShowConsent } from "@snapotter/shared";
|
||||||
import { Component, type ErrorInfo, lazy, type ReactNode, Suspense, useEffect } from "react";
|
import { Component, type ErrorInfo, lazy, type ReactNode, Suspense, useEffect } from "react";
|
||||||
import { BrowserRouter, Navigate, Route, Routes, useLocation, useParams } from "react-router-dom";
|
import { BrowserRouter, Navigate, Route, Routes, useLocation } from "react-router-dom";
|
||||||
import { Toaster, toast } from "sonner";
|
import { Toaster, toast } from "sonner";
|
||||||
import { ConnectionMonitor } from "./components/common/connection-monitor";
|
import { ConnectionMonitor } from "./components/common/connection-monitor";
|
||||||
import { KeyboardShortcutProvider } from "./components/common/keyboard-shortcut-provider";
|
import { KeyboardShortcutProvider } from "./components/common/keyboard-shortcut-provider";
|
||||||
@@ -77,13 +77,6 @@ class ErrorBoundary extends Component<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function LegacyToolRedirect() {
|
|
||||||
const { toolId } = useParams<{ toolId: string }>();
|
|
||||||
const tool = TOOLS.find((t) => t.id === toolId);
|
|
||||||
if (tool) return <Navigate to={tool.route} replace />;
|
|
||||||
return <Navigate to="/" replace />;
|
|
||||||
}
|
|
||||||
|
|
||||||
function AuthGuard({ children }: { children: React.ReactNode }) {
|
function AuthGuard({ children }: { children: React.ReactNode }) {
|
||||||
const {
|
const {
|
||||||
loading,
|
loading,
|
||||||
@@ -241,31 +234,10 @@ export function App() {
|
|||||||
<Route path="/change-password" element={<ChangePasswordPage />} />
|
<Route path="/change-password" element={<ChangePasswordPage />} />
|
||||||
<Route path="/automate" element={<AutomatePage />} />
|
<Route path="/automate" element={<AutomatePage />} />
|
||||||
<Route path="/files" element={<FilesPage />} />
|
<Route path="/files" element={<FilesPage />} />
|
||||||
<Route path="/fullscreen" element={<Navigate to="/" replace />} />
|
|
||||||
<Route path="/privacy" element={<PrivacyPolicyPage />} />
|
<Route path="/privacy" element={<PrivacyPolicyPage />} />
|
||||||
{/* Redirects: old color tools consolidated into adjust-colors */}
|
|
||||||
<Route
|
|
||||||
path="/brightness-contrast"
|
|
||||||
element={<Navigate to="/image/adjust-colors" replace />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/saturation"
|
|
||||||
element={<Navigate to="/image/adjust-colors" replace />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/color-channels"
|
|
||||||
element={<Navigate to="/image/adjust-colors" replace />}
|
|
||||||
/>
|
|
||||||
<Route
|
|
||||||
path="/color-effects"
|
|
||||||
element={<Navigate to="/image/adjust-colors" replace />}
|
|
||||||
/>
|
|
||||||
<Route path="/analytics-consent" element={<AnalyticsConsentPage />} />
|
<Route path="/analytics-consent" element={<AnalyticsConsentPage />} />
|
||||||
<Route path="/editor" element={<EditorPage />} />
|
<Route path="/editor" element={<EditorPage />} />
|
||||||
{/* Modality-prefixed tool routes */}
|
|
||||||
<Route path="/:modality/:toolId" element={<ToolPage />} />
|
<Route path="/:modality/:toolId" element={<ToolPage />} />
|
||||||
{/* Legacy: redirect old /:toolId URLs to /:modality/:toolId */}
|
|
||||||
<Route path="/:toolId" element={<LegacyToolRedirect />} />
|
|
||||||
<Route path="/" element={<HomePage />} />
|
<Route path="/" element={<HomePage />} />
|
||||||
</Routes>
|
</Routes>
|
||||||
</Suspense>
|
</Suspense>
|
||||||
|
|||||||
Reference in New Issue
Block a user