Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disabled Stepper on the same value #70

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const ContractDetailsFooter = observer(({ contract_info }: ContractInfoProps) =>
<Button
label={label}
isLoading={is_sell_requested}
disabled={is_sell_requested || (Number(profit) < 0 && is_valid_to_cancel)}
disabled={Number(profit) < 0 && is_valid_to_cancel}
onClick={() => onClickSell(contract_id)}
{...buttonProps}
/>
Expand All @@ -62,8 +62,7 @@ const ContractDetailsFooter = observer(({ contract_info }: ContractInfoProps) =>
onClick={() => onClickCancel(contract_id)}
label={
<>
{cardLabels.CANCEL}
{' '}
{cardLabels.CANCEL}{' '}
<RemainingTime
as='span'
end_time={cancellation_date_expiry}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ const DealCancellationRemainingTime = observer(({ format = 'mm:ss' }: DealCancel
}

return (
<React.Fragment>
<Tag
className='deal-cancellation-badge'
color='custom'
data-testid='deal-cancellation-badge'
label={
<RemainingTime
end_time={end_time}
format='mm:ss'
getCardLabels={getCardLabelsV2}
start_time={start_time}
/>
}
size='sm'
variant='custom'
/>
</React.Fragment>
<Tag
className='deal-cancellation-badge'
color='custom'
data-testid='deal-cancellation-badge'
label={
<RemainingTime
end_time={end_time}
format='mm:ss'
getCardLabels={getCardLabelsV2}
start_time={start_time}
/>
}
size='sm'
variant='custom'
/>
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const EntryExitDetails = ({ contract_info }: { contract_info: TContractInfo }) =
const exitValue = exit_tick_display_value ? addComma(exit_tick_display_value) : null;

return (
<CardWrapper title='Entry & exit details' className='entry-exit-details'>
<CardWrapper title={<Localize i18n_default_text='Entry & exit details' />} className='entry-exit-details'>
<div className='entry-exit-details__table'>
{dateTimes.start && (
<EntryExitDetailRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const RiskManagementItem = observer(
)}
</ActionSheet.Content>
<ActionSheet.Footer
isPrimaryButtonDisabled={!!errorMessage}
isPrimaryButtonDisabled={!!errorMessage || finalValue == stepperValue}
shouldCloseOnPrimaryButtonClick
primaryAction={{
content: <Localize i18n_default_text='Save' />,
Expand Down
22 changes: 10 additions & 12 deletions packages/trader/src/AppV2/Components/TakeProfit/take-profit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,16 @@ const TakeProfit = observer(() => {
const { contract_info } = useContractDetails();
const { limit_order } = contract_info;
const { isTakeProfitVisible } = getContractDetailsConfig(contract_info.contract_type ?? '');
return (
isTakeProfitVisible && (
<RiskManagementItem
label={<Localize i18n_default_text='Take profit' />}
modal_body_content={
<Localize i18n_default_text='When your profit reaches or exceeds the set amount, your trade will be closed automatically.' />
}
value={limit_order?.take_profit?.order_amount}
type='take_profit'
/>
)
);
return isTakeProfitVisible ? (
<RiskManagementItem
label={<Localize i18n_default_text='Take profit' />}
modal_body_content={
<Localize i18n_default_text='When your profit reaches or exceeds the set amount, your trade will be closed automatically.' />
}
value={limit_order?.take_profit?.order_amount}
type='take_profit'
/>
) : null;
});

export default TakeProfit;
Original file line number Diff line number Diff line change
Expand Up @@ -85,17 +85,14 @@ const ContractDetails = observer(() => {
<div className='contract-card-wrapper'>
<ContractCard contractInfo={contract_info} serverTime={server_time} />
</div>

<ChartPlaceholder />

<DealCancellation />
{showRiskManagement && (
<CardWrapper>
<TakeProfit />
<StopLoss />
</CardWrapper>
)}

<OrderDetails contract_info={contract_info} />
<PayoutInfo contract_info={contract_info} />
<EntryExitDetails contract_info={contract_info} />
Expand Down
4 changes: 2 additions & 2 deletions packages/trader/src/AppV2/Routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ const Router: React.FC = () => {
is_logged_in={is_logged_in}
language={current_language}
Component404={Page404}
should_redirect_login={true}
should_redirect_login
routes={traderRoutes}
to={''}
to=''
{...route}
/>
))}
Expand Down
Loading