import React, { memo, ReactElement } from 'react'; import * as t from 'altamoon-types'; import MiniNumberInput from '../lib/MiniNumberInput'; import PhlegmaticSwitch from '../lib/PhlegmaticSwitch'; import useItem from '../lib/useItem'; import { PhlegmaticPosition } from '../types'; interface Props { isDefault: boolean; isEnabled: boolean; item: PhlegmaticPosition; position?: t.TradingPosition; onItemChange?: (item: PhlegmaticPosition, key: string) => void; onChangeEnabled: (isEnabled: boolean) => void; } const PullProfit = ({ isDefault, isEnabled, item, position, onItemChange, onChangeEnabled, }: Props): ReactElement => { const [pullProfitPercentValue, setPullProfitPercentValue] = useItem(item, 'pullProfitPercentValue', onItemChange); const [pullProfitSecondsInterval, setPullProfitSecondsInterval] = useItem(item, 'pullProfitSecondsInterval', onItemChange); const [pullProfitPercentTrigger, setPullProfitPercentTrigger] = useItem(item, 'pullProfitPercentTrigger', onItemChange); const isValid = pullProfitPercentValue !== null && pullProfitPercentTrigger !== null && pullProfitSecondsInterval !== null; return (