From d95b2df46001b481d4f414f3272a13a1085bc329 Mon Sep 17 00:00:00 2001 From: Sergey Krylov Date: Sat, 20 Jun 2026 13:35:58 +0300 Subject: [PATCH] refactor(frontend): update legacy imports to use @/shared/ --- apps/frontend/src/components/BondDetails.tsx | 2 +- apps/frontend/src/components/StockDetails.tsx | 2 +- .../frontend/src/components/portfolios/AllocationChart.tsx | 2 +- .../src/components/portfolios/AnalyticsSummary.tsx | 2 +- .../frontend/src/components/portfolios/BondPositionRow.tsx | 2 +- .../src/components/portfolios/BondPositionTable.tsx | 2 +- apps/frontend/src/components/portfolios/PortfolioCard.tsx | 2 +- apps/frontend/src/components/portfolios/PortfolioForm.tsx | 2 +- .../src/components/portfolios/PortfolioSummary.tsx | 2 +- .../src/components/portfolios/SharePositionRow.tsx | 2 +- .../src/components/portfolios/SharePositionTable.tsx | 2 +- apps/frontend/src/components/screener/ScreenerTable.tsx | 2 +- apps/frontend/src/context/AuthContext.tsx | 4 ++-- apps/frontend/src/hooks/useBond.ts | 4 ++-- apps/frontend/src/hooks/useBondCandles.ts | 4 ++-- .../frontend/src/hooks/useBrokerAccountPortfolios.test.tsx | 2 +- apps/frontend/src/hooks/usePortfolio.ts | 2 +- apps/frontend/src/hooks/usePortfolioAnalytics.ts | 2 +- apps/frontend/src/hooks/usePortfolios.ts | 2 +- apps/frontend/src/hooks/usePositionMutations.ts | 2 +- apps/frontend/src/hooks/useSearch.ts | 4 ++-- apps/frontend/src/hooks/useStock.ts | 4 ++-- apps/frontend/src/hooks/useStockCandles.ts | 4 ++-- apps/frontend/src/hooks/useStockDividends.ts | 4 ++-- apps/frontend/src/pages/broker/BrokerAccountsPage.test.tsx | 2 +- apps/frontend/src/pages/broker/BrokerPages.test.tsx | 2 +- apps/frontend/src/test/factories.ts | 2 +- apps/frontend/src/test/handlers.ts | 7 ++++++- 28 files changed, 40 insertions(+), 35 deletions(-) diff --git a/apps/frontend/src/components/BondDetails.tsx b/apps/frontend/src/components/BondDetails.tsx index 07f8f90..dbf7588 100644 --- a/apps/frontend/src/components/BondDetails.tsx +++ b/apps/frontend/src/components/BondDetails.tsx @@ -1,4 +1,4 @@ -import type { BondResponse } from '../api/responses'; +import type { BondResponse } from '@/shared/api/responses'; interface BondDetailsProps { bond: BondResponse; diff --git a/apps/frontend/src/components/StockDetails.tsx b/apps/frontend/src/components/StockDetails.tsx index 0d4ba4b..a078ac3 100644 --- a/apps/frontend/src/components/StockDetails.tsx +++ b/apps/frontend/src/components/StockDetails.tsx @@ -1,4 +1,4 @@ -import type { ShareResponse } from '../api/responses'; +import type { ShareResponse } from '@/shared/api/responses'; interface StockDetailsProps { stock: ShareResponse; diff --git a/apps/frontend/src/components/portfolios/AllocationChart.tsx b/apps/frontend/src/components/portfolios/AllocationChart.tsx index 1a22c4f..275b9ed 100644 --- a/apps/frontend/src/components/portfolios/AllocationChart.tsx +++ b/apps/frontend/src/components/portfolios/AllocationChart.tsx @@ -1,4 +1,4 @@ -import type { PositionWithPrice } from '../../api/responses'; +import type { PositionWithPrice } from '@/shared/api/responses'; interface AllocationChartProps { positions: PositionWithPrice[]; diff --git a/apps/frontend/src/components/portfolios/AnalyticsSummary.tsx b/apps/frontend/src/components/portfolios/AnalyticsSummary.tsx index 86d6add..b2139ba 100644 --- a/apps/frontend/src/components/portfolios/AnalyticsSummary.tsx +++ b/apps/frontend/src/components/portfolios/AnalyticsSummary.tsx @@ -1,4 +1,4 @@ -import type { PortfolioSummary } from '../../api/responses'; +import type { PortfolioSummary } from '@/shared/api/responses'; export function AnalyticsSummary({ summary }: { summary: PortfolioSummary }) { const formatRub = (val: number | null) => diff --git a/apps/frontend/src/components/portfolios/BondPositionRow.tsx b/apps/frontend/src/components/portfolios/BondPositionRow.tsx index 41cabe5..e1ae9b6 100644 --- a/apps/frontend/src/components/portfolios/BondPositionRow.tsx +++ b/apps/frontend/src/components/portfolios/BondPositionRow.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { Link } from 'react-router-dom'; -import type { PositionWithPrice } from '../../api/responses'; +import type { PositionWithPrice } from '@/shared/api/responses'; interface Props { position: PositionWithPrice; diff --git a/apps/frontend/src/components/portfolios/BondPositionTable.tsx b/apps/frontend/src/components/portfolios/BondPositionTable.tsx index 349900c..c1dfc2b 100644 --- a/apps/frontend/src/components/portfolios/BondPositionTable.tsx +++ b/apps/frontend/src/components/portfolios/BondPositionTable.tsx @@ -1,5 +1,5 @@ import { BondPositionRow } from './BondPositionRow'; -import type { PositionWithPrice } from '../../api/responses'; +import type { PositionWithPrice } from '@/shared/api/responses'; interface Props { positions: PositionWithPrice[]; diff --git a/apps/frontend/src/components/portfolios/PortfolioCard.tsx b/apps/frontend/src/components/portfolios/PortfolioCard.tsx index 5d3e094..9c36320 100644 --- a/apps/frontend/src/components/portfolios/PortfolioCard.tsx +++ b/apps/frontend/src/components/portfolios/PortfolioCard.tsx @@ -1,5 +1,5 @@ import { Link } from 'react-router-dom'; -import type { Portfolio } from '../../api/responses'; +import type { Portfolio } from '@/shared/api/responses'; export function PortfolioCard({ portfolio }: { portfolio: Portfolio }) { const chipStyle = (bg: string): React.CSSProperties => ({ diff --git a/apps/frontend/src/components/portfolios/PortfolioForm.tsx b/apps/frontend/src/components/portfolios/PortfolioForm.tsx index 505c432..870f288 100644 --- a/apps/frontend/src/components/portfolios/PortfolioForm.tsx +++ b/apps/frontend/src/components/portfolios/PortfolioForm.tsx @@ -1,5 +1,5 @@ import { useState } from 'react'; -import type { Portfolio } from '../../api/responses'; +import type { Portfolio } from '@/shared/api/responses'; interface Props { initial?: Portfolio; diff --git a/apps/frontend/src/components/portfolios/PortfolioSummary.tsx b/apps/frontend/src/components/portfolios/PortfolioSummary.tsx index b126e3d..98dfabf 100644 --- a/apps/frontend/src/components/portfolios/PortfolioSummary.tsx +++ b/apps/frontend/src/components/portfolios/PortfolioSummary.tsx @@ -1,5 +1,5 @@ import { AllocationChart } from './AllocationChart'; -import type { PortfolioDetail } from '../../api/responses'; +import type { PortfolioDetail } from '@/shared/api/responses'; export function PortfolioSummary({ portfolio }: { portfolio: PortfolioDetail }) { return ( diff --git a/apps/frontend/src/components/portfolios/SharePositionRow.tsx b/apps/frontend/src/components/portfolios/SharePositionRow.tsx index 1465334..4aca8e7 100644 --- a/apps/frontend/src/components/portfolios/SharePositionRow.tsx +++ b/apps/frontend/src/components/portfolios/SharePositionRow.tsx @@ -1,6 +1,6 @@ import { useState } from 'react'; import { Link } from 'react-router-dom'; -import type { PositionWithPrice } from '../../api/responses'; +import type { PositionWithPrice } from '@/shared/api/responses'; interface Props { position: PositionWithPrice; diff --git a/apps/frontend/src/components/portfolios/SharePositionTable.tsx b/apps/frontend/src/components/portfolios/SharePositionTable.tsx index 05e8841..0463244 100644 --- a/apps/frontend/src/components/portfolios/SharePositionTable.tsx +++ b/apps/frontend/src/components/portfolios/SharePositionTable.tsx @@ -1,5 +1,5 @@ import { SharePositionRow } from './SharePositionRow'; -import type { PositionWithPrice } from '../../api/responses'; +import type { PositionWithPrice } from '@/shared/api/responses'; interface Props { positions: PositionWithPrice[]; diff --git a/apps/frontend/src/components/screener/ScreenerTable.tsx b/apps/frontend/src/components/screener/ScreenerTable.tsx index 7288f7e..2998dbc 100644 --- a/apps/frontend/src/components/screener/ScreenerTable.tsx +++ b/apps/frontend/src/components/screener/ScreenerTable.tsx @@ -1,5 +1,5 @@ import { Link } from 'react-router-dom'; -import type { ScreenerResult } from '../../api/responses'; +import type { ScreenerResult } from '@/shared/api/responses'; interface Props { result: ScreenerResult; diff --git a/apps/frontend/src/context/AuthContext.tsx b/apps/frontend/src/context/AuthContext.tsx index 2eebe1c..85197d2 100644 --- a/apps/frontend/src/context/AuthContext.tsx +++ b/apps/frontend/src/context/AuthContext.tsx @@ -1,7 +1,7 @@ import { createContext, useState, useEffect, useCallback, type ReactNode } from 'react'; import * as authApi from '../api/auth'; -import { setOnUnauthorized } from '../api/client'; -import type { UserResponse } from '../api/responses'; +import { setOnUnauthorized } from '@/shared/api/client'; +import type { UserResponse } from '@/shared/api/responses'; export interface AuthContextValue { user: UserResponse | null; diff --git a/apps/frontend/src/hooks/useBond.ts b/apps/frontend/src/hooks/useBond.ts index aa881ee..9503e69 100644 --- a/apps/frontend/src/hooks/useBond.ts +++ b/apps/frontend/src/hooks/useBond.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { getBond } from '../api/client'; -import type { BondResponse } from '../api/responses'; +import { getBond } from '@/shared/api/client'; +import type { BondResponse } from '@/shared/api/responses'; export function useBond(secid: string) { return useQuery({ diff --git a/apps/frontend/src/hooks/useBondCandles.ts b/apps/frontend/src/hooks/useBondCandles.ts index 6ddce5a..0ea02c4 100644 --- a/apps/frontend/src/hooks/useBondCandles.ts +++ b/apps/frontend/src/hooks/useBondCandles.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { getBondCandles } from '../api/client'; -import type { CandleItem } from '../api/responses'; +import { getBondCandles } from '@/shared/api/client'; +import type { CandleItem } from '@/shared/api/responses'; export function useBondCandles(secid: string, interval: '1h' | '24h', from: string, till: string) { return useQuery({ diff --git a/apps/frontend/src/hooks/useBrokerAccountPortfolios.test.tsx b/apps/frontend/src/hooks/useBrokerAccountPortfolios.test.tsx index f24288b..63ae858 100644 --- a/apps/frontend/src/hooks/useBrokerAccountPortfolios.test.tsx +++ b/apps/frontend/src/hooks/useBrokerAccountPortfolios.test.tsx @@ -3,7 +3,7 @@ import { renderHook, waitFor } from '@testing-library/react'; import { type ReactNode } from 'react'; import { beforeEach, describe, expect, it, vi } from 'vitest'; import { getBrokerPortfolio } from '../entities/broker-account/api/brokerAccountApi'; -import type { BrokerAccount, BrokerPortfolio } from '../api/responses'; +import type { BrokerAccount, BrokerPortfolio } from '@/shared/api/responses'; import { useBrokerAccountPortfolios } from './useBrokerAccountPortfolios'; vi.mock('../entities/broker-account/api/brokerAccountApi', () => ({ diff --git a/apps/frontend/src/hooks/usePortfolio.ts b/apps/frontend/src/hooks/usePortfolio.ts index 7706a1d..be02636 100644 --- a/apps/frontend/src/hooks/usePortfolio.ts +++ b/apps/frontend/src/hooks/usePortfolio.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { getPortfolio } from '../api/portfolio'; -import type { PortfolioDetail } from '../api/responses'; +import type { PortfolioDetail } from '@/shared/api/responses'; export function usePortfolio(id: number) { return useQuery({ diff --git a/apps/frontend/src/hooks/usePortfolioAnalytics.ts b/apps/frontend/src/hooks/usePortfolioAnalytics.ts index c6745a8..f4087ba 100644 --- a/apps/frontend/src/hooks/usePortfolioAnalytics.ts +++ b/apps/frontend/src/hooks/usePortfolioAnalytics.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { getPortfolioAnalytics } from '../api/portfolio'; -import type { AnalyticsResponse } from '../api/responses'; +import type { AnalyticsResponse } from '@/shared/api/responses'; export function usePortfolioAnalytics(portfolioId: number) { return useQuery({ diff --git a/apps/frontend/src/hooks/usePortfolios.ts b/apps/frontend/src/hooks/usePortfolios.ts index 1a38923..f4daa18 100644 --- a/apps/frontend/src/hooks/usePortfolios.ts +++ b/apps/frontend/src/hooks/usePortfolios.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; import { getPortfolios } from '../api/portfolio'; -import type { Portfolio } from '../api/responses'; +import type { Portfolio } from '@/shared/api/responses'; export function usePortfolios() { return useQuery({ diff --git a/apps/frontend/src/hooks/usePositionMutations.ts b/apps/frontend/src/hooks/usePositionMutations.ts index 1947f54..fc98187 100644 --- a/apps/frontend/src/hooks/usePositionMutations.ts +++ b/apps/frontend/src/hooks/usePositionMutations.ts @@ -1,6 +1,6 @@ import { useMutation, useQueryClient } from '@tanstack/react-query'; import { addPosition, updatePosition, removePosition } from '../api/portfolio'; -import type { PortfolioDetail } from '../api/responses'; +import type { PortfolioDetail } from '@/shared/api/responses'; export function usePositionMutations(portfolioId: number) { const queryClient = useQueryClient(); diff --git a/apps/frontend/src/hooks/useSearch.ts b/apps/frontend/src/hooks/useSearch.ts index 982a413..45f64ca 100644 --- a/apps/frontend/src/hooks/useSearch.ts +++ b/apps/frontend/src/hooks/useSearch.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { searchSecurities } from '../api/client'; -import type { SearchResultItem } from '../api/responses'; +import { searchSecurities } from '@/shared/api/client'; +import type { SearchResultItem } from '@/shared/api/responses'; export function useSearch(query: string) { return useQuery({ diff --git a/apps/frontend/src/hooks/useStock.ts b/apps/frontend/src/hooks/useStock.ts index 930bac1..a650025 100644 --- a/apps/frontend/src/hooks/useStock.ts +++ b/apps/frontend/src/hooks/useStock.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { getShare } from '../api/client'; -import type { ShareResponse } from '../api/responses'; +import { getShare } from '@/shared/api/client'; +import type { ShareResponse } from '@/shared/api/responses'; export function useStock(secid: string) { return useQuery({ diff --git a/apps/frontend/src/hooks/useStockCandles.ts b/apps/frontend/src/hooks/useStockCandles.ts index de62f71..836f9dc 100644 --- a/apps/frontend/src/hooks/useStockCandles.ts +++ b/apps/frontend/src/hooks/useStockCandles.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { getShareCandles } from '../api/client'; -import type { CandleItem } from '../api/responses'; +import { getShareCandles } from '@/shared/api/client'; +import type { CandleItem } from '@/shared/api/responses'; export function useStockCandles(secid: string, interval: '1h' | '24h', from: string, till: string) { return useQuery({ diff --git a/apps/frontend/src/hooks/useStockDividends.ts b/apps/frontend/src/hooks/useStockDividends.ts index cbdcb99..7a80600 100644 --- a/apps/frontend/src/hooks/useStockDividends.ts +++ b/apps/frontend/src/hooks/useStockDividends.ts @@ -1,6 +1,6 @@ import { useQuery } from '@tanstack/react-query'; -import { getShareDividends } from '../api/client'; -import type { DividendItem } from '../api/responses'; +import { getShareDividends } from '@/shared/api/client'; +import type { DividendItem } from '@/shared/api/responses'; export function useStockDividends(secid: string) { return useQuery({ diff --git a/apps/frontend/src/pages/broker/BrokerAccountsPage.test.tsx b/apps/frontend/src/pages/broker/BrokerAccountsPage.test.tsx index 0c6cb6d..221a8f2 100644 --- a/apps/frontend/src/pages/broker/BrokerAccountsPage.test.tsx +++ b/apps/frontend/src/pages/broker/BrokerAccountsPage.test.tsx @@ -4,7 +4,7 @@ import userEvent from '@testing-library/user-event'; import { type ReactElement } from 'react'; import { MemoryRouter } from 'react-router-dom'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import type { BrokerAccount, BrokerPortfolio } from '../../api/responses'; +import type { BrokerAccount, BrokerPortfolio } from '@/shared/api/responses'; import * as brokerAccountEntity from '../../entities/broker-account'; import { BrokerAccountsPage } from './BrokerAccountsPage'; diff --git a/apps/frontend/src/pages/broker/BrokerPages.test.tsx b/apps/frontend/src/pages/broker/BrokerPages.test.tsx index 7c33eae..797037c 100644 --- a/apps/frontend/src/pages/broker/BrokerPages.test.tsx +++ b/apps/frontend/src/pages/broker/BrokerPages.test.tsx @@ -8,7 +8,7 @@ import * as operationsHook from '../../entities/broker-operation'; import * as brokerAccountsHook from '../../hooks/useBrokerAccounts'; import * as brokerAccountPortfoliosHook from '../../hooks/useBrokerAccountPortfolios'; import * as portfolioHook from '../../entities/broker-account/model/useBrokerPortfolio'; -import type { BrokerAccount, BrokerPortfolio, BrokerPosition } from '../../api/responses'; +import type { BrokerAccount, BrokerPortfolio, BrokerPosition } from '@/shared/api/responses'; import * as positionsHook from '../../entities/broker-position'; import { AppRoutes } from '../../routes'; import { renderWithProviders } from '../../test/test-utils'; diff --git a/apps/frontend/src/test/factories.ts b/apps/frontend/src/test/factories.ts index bb87e52..af91dde 100644 --- a/apps/frontend/src/test/factories.ts +++ b/apps/frontend/src/test/factories.ts @@ -8,7 +8,7 @@ import type { SearchResultItem, UserResponse, AuthResponse, -} from '../api/responses'; +} from '@/shared/api/responses'; export function createMockMarketData(overrides: Partial = {}): StockMarketData { return { diff --git a/apps/frontend/src/test/handlers.ts b/apps/frontend/src/test/handlers.ts index 15b5c26..bceb62e 100644 --- a/apps/frontend/src/test/handlers.ts +++ b/apps/frontend/src/test/handlers.ts @@ -1,5 +1,10 @@ import { http, HttpResponse } from 'msw'; -import type { ShareResponse, BondResponse, CandleItem, SearchResultItem } from '../api/responses'; +import type { + ShareResponse, + BondResponse, + CandleItem, + SearchResultItem, +} from '@/shared/api/responses'; const API = '/api/v1';