diff --git a/src/pages/account/ui/AccountPage.test.tsx b/src/pages/account/ui/AccountPage.test.tsx index fc6f0f8..bb93e91 100644 --- a/src/pages/account/ui/AccountPage.test.tsx +++ b/src/pages/account/ui/AccountPage.test.tsx @@ -67,6 +67,7 @@ const portfolio: Portfolio = { averagePurchasePrice: null, absoluteReturn: null, isin: null, + ticker: null, logoName: "vtoraya.png", }, { @@ -78,6 +79,7 @@ const portfolio: Portfolio = { averagePurchasePrice: { currency: "RUB", value: "11" }, absoluteReturn: { currency: "RUB", value: "-1" }, isin: "RU000A0JX0J2", + ticker: null, logoName: null, }, ], @@ -193,6 +195,7 @@ describe("AccountPage states", () => { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "3" }, isin: null, + ticker: null, logoName: null, }, { @@ -204,6 +207,7 @@ describe("AccountPage states", () => { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "0" }, isin: null, + ticker: null, logoName: null, }, ], @@ -232,6 +236,7 @@ describe("AccountPage states", () => { averagePurchasePrice: { currency: "RUB", value: "11" }, absoluteReturn: { currency: "RUB", value: "3" }, isin: "RU000QUIET1", + ticker: null, logoName: null, }, ], @@ -247,6 +252,62 @@ describe("AccountPage states", () => { ).toBeInTheDocument(); }); + it("uses the ticker only for stock cards and otherwise keeps the ISIN", () => { + renderPage( + , + ); + + expect(screen.getByText("Количество: 1 · SBER")).toBeInTheDocument(); + expect(screen.queryByText("STOCK-ISIN")).not.toBeInTheDocument(); + expect( + screen.getByText("Количество: 2 · FALLBACK-ISIN"), + ).toBeInTheDocument(); + expect(screen.getByText("Количество: 3 · BOND-ISIN")).toBeInTheDocument(); + expect(screen.queryByText("OFZ")).not.toBeInTheDocument(); + }); + it("renders bond cards with logo, fallback, and signed unlabeled return like stocks", () => { renderPage( { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "2" }, isin: "RU000C0XY1Z3", + ticker: null, logoName: "dolg.png", }, { @@ -273,6 +335,7 @@ describe("AccountPage states", () => { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "0" }, isin: null, + ticker: null, logoName: null, }, ], @@ -307,6 +370,7 @@ describe("AccountPage states", () => { averagePurchasePrice: { currency: "RUB", value: "950" }, absoluteReturn: { currency: "RUB", value: "50" }, isin: "RU000B0ND123", + ticker: null, logoName: null, }, ], @@ -355,6 +419,7 @@ describe("AccountPage states", () => { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "-5" }, isin: null, + ticker: null, logoName: "fond.png", }, ], diff --git a/src/pages/account/ui/AccountPage.vm.test.tsx b/src/pages/account/ui/AccountPage.vm.test.tsx index dba445e..aa76752 100644 --- a/src/pages/account/ui/AccountPage.vm.test.tsx +++ b/src/pages/account/ui/AccountPage.vm.test.tsx @@ -24,6 +24,7 @@ const portfolio: Portfolio = { averagePurchasePrice: null, absoluteReturn: { currency: "RUB", value: "10" }, isin: null, + ticker: null, logoName: "akciya.png", }, { @@ -35,6 +36,7 @@ const portfolio: Portfolio = { averagePurchasePrice: { currency: "RUB", value: "45" }, absoluteReturn: { currency: "RUB", value: "-5" }, isin: "RU000A0JX0J2", + ticker: null, logoName: null, }, { @@ -46,6 +48,7 @@ const portfolio: Portfolio = { averagePurchasePrice: null, absoluteReturn: null, isin: null, + ticker: null, logoName: "fond.png", }, ], diff --git a/src/pages/account/ui/components/PositionCard.view.tsx b/src/pages/account/ui/components/PositionCard.view.tsx index 8a76ce9..aada142 100644 --- a/src/pages/account/ui/components/PositionCard.view.tsx +++ b/src/pages/account/ui/components/PositionCard.view.tsx @@ -45,9 +45,11 @@ const PositionCard: FC = (props) => { value: position.returnText, }) : null; + const identifier = + variant === "stock" ? (position.ticker ?? position.isin) : position.isin; const identifierText = [ t("portfolio.quantity", { value: position.quantity }), - position.isin, + identifier, ] .filter(Boolean) .join(" · "); diff --git a/src/shared/api/generated/schema.d.ts b/src/shared/api/generated/schema.d.ts index 7bffb18..7a06e7d 100644 --- a/src/shared/api/generated/schema.d.ts +++ b/src/shared/api/generated/schema.d.ts @@ -258,6 +258,7 @@ export interface components { averagePurchasePrice: components["schemas"]["MoneyDto"] | null; absoluteReturn: components["schemas"]["MoneyDto"] | null; isin: string | null; + ticker: string | null; logoName: string | null; }; PortfolioDto: { diff --git a/src/shared/api/spec/openapi.json b/src/shared/api/spec/openapi.json index 6f9ac72..50654ce 100644 --- a/src/shared/api/spec/openapi.json +++ b/src/shared/api/spec/openapi.json @@ -1375,6 +1375,10 @@ "type": "string", "nullable": true }, + "ticker": { + "type": "string", + "nullable": true + }, "logoName": { "type": "string", "nullable": true @@ -1389,6 +1393,7 @@ "averagePurchasePrice", "absoluteReturn", "isin", + "ticker", "logoName" ] },