refactor(frontend): update legacy imports to use @/shared/
This commit is contained in:
parent
9816bc6b96
commit
d95b2df460
@ -1,4 +1,4 @@
|
||||
import type { BondResponse } from '../api/responses';
|
||||
import type { BondResponse } from '@/shared/api/responses';
|
||||
|
||||
interface BondDetailsProps {
|
||||
bond: BondResponse;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { ShareResponse } from '../api/responses';
|
||||
import type { ShareResponse } from '@/shared/api/responses';
|
||||
|
||||
interface StockDetailsProps {
|
||||
stock: ShareResponse;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import type { PositionWithPrice } from '../../api/responses';
|
||||
import type { PositionWithPrice } from '@/shared/api/responses';
|
||||
|
||||
interface AllocationChartProps {
|
||||
positions: PositionWithPrice[];
|
||||
|
||||
@ -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) =>
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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[];
|
||||
|
||||
@ -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 => ({
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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 (
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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[];
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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<BondResponse>({
|
||||
|
||||
@ -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<CandleItem[]>({
|
||||
|
||||
@ -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', () => ({
|
||||
|
||||
@ -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<PortfolioDetail>({
|
||||
|
||||
@ -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<AnalyticsResponse>({
|
||||
|
||||
@ -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<Portfolio[]>({
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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<SearchResultItem[]>({
|
||||
|
||||
@ -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<ShareResponse>({
|
||||
|
||||
@ -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<CandleItem[]>({
|
||||
|
||||
@ -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<DividendItem[]>({
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
@ -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';
|
||||
|
||||
@ -8,7 +8,7 @@ import type {
|
||||
SearchResultItem,
|
||||
UserResponse,
|
||||
AuthResponse,
|
||||
} from '../api/responses';
|
||||
} from '@/shared/api/responses';
|
||||
|
||||
export function createMockMarketData(overrides: Partial<StockMarketData> = {}): StockMarketData {
|
||||
return {
|
||||
|
||||
@ -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';
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user