refactor: refactor foundation

This commit is contained in:
2026-08-14 09:43:19 +03:00
parent 2e32d226d3
commit da585b157a
54 changed files with 4822 additions and 535 deletions
+1 -6
View File
@@ -1,6 +1 @@
export {
AccountPage,
AccountPageEmpty,
AccountPageError,
AccountPageLoading,
} from "./ui/AccountPage";
export { AccountPage } from "./ui/AccountPage";
+1 -1
View File
@@ -2,7 +2,7 @@ import { MantineProvider } from "@mantine/core";
import { cleanup, render, screen } from "@testing-library/react";
import { MemoryRouter } from "react-router";
import { afterEach, describe, expect, it, vi } from "vitest";
import type { Portfolio } from "../../../entities/portfolio";
import type { Portfolio } from "@/entities/portfolio";
import {
AccountPageEmpty,
AccountPageError,
+5 -5
View File
@@ -15,16 +15,16 @@ import { Link, useParams } from "react-router";
import {
accountTypeKey,
type BrokerageAccount,
} from "../../../entities/brokerage-account";
import type { Portfolio } from "../../../entities/portfolio";
} from "@/entities/brokerage-account";
import type { Portfolio } from "@/entities/portfolio";
import {
formatMoney,
formatSnapshotTime,
portfolioErrorCode,
usePortfolio,
} from "../../../entities/portfolio";
import { useAuth } from "../../../features/auth";
import { StateView } from "../../../shared/ui/StateView";
} from "@/entities/portfolio";
import { useAuth } from "@/features/auth";
import { StateView } from "@/shared/ui";
import classes from "./AccountPage.module.css";
const accountsQueryKey = ["brokerage-accounts"] as const;
+3 -3
View File
@@ -5,9 +5,9 @@ import {
BrokerageAccountList,
errorCode,
useBrokerageAccounts,
} from "../../../entities/brokerage-account";
import { useAuth } from "../../../features/auth";
import { StateView } from "../../../shared/ui/StateView";
} from "@/entities/brokerage-account";
import { useAuth } from "@/features/auth";
import { StateView } from "@/shared/ui";
export function AccountsPage() {
const { t } = useTranslation();
+1 -6
View File
@@ -1,6 +1 @@
export {
LoginPage,
LoginPageEmpty,
LoginPageError,
LoginPageLoading,
} from "./ui/LoginPage";
export { LoginPage } from "./ui/LoginPage";
+1 -31
View File
@@ -1,7 +1,6 @@
import { Paper, Stack, Title } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { LoginForm } from "../../../features/auth";
import { StateView } from "../../../shared/ui/StateView";
import { LoginForm } from "@/features/auth";
export function LoginPage() {
const { t } = useTranslation();
@@ -16,32 +15,3 @@ export function LoginPage() {
</main>
);
}
export function LoginPageLoading() {
const { t } = useTranslation();
return (
<StateView
loading
title={t("states.loadingTitle")}
text={t("states.loadingText")}
/>
);
}
export function LoginPageError() {
const { t } = useTranslation();
return (
<StateView
error
title={t("states.errorTitle")}
text={t("states.errorText")}
/>
);
}
export function LoginPageEmpty() {
const { t } = useTranslation();
return (
<StateView title={t("states.emptyTitle")} text={t("states.emptyText")} />
);
}
+1 -6
View File
@@ -1,6 +1 @@
export {
NotFoundPage,
NotFoundPageEmpty,
NotFoundPageError,
NotFoundPageLoading,
} from "./ui/NotFoundPage";
export { NotFoundPage } from "./ui/NotFoundPage";
+2 -24
View File
@@ -1,7 +1,7 @@
import { Stack, Title } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { Link } from "react-router";
import { Button, StateView } from "../../../shared/ui/StateView";
import { Button, StateView } from "@/shared/ui";
export function NotFoundPage() {
const { t } = useTranslation();
@@ -13,29 +13,7 @@ export function NotFoundPage() {
);
}
export function NotFoundPageLoading() {
const { t } = useTranslation();
return (
<StateView
loading
title={t("states.loadingTitle")}
text={t("states.loadingText")}
/>
);
}
export function NotFoundPageError() {
const { t } = useTranslation();
return (
<StateView
error
title={t("states.errorTitle")}
text={t("states.errorText")}
/>
);
}
export function NotFoundPageEmpty() {
function NotFoundPageEmpty() {
const { t } = useTranslation();
return (
<StateView
+1 -6
View File
@@ -1,6 +1 @@
export {
RegisterPage,
RegisterPageEmpty,
RegisterPageError,
RegisterPageLoading,
} from "./ui/RegisterPage";
export { RegisterPage } from "./ui/RegisterPage";
+1 -31
View File
@@ -1,7 +1,6 @@
import { Paper, Stack, Title } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { RegisterForm } from "../../../features/auth";
import { StateView } from "../../../shared/ui/StateView";
import { RegisterForm } from "@/features/auth";
export function RegisterPage() {
const { t } = useTranslation();
@@ -16,32 +15,3 @@ export function RegisterPage() {
</main>
);
}
export function RegisterPageLoading() {
const { t } = useTranslation();
return (
<StateView
loading
title={t("states.loadingTitle")}
text={t("states.loadingText")}
/>
);
}
export function RegisterPageError() {
const { t } = useTranslation();
return (
<StateView
error
title={t("states.errorTitle")}
text={t("states.errorText")}
/>
);
}
export function RegisterPageEmpty() {
const { t } = useTranslation();
return (
<StateView title={t("states.emptyTitle")} text={t("states.emptyText")} />
);
}
+1 -6
View File
@@ -1,6 +1 @@
export {
SettingsPage,
SettingsPageEmpty,
SettingsPageError,
SettingsPageLoading,
} from "./ui/SettingsPage";
export { SettingsPage } from "./ui/SettingsPage";
+2 -32
View File
@@ -1,9 +1,8 @@
import { Button, Stack, Title } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { useNavigate } from "react-router";
import { useAuth } from "../../../features/auth";
import { TbankConnectionSection } from "../../../features/tbank-connection";
import { StateView } from "../../../shared/ui/StateView";
import { useAuth } from "@/features/auth";
import { TbankConnectionSection } from "@/features/tbank-connection";
export function SettingsPage() {
const { t } = useTranslation();
@@ -24,32 +23,3 @@ export function SettingsPage() {
</Stack>
);
}
export function SettingsPageLoading() {
const { t } = useTranslation();
return (
<StateView
loading
title={t("states.loadingTitle")}
text={t("states.loadingText")}
/>
);
}
export function SettingsPageError() {
const { t } = useTranslation();
return (
<StateView
error
title={t("states.errorTitle")}
text={t("states.errorText")}
/>
);
}
export function SettingsPageEmpty() {
const { t } = useTranslation();
return (
<StateView title={t("states.emptyTitle")} text={t("states.emptyText")} />
);
}