Files
frontend/src/features/instrument-details/ui/InstrumentQuoteStatus.view.tsx
T
ksv741 7c28a423dd
Frontend verify / commits (pull_request) Successful in 24s
Frontend verify / security (pull_request) Failing after 9s
Frontend verify / verify (pull_request) Skipped
refactor: tighten types and reuse instrument UI
2026-09-29 06:15:31 +03:00

34 lines
790 B
TypeScript

import type { FC } from "react";
import { Badge, Text } from "@mantine/core";
import { useTranslation } from "react-i18next";
import { formatSnapshotTime } from "@/shared/lib";
type InstrumentQuoteStatusProps = {
quote?: { priceAt: null | string; tradingStatus: null | string };
};
const InstrumentQuoteStatus: FC<InstrumentQuoteStatusProps> = (props) => {
const { quote } = props;
const { t } = useTranslation();
return (
<>
<Badge color="gray" variant="light">
{t(`stock.trading.${quote?.tradingStatus}`, {
defaultValue: t("stock.trading.unknown"),
})}
</Badge>
{!!quote?.priceAt && (
<Text c="dimmed" size="xs">
{t("stock.priceAt", { date: formatSnapshotTime(quote.priceAt) })}
</Text>
)}
</>
);
};
export { InstrumentQuoteStatus };