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,15 +1,19 @@
|
||||
import type { FC } from "react";
|
||||
|
||||
import { Anchor, Group, Text } from "@mantine/core";
|
||||
import { EntryCard } from "@wealthledger/ui";
|
||||
import type { FC } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import {
|
||||
formatDecimal,
|
||||
formatMoney,
|
||||
formatSnapshotTime,
|
||||
instrumentLogoUrl,
|
||||
} from "@/shared/lib";
|
||||
|
||||
import type { BrokerageOperation } from "../api/useBrokerageOperations";
|
||||
|
||||
import { operationLabelKey, paymentPresentation } from "../model/display";
|
||||
|
||||
type LedgerEntryRowProps = {
|
||||
@@ -20,55 +24,57 @@ type LedgerEntryRowProps = {
|
||||
const LedgerEntryRow: FC<LedgerEntryRowProps> = (props) => {
|
||||
const { operation } = props;
|
||||
const { t } = useTranslation();
|
||||
const instrument =
|
||||
operation.ticker ?? operation.instrumentType ?? t("ledger.noInstrument");
|
||||
const instrument
|
||||
= operation.ticker ?? operation.instrumentType ?? t("ledger.noInstrument");
|
||||
const payment = paymentPresentation(operation);
|
||||
const metadata = [
|
||||
t("ledger.occurredAt", { date: formatSnapshotTime(operation.occurredAt) }),
|
||||
instrument,
|
||||
props.withDetails ? null : operation.account?.name,
|
||||
props.withDetails ? /* eslint-disable-line unicorn/no-null -- Preserve the nullable domain value consumed by this view model. */ null : operation.account?.name,
|
||||
]
|
||||
.filter(Boolean)
|
||||
.join(" · ");
|
||||
|
||||
return (
|
||||
<EntryCard
|
||||
title={operation.description || t(operationLabelKey(operation.type))}
|
||||
metadata={metadata}
|
||||
details={
|
||||
props.withDetails ? (
|
||||
<>
|
||||
<Group gap="sm">
|
||||
{operation.quantity != null ? (
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("ledger.quantity", {
|
||||
value: formatDecimal(operation.quantity),
|
||||
})}
|
||||
</Text>
|
||||
) : null}
|
||||
{operation.price ? (
|
||||
<Text size="xs" c="dimmed">
|
||||
{t("ledger.price", { value: formatMoney(operation.price) })}
|
||||
</Text>
|
||||
) : null}
|
||||
</Group>
|
||||
{operation.account ? (
|
||||
<Anchor
|
||||
component={Link}
|
||||
size="sm"
|
||||
to={`/accounts/${encodeURIComponent(operation.account.id)}`}
|
||||
>
|
||||
{operation.account.name}
|
||||
</Anchor>
|
||||
) : null}
|
||||
</>
|
||||
) : undefined
|
||||
(props.withDetails)
|
||||
? ((
|
||||
<>
|
||||
<Group gap="sm">
|
||||
{operation.quantity != undefined && ((
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("ledger.quantity", {
|
||||
value: formatDecimal(operation.quantity),
|
||||
})}
|
||||
</Text>
|
||||
))}
|
||||
{!!(operation.price) && ((
|
||||
<Text c="dimmed" size="xs">
|
||||
{t("ledger.price", { value: formatMoney(operation.price) })}
|
||||
</Text>
|
||||
))}
|
||||
</Group>
|
||||
{!!(operation.account) && ((
|
||||
<Anchor
|
||||
component={Link}
|
||||
size="sm"
|
||||
to={`/accounts/${encodeURIComponent(operation.account.id)}`}
|
||||
>
|
||||
{operation.account.name}
|
||||
</Anchor>
|
||||
))}
|
||||
</>
|
||||
))
|
||||
: undefined
|
||||
}
|
||||
initial={(instrument.trim()[0] ?? "?").toUpperCase()}
|
||||
imageSrc={instrumentLogoUrl(operation.logoName)}
|
||||
initial={(instrument.trim()[0] ?? "?").toUpperCase()}
|
||||
metadata={metadata}
|
||||
title={operation.description || t(operationLabelKey(operation.type))}
|
||||
tone={payment.tone}
|
||||
value={payment.amount}
|
||||
valueLabel={t(payment.label)}
|
||||
tone={payment.tone}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user