Skip to content

Commit

Permalink
canceling toast should go from canceling -> canceled / error (#529)
Browse files Browse the repository at this point in the history
  • Loading branch information
aforaleka authored May 13, 2024
1 parent d6c9d60 commit 94db943
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/views/notifications/OrderCancelNotification.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { shallowEqual, useSelector } from 'react-redux';
import styled, { AnyStyledComponent } from 'styled-components';

import { AbacusOrderStatus, KotlinIrEnumValues, ORDER_STATUS_STRINGS } from '@/constants/abacus';
import { AbacusOrderStatus } from '@/constants/abacus';
import { STRING_KEYS } from '@/constants/localization';
import { CancelOrderStatuses, LocalCancelOrderData, ORDER_TYPE_STRINGS } from '@/constants/trade';

Expand Down Expand Up @@ -43,16 +43,15 @@ export const OrderCancelNotification = ({
let orderStatusIcon = <Styled.LoadingSpinner />;
let customContent = null;

if (cancelStatus === CancelOrderStatuses.Canceled) {
orderStatusStringKey =
ORDER_STATUS_STRINGS[
indexedOrderStatus as unknown as KotlinIrEnumValues<typeof AbacusOrderStatus>
];
orderStatusIcon = <Styled.OrderStatusIcon status={indexedOrderStatus} />;
// whichever canceled confirmation happens first (node / indexer)
const canceledStatusValue = AbacusOrderStatus.cancelled.rawValue;
if (cancelStatus === CancelOrderStatuses.Canceled || indexedOrderStatus === canceledStatusValue) {
orderStatusStringKey = STRING_KEYS.CANCELED;
orderStatusIcon = <Styled.OrderStatusIcon status={canceledStatusValue} />;
}

if (localCancel.errorStringKey) {
orderStatusStringKey = STRING_KEYS.FAILED;
orderStatusStringKey = STRING_KEYS.ERROR;
orderStatusIcon = <Styled.WarningIcon iconName={IconName.Warning} />;
customContent = <span>{stringGetter({ key: localCancel.errorStringKey })}</span>;
}
Expand Down

0 comments on commit 94db943

Please sign in to comment.