refactor: clarify frontend module ownership
This commit is contained in:
@@ -2,7 +2,8 @@ import type { FC } from "react";
|
||||
|
||||
import { Stack } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMatch } from "react-router";
|
||||
|
||||
import { useCurrentRoute } from "@/app/model";
|
||||
|
||||
import { AccountBreadcrumbs } from "./AccountBreadcrumbs";
|
||||
import { AccountScopeSwitch } from "./AccountScopeSwitch/AccountScopeSwitch";
|
||||
@@ -14,19 +15,17 @@ import { StockBreadcrumbs } from "./StockBreadcrumbs";
|
||||
const AppBreadcrumbs: FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
const account = useMatch("/accounts/:accountId/:section?");
|
||||
const {
|
||||
account,
|
||||
accounts,
|
||||
bond,
|
||||
card,
|
||||
cards,
|
||||
section,
|
||||
settings,
|
||||
stock,
|
||||
} = useCurrentRoute();
|
||||
|
||||
const section = (["events", "income", "operations"] as const).find(
|
||||
value => value === account?.params.section?.toLowerCase(),
|
||||
);
|
||||
|
||||
const card = useMatch("/cards/:cardId");
|
||||
const cards = useMatch("/cards");
|
||||
const accounts = useMatch({ end: true, path: "/accounts" });
|
||||
const settings = useMatch({ end: true, path: "/settings" });
|
||||
|
||||
const stock = useMatch({ end: true, path: "/stocks/:stockId" });
|
||||
const bond = useMatch({ end: true, path: "/bonds/:bondId" });
|
||||
if (bond) return <BondBreadcrumbs identifier={bond.params.bondId ?? ""} />;
|
||||
if (stock)
|
||||
return <StockBreadcrumbs identifier={stock.params.stockId ?? ""} />;
|
||||
|
||||
Reference in New Issue
Block a user