import React from 'react'; import CardBox from '../CardBox'; import ImageField from '../ImageField'; import dataFormatter from '../../helpers/dataFormatter'; import {saveFile} from "../../helpers/fileSaver"; import ListActionsPopover from "../ListActionsPopover"; import {useAppSelector} from "../../stores/hooks"; import {Pagination} from "../Pagination"; import LoadingSpinner from "../LoadingSpinner"; import Link from 'next/link'; import {hasPermission} from "../../helpers/userPermissions"; type Props = { trades: any[]; loading: boolean; onDelete: (id: string) => void; currentPage: number; numPages: number; onPageChange: (page: number) => void; }; const ListTrades = ({ trades, loading, onDelete, currentPage, numPages, onPageChange }: Props) => { const currentUser = useAppSelector((state) => state.auth.currentUser); const hasUpdatePermission = hasPermission(currentUser, 'UPDATE_TRADES') const corners = useAppSelector((state) => state.style.corners); const bgColor = useAppSelector((state) => state.style.cardsColor); return ( <>
{loading && } {!loading && trades.map((item) => (
dark:divide-dark-700 overflow-x-auto' } >

TradingAccount

{ dataFormatter.trading_accountsOneListFormatter(item.trading_account) }

Instrument

{ dataFormatter.instrumentsOneListFormatter(item.instrument) }

Setup

{ dataFormatter.setupsOneListFormatter(item.setup) }

Direction

{ item.direction }

Status

{ item.status }

Timeframe

{ item.timeframe }

EntryAt

{ dataFormatter.dateTimeFormatter(item.entry_at) }

ExitAt

{ dataFormatter.dateTimeFormatter(item.exit_at) }

EntryPrice

{ item.entry_price }

ExitPrice

{ item.exit_price }

StopLossPrice

{ item.stop_loss_price }

TakeProfitPrice

{ item.take_profit_price }

PositionSize

{ item.position_size }

PositionSizeUnit

{ item.position_size_unit }

Fees

{ item.fees }

Slippage

{ item.slippage }

PnLAmount

{ item.pnl_amount }

PnLPercent

{ item.pnl_percent }

RiskAmount

{ item.risk_amount }

RiskRewardRatio

{ item.rr_ratio }

MaxAdverseExcursion

{ item.mae_amount }

MaxFavorableExcursion

{ item.mfe_amount }

DurationMinutes

{ item.duration_minutes }

IsWin

{ dataFormatter.booleanFormatter(item.is_win) }

Notes

{ item.notes }

Tags

{ dataFormatter.tagsManyListFormatter(item.tags).join(', ')}

))} {!loading && trades.length === 0 && (

No data to display

)}
) }; export default ListTrades