refactor: clarify frontend model ownership
This commit is contained in:
@@ -9,12 +9,8 @@ import type { Portfolio } from "@/entities/portfolio";
|
||||
import { BrokerageEventsPreview } from "@/entities/brokerage-event";
|
||||
import { formatSnapshotTime } from "@/shared/lib";
|
||||
|
||||
import type {
|
||||
AccountPageIncomeSummary,
|
||||
AccountPagePositionSection,
|
||||
AccountPageRecentEvents,
|
||||
AccountPageRecentOperations,
|
||||
} from "../AccountPage.vm";
|
||||
import type { AccountPagePositionSection } from "../../../model/positions";
|
||||
import type { AccountPageIncomeSummary, AccountPageRecentEvents, AccountPageRecentOperations } from "../AccountPage.vm";
|
||||
|
||||
import classes from "../AccountPage.module.css";
|
||||
import { AccountHeading } from "./AccountHeading.view";
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||
|
||||
import type { AccountPagePosition } from "../../AccountPage.vm";
|
||||
import type { AccountPagePosition } from "../../../../model/positions";
|
||||
|
||||
import { PositionCard } from "./PositionCard.view";
|
||||
|
||||
|
||||
@@ -6,10 +6,7 @@ import { Link } from "react-router";
|
||||
|
||||
import { formatMoney } from "@/shared/lib";
|
||||
|
||||
import type {
|
||||
AccountPagePosition,
|
||||
AccountPagePositionSection,
|
||||
} from "../../AccountPage.vm";
|
||||
import type { AccountPagePosition, AccountPagePositionSection } from "../../../../model/positions";
|
||||
|
||||
import classes from "../../AccountPage.module.css";
|
||||
import { PositionLogo } from "../PositionLogo.view";
|
||||
|
||||
@@ -6,10 +6,7 @@ import { Link } from "react-router";
|
||||
|
||||
import { formatMoney } from "@/shared/lib";
|
||||
|
||||
import type {
|
||||
AccountPagePositionGroup,
|
||||
AccountPagePositionSection,
|
||||
} from "../AccountPage.vm";
|
||||
import type { AccountPagePositionGroup, AccountPagePositionSection } from "../../../model/positions";
|
||||
|
||||
import classes from "../AccountPage.module.css";
|
||||
import { PositionLogo } from "./PositionLogo.view";
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import type { FC } from "react";
|
||||
|
||||
import { Anchor, Avatar } from "@mantine/core";
|
||||
import { useState } from "react";
|
||||
import { Link } from "react-router";
|
||||
|
||||
import { useImageFallback } from "@/shared/lib";
|
||||
|
||||
type PositionLogoProps = {
|
||||
label: string;
|
||||
src: null | string;
|
||||
@@ -13,7 +12,9 @@ type PositionLogoProps = {
|
||||
|
||||
const PositionLogo: FC<PositionLogoProps> = (props) => {
|
||||
const { label, src } = props;
|
||||
const { failed, onError } = useImageFallback();
|
||||
const [failed, setFailed] = useState(false);
|
||||
// eslint-disable-next-line frontend/readability -- Rendering fallback belongs to this keyed logo, without page data or actions.
|
||||
const onError = () => setFailed(true);
|
||||
|
||||
const logo
|
||||
= src && !failed
|
||||
|
||||
@@ -2,7 +2,7 @@ import type { FC } from "react";
|
||||
|
||||
import { SimpleGrid } from "@mantine/core";
|
||||
|
||||
import type { AccountPagePositionSection } from "../AccountPage.vm";
|
||||
import type { AccountPagePositionSection } from "../../../model/positions";
|
||||
|
||||
import { PositionCard } from "./PositionCard/PositionCard.view";
|
||||
import { PositionGroupCard } from "./PositionGroupCard.view";
|
||||
|
||||
Reference in New Issue
Block a user