chore: finish frontend ESLint migration #18
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,9 +1,13 @@
|
||||
import { Card, Group, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import type { FC } from "react";
|
||||
|
||||
import { Card, Group, SimpleGrid, Stack, Text } from "@mantine/core";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import { formatDate, formatMoney, formatSnapshotTime } from "@/shared/lib";
|
||||
|
||||
import type { BrokerageAccountCard } from "../../model/display";
|
||||
|
||||
import { accountTypeKey } from "../../model/display";
|
||||
import classes from "./BrokerageAccountList.module.css";
|
||||
|
||||
@@ -31,18 +35,18 @@ const BrokerageAccountSummary: FC<BrokerageAccountSummaryProps> = (props) => {
|
||||
|
||||
return (
|
||||
<Stack className={classes.summary} gap={4}>
|
||||
{summary.totals.map((total) => (
|
||||
{summary.totals.map(total => (
|
||||
<Text className={classes.total} fw={700} key={total.currency}>
|
||||
{formatMoney(total)}
|
||||
</Text>
|
||||
))}
|
||||
{summary.remainingCurrencyCount ? (
|
||||
{!!(summary.remainingCurrencyCount) && ((
|
||||
<Text c="dimmed" size="sm">
|
||||
{t("accounts.remainingCurrencies", {
|
||||
count: summary.remainingCurrencyCount,
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
))}
|
||||
</Stack>
|
||||
);
|
||||
};
|
||||
@@ -53,37 +57,37 @@ const BrokerageAccountList: FC<BrokerageAccountListProps> = (props) => {
|
||||
|
||||
return (
|
||||
<SimpleGrid className={classes.list} cols={1} spacing="lg">
|
||||
{accounts.map(({ account, summary, positionCounts, source }) => (
|
||||
{accounts.map(({ account, positionCounts, source, summary }) => (
|
||||
<Card
|
||||
component={Link}
|
||||
to={`/accounts/${account.id}`}
|
||||
key={account.id}
|
||||
className={classes.card}
|
||||
component={Link}
|
||||
key={account.id}
|
||||
padding="xl"
|
||||
radius="lg"
|
||||
to={`/accounts/${account.id}`}
|
||||
withBorder
|
||||
>
|
||||
<Stack className={classes.identity} gap="sm">
|
||||
<Group justify="space-between" wrap="nowrap" gap="sm">
|
||||
<Text className={classes.kicker} size="xs" fw={700}>
|
||||
<Group gap="sm" justify="space-between" wrap="nowrap">
|
||||
<Text className={classes.kicker} fw={700} size="xs">
|
||||
{t(accountTypeKey(account.type))}
|
||||
</Text>
|
||||
<svg
|
||||
aria-hidden="true"
|
||||
className={classes.accountIcon}
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
focusable="false"
|
||||
stroke="currentColor"
|
||||
strokeWidth="1.5"
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
aria-hidden="true"
|
||||
focusable="false"
|
||||
strokeWidth="1.5"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<rect x="3" y="5" width="18" height="15" rx="3" />
|
||||
<rect height="15" rx="3" width="18" x="3" y="5" />
|
||||
<path d="M3 9h18M7 15h3M14 5V3H7a4 4 0 0 0-4 4" />
|
||||
</svg>
|
||||
</Group>
|
||||
<Text component="h2" className={classes.name} fw={700}>
|
||||
<Text className={classes.name} component="h2" fw={700}>
|
||||
{account.name}
|
||||
</Text>
|
||||
</Stack>
|
||||
@@ -92,27 +96,27 @@ const BrokerageAccountList: FC<BrokerageAccountListProps> = (props) => {
|
||||
{t("accounts.currentValue")}
|
||||
</Text>
|
||||
<BrokerageAccountSummary summary={summary} />
|
||||
{source?.lastSuccessfulAt ? (
|
||||
<Text size="xs" c="dimmed">
|
||||
{!!(source?.lastSuccessfulAt) && ((
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("investment.sourceTime", {
|
||||
date: formatSnapshotTime(source.lastSuccessfulAt),
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
{source?.sync.state === "running" ||
|
||||
source?.sync.state === "queued" ? (
|
||||
<Text size="xs" role="status">
|
||||
))}
|
||||
{(source?.sync.state === "running"
|
||||
|| source?.sync.state === "queued") && ((
|
||||
<Text role="status" size="xs">
|
||||
{t("accounts.refreshing")}
|
||||
</Text>
|
||||
) : null}
|
||||
{source?.sync.state === "failed" ? (
|
||||
))}
|
||||
{(source?.sync.state === "failed") && ((
|
||||
<Text size="xs">{t("accounts.refreshError")}</Text>
|
||||
) : null}
|
||||
{source?.freshness === "stale" ? (
|
||||
))}
|
||||
{(source?.freshness === "stale") && ((
|
||||
<Text size="xs">{t("investment.stale")}</Text>
|
||||
) : null}
|
||||
))}
|
||||
</Stack>
|
||||
{positionCounts ? (
|
||||
{!!(positionCounts) && ((
|
||||
<dl className={classes.positions}>
|
||||
<div className={classes.stocks}>
|
||||
<dt>{t("accounts.stocks")}</dt>
|
||||
@@ -127,18 +131,18 @@ const BrokerageAccountList: FC<BrokerageAccountListProps> = (props) => {
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
) : null}
|
||||
<Group className={classes.footer} justify="space-between" gap="sm">
|
||||
{account.openedOn ? (
|
||||
))}
|
||||
<Group className={classes.footer} gap="sm" justify="space-between">
|
||||
{!!(account.openedOn) && ((
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("accounts.openedOn", {
|
||||
date: formatDate(account.openedOn),
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
<Text component="span" className={classes.open} size="sm" fw={600}>
|
||||
))}
|
||||
<Text className={classes.open} component="span" fw={600} size="sm">
|
||||
{t("accounts.openAccount")}
|
||||
<span className={classes.arrow} aria-hidden="true">
|
||||
<span aria-hidden="true" className={classes.arrow}>
|
||||
→
|
||||
</span>
|
||||
</Text>
|
||||
|
||||
Reference in New Issue
Block a user