Skip to content
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
9 changes: 5 additions & 4 deletions react/lib/components/Widget/AltpaymentWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export const AltpaymentWidget: React.FunctionComponent<AltpaymentProps> = props
copiedMessage.style.padding = "5px 0 5px 5px";
copiedMessage.style.zIndex = "10";
copiedMessage.style.display = "none";

if (contentElement) {
const content = contentElement.textContent || "";
navigator.clipboard.writeText(content);
Expand Down Expand Up @@ -344,7 +344,7 @@ export const AltpaymentWidget: React.FunctionComponent<AltpaymentProps> = props
<div id="sideshift_id">{altpaymentShift.id}</div>
<img src={copyIcon} alt="Copy" onClick={() => copyToClipboard('sideshift_id')}/>
</div>
</div>
</div>
)
) : loadingShift ? (
<p>Loading Shift...</p>
Expand All @@ -370,6 +370,7 @@ export const AltpaymentWidget: React.FunctionComponent<AltpaymentProps> = props
Send {pairAmount} {selectedCoin?.name}
</Typography>
)}
<div></div>
<div style={loadingPair ||
selectedCoinNetwork === undefined ||
!pairAmount ||
Expand Down Expand Up @@ -414,7 +415,7 @@ export const AltpaymentWidget: React.FunctionComponent<AltpaymentProps> = props
<Select
labelId="select-coin-label"
className={classes.select_box}
value={selectedCoin?.coin}
value={selectedCoin?.coin ?? null}
onChange={e => {
handleCoinChange(e);
}}
Expand Down Expand Up @@ -453,7 +454,7 @@ export const AltpaymentWidget: React.FunctionComponent<AltpaymentProps> = props
<Select
labelId="select-network-label"
className={classes.select_box}
value={selectedCoinNetwork}
value={selectedCoinNetwork ?? null}
onChange={e => {
handleNetworkChange(e);
}}
Expand Down
2 changes: 1 addition & 1 deletion react/lib/components/Widget/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ export const Widget: React.FunctionComponent<WidgetProps> = props => {
const usdAmount = usdPrice * +thisAmount
setIsAboveMinimumAltpaymentUSDAmount(usdAmount >= MINIMUM_ALTPAYMENT_DOLLAR_AMOUNT)
}
}, [to, thisAmount]);
}, [to, thisAmount, usdPrice]);

useEffect(() => {
const invalidAmount =
Expand Down
8 changes: 4 additions & 4 deletions react/lib/components/Widget/WidgetContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> =
} else {
const expectedAmount = amount ? resolveNumber(amount) : undefined;
const receivedAmount = resolveNumber(transaction.amount);

if (await shouldTriggerOnSuccess(
transaction,
currency,
Expand All @@ -173,7 +173,7 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> =
if (sound) {
txSound.play().catch(() => {});
}

const currencyTicker = getCurrencyTypeFromAddress(to);
if (!hideToasts)
enqueueSnackbar(
Expand Down Expand Up @@ -219,14 +219,14 @@ export const WidgetContainer: React.FunctionComponent<WidgetContainerProps> =
);

useEffect(() => {
if (price === undefined) {
if (price === undefined || price === 0) {
(async () => {
getPrice();
})()
} else {
setThisPrice(price)
}
}, [currency, price]);
}, [currency, price, usdPrice]);

const handleNewTransaction = useCallback(
(tx: Transaction) => {
Expand Down
Loading