chore: finish frontend ESLint migration #18
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
Frontend security / security (push) Successful in 9s
Frontend verify / verify (push) Failing after 37m50s
Frontend security / security (pull_request) Successful in 9s
Frontend verify / verify (pull_request) Failing after 42m10s
Conventional commits / commits (pull_request) Successful in 29s
Enable every plugin recommended preset and replace Biome with ESLint formatting. Preserve API contracts and JSX whitespace; verify source, tests, builds and tooling.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
import { useDocumentTitle } from "@mantine/hooks";
|
||||
import type { FC } from "react";
|
||||
|
||||
import { useDocumentTitle } from "@mantine/hooks";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { useMatch } from "react-router";
|
||||
|
||||
import { useBankCard } from "@/entities/bank-card";
|
||||
import { useBond } from "@/entities/bond";
|
||||
import { useBrokerageAccounts } from "@/entities/brokerage-account";
|
||||
@@ -9,10 +11,9 @@ import { useStock } from "@/entities/stock";
|
||||
|
||||
type DocumentTitleProps = { title: string };
|
||||
|
||||
const DocumentTitle: FC<DocumentTitleProps> = (props) => {
|
||||
const DocumentTitle: FC<DocumentTitleProps> = (props): undefined => {
|
||||
const { t } = useTranslation();
|
||||
useDocumentTitle(`${props.title} — ${t("appName")}`);
|
||||
return null;
|
||||
};
|
||||
|
||||
type AccountDocumentTitleProps = {
|
||||
@@ -23,19 +24,29 @@ type AccountDocumentTitleProps = {
|
||||
const AccountDocumentTitle: FC<AccountDocumentTitleProps> = (props) => {
|
||||
const { t } = useTranslation();
|
||||
const { data } = useBrokerageAccounts();
|
||||
const accountName =
|
||||
props.accountId === "all"
|
||||
const accountName
|
||||
= props.accountId === "all"
|
||||
? t("accounts.all")
|
||||
: (data?.find((account) => account.id === props.accountId)?.name ??
|
||||
t("account.title"));
|
||||
const section =
|
||||
props.section === "income"
|
||||
? t("income.title")
|
||||
: props.section === "operations"
|
||||
? t("ledger.title")
|
||||
: props.section === "events"
|
||||
? t("events.title")
|
||||
: t("portfolio.title");
|
||||
: (data?.find(account => account.id === props.accountId)?.name
|
||||
?? t("account.title"));
|
||||
let section = t("portfolio.title");
|
||||
switch (props.section ?? "") {
|
||||
case "income": {
|
||||
section = t("income.title");
|
||||
break;
|
||||
}
|
||||
case "operations": {
|
||||
section = t("ledger.title");
|
||||
break;
|
||||
}
|
||||
case "events": {
|
||||
section = t("events.title");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return <DocumentTitle title={`${section} — ${accountName}`} />;
|
||||
};
|
||||
|
||||
@@ -80,21 +91,10 @@ const ProtectedDocumentTitle: FC = () => {
|
||||
if (bond) return <BondDocumentTitle identifier={bond.params.bondId ?? ""} />;
|
||||
if (stock)
|
||||
return <StockDocumentTitle identifier={stock.params.stockId ?? ""} />;
|
||||
return (
|
||||
<DocumentTitle
|
||||
title={t(
|
||||
cards
|
||||
? "navigation.cards"
|
||||
: bonds
|
||||
? "navigation.bonds"
|
||||
: stocks
|
||||
? "navigation.stocks"
|
||||
: settings
|
||||
? "navigation.settings"
|
||||
: "navigation.accounts",
|
||||
)}
|
||||
/>
|
||||
);
|
||||
if (cards) return <DocumentTitle title={t("navigation.cards")} />;
|
||||
if (bonds) return <DocumentTitle title={t("navigation.bonds")} />;
|
||||
if (stocks) return <DocumentTitle title={t("navigation.stocks")} />;
|
||||
return settings ? <DocumentTitle title={t("navigation.settings")} /> : <DocumentTitle title={t("navigation.accounts")} />;
|
||||
};
|
||||
|
||||
export { ProtectedDocumentTitle };
|
||||
|
||||
Reference in New Issue
Block a user