-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
05cddfb
commit 01da390
Showing
13 changed files
with
255 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
...end/src/app/3_organisms/FastBtcDialog/components/BoltzSendFlow/components/BoltzStatus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import React, { FC, useMemo } from 'react'; | ||
|
||
import classNames from 'classnames'; | ||
import { t } from 'i18next'; | ||
|
||
import { Icon, IconNames } from '@sovryn/ui'; | ||
|
||
import { translations } from '../../../../../../locales/i18n'; | ||
|
||
export enum BoltzStatusType { | ||
invoiceSet = 'invoice.set', | ||
txConfirmed = 'transaction.confirmed', | ||
txPending = 'transaction.pending', | ||
txPaid = 'transaction.paid', | ||
txClaimed = 'transaction.claimed', | ||
// todo: add failed statuses? | ||
} | ||
|
||
type BoltzStatusProps = { | ||
status?: BoltzStatusType; | ||
}; | ||
|
||
export const BoltzStatus: FC<BoltzStatusProps> = ({ status }) => { | ||
const renderStatusMessage = useMemo(() => { | ||
switch (status) { | ||
case BoltzStatusType.invoiceSet: | ||
return t(translations.boltz.send.boltzStatus.invoiceSet); | ||
case BoltzStatusType.txPending: | ||
return t(translations.boltz.send.boltzStatus.txPending); | ||
case BoltzStatusType.txConfirmed: | ||
return t(translations.boltz.send.boltzStatus.txConfirmed); | ||
case BoltzStatusType.txPaid: | ||
return t(translations.boltz.send.boltzStatus.txPaid); | ||
case BoltzStatusType.txClaimed: | ||
return t(translations.boltz.send.boltzStatus.txClaimed); | ||
default: | ||
return status; | ||
} | ||
}, [status]); | ||
|
||
return status === undefined ? ( | ||
<Icon icon={IconNames.PENDING} /> | ||
) : ( | ||
<div | ||
className={classNames({ | ||
'text-success': [ | ||
BoltzStatusType.txPaid, | ||
BoltzStatusType.txClaimed, | ||
].includes(status), | ||
})} | ||
> | ||
{renderStatusMessage} | ||
</div> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.