feat(analysis): make analysis page work for all currencies (BELO, BLUE, BNA)
- Replace hardcoded BELO analysis with generic AnalysisPage - Add /quotes/analysis/ route with currency path param - Add currency selector tabs on analysis page - Dashboard QuoteCards now navigate to analysis for all currencies - Old /quotes/belo/analysis redirects to /quotes/analysis/BELO
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
import { AnalysisPage } from "@/features/analysis/AnalysisPage";
|
||||
|
||||
const VALID_CURRENCIES = ["BELO", "BLUE", "BNA"];
|
||||
|
||||
export const Route = createFileRoute(
|
||||
"/_authenticated/quotes/analysis/$currency",
|
||||
)({
|
||||
component: RouteComponent,
|
||||
loader: ({ params }) => {
|
||||
if (!VALID_CURRENCIES.includes(params.currency)) {
|
||||
throw redirect({ to: "/quotes" });
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
function RouteComponent() {
|
||||
const { currency } = Route.useParams();
|
||||
return <AnalysisPage currency={currency} />;
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { createFileRoute } from "@tanstack/react-router";
|
||||
import { BeloAnalysisPage } from "@/features/belo/BeloAnalysisPage";
|
||||
import { createFileRoute, redirect } from "@tanstack/react-router";
|
||||
|
||||
export const Route = createFileRoute("/_authenticated/quotes/belo/analysis")({
|
||||
component: BeloAnalysisPage,
|
||||
loader: () => {
|
||||
throw redirect({ to: "/quotes/analysis/$currency", params: { currency: "BELO" } });
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user