Handle error to send to sentry.

This commit is contained in:
2025-04-26 22:40:22 +07:00
parent 084977c717
commit 3c044a1e29
4 changed files with 54 additions and 121 deletions

View File

@@ -9,7 +9,7 @@ import type {
Time,
UTCTimestamp,
} from 'lightweight-charts'
import {LineStyle, createChart, CrosshairMode} from 'lightweight-charts'
import {createChart, CrosshairMode, LineStyle} from 'lightweight-charts'
import moment from 'moment'
import * as React from 'react'
import {useEffect, useRef, useState} from 'react'
@@ -22,10 +22,7 @@ import type {
StrategiesResultBase,
StrategyType,
} from '../../../../generated/ManagingApi'
import {
PositionStatus,
TradeDirection,
} from '../../../../generated/ManagingApi'
import {PositionStatus, TradeDirection,} from '../../../../generated/ManagingApi'
import useTheme from '../../../../hooks/useTheme'
// var customTheme = {
@@ -143,8 +140,8 @@ const TradeChart = ({
let color = 'mintcream'
if (position == undefined) return color
const negativeColor = 'palevioletred'
const positiveColor = 'lightgreen'
const negativeColor = theme.error
const positiveColor = theme.success
const status = position.status
const realized = position.profitAndLoss?.realized ?? 0
@@ -158,13 +155,11 @@ const TradeChart = ({
} else {
color = negativeColor
}
}else if (status == PositionStatus.Filled) {
color = theme.warning
}
}
if (position.profitAndLoss?.realized == null) {
color = 'yellow'
}
return color
}