-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into 466-add-a-arrow-to-reverse-the-swap-on-the-s…
…wap-ui-of-forex-amm
- Loading branch information
Showing
31 changed files
with
1,232 additions
and
1,238 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export const Arrow = ({ fill = '#000000' }: { fill: string }) => ( | ||
<svg width="11" height="12" viewBox="0 0 11 12" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M10.515 5.88061L0.518739 11.652L0.51874 0.109262L10.515 5.88061Z" fill={fill} /> | ||
</svg> | ||
); |
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 |
---|---|---|
@@ -1,3 +1,8 @@ | ||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path d="M8.35968 11.5H10.0263V13.1666H8.35968V11.5ZM8.35968 4.83329H10.0263V9.83329H8.35968V4.83329ZM9.18468 0.666626C4.58468 0.666626 0.85968 4.39996 0.85968 8.99996C0.85968 13.6 4.58468 17.3333 9.18468 17.3333C13.793 17.3333 17.5263 13.6 17.5263 8.99996C17.5263 4.39996 13.793 0.666626 9.18468 0.666626ZM9.19301 15.6666C5.50968 15.6666 2.52635 12.6833 2.52635 8.99996C2.52635 5.31663 5.50968 2.33329 9.19301 2.33329C12.8763 2.33329 15.8597 5.31663 15.8597 8.99996C15.8597 12.6833 12.8763 15.6666 9.19301 15.6666Z" fill="#4EE59A"/> | ||
</svg> | ||
export const Warning = ({ fill = '#000000' }: { fill: string }) => ( | ||
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
<path | ||
d="M8.35968 11.5H10.0263V13.1666H8.35968V11.5ZM8.35968 4.83329H10.0263V9.83329H8.35968V4.83329ZM9.18468 0.666626C4.58468 0.666626 0.85968 4.39996 0.85968 8.99996C0.85968 13.6 4.58468 17.3333 9.18468 17.3333C13.793 17.3333 17.5263 13.6 17.5263 8.99996C17.5263 4.39996 13.793 0.666626 9.18468 0.666626ZM9.19301 15.6666C5.50968 15.6666 2.52635 12.6833 2.52635 8.99996C2.52635 5.31663 5.50968 2.33329 9.19301 2.33329C12.8763 2.33329 15.8597 5.31663 15.8597 8.99996C15.8597 12.6833 12.8763 15.6666 9.19301 15.6666Z" | ||
fill={fill} | ||
/> | ||
</svg> | ||
); |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion
2
src/assets/spacewalk/PEN_StellarBridgeToSpacewalk_Interpolation.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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,40 @@ | ||
import { UseQueryOptions } from '@tanstack/react-query'; | ||
import { SpacewalkPrimitivesCurrencyId } from '@polkadot/types/lookup'; | ||
import { memo, useEffect, useState } from 'preact/compat'; | ||
import { usePriceFetcher } from '../../../hooks/usePriceFetcher'; | ||
import { NumberLoader } from '../../Loader'; | ||
|
||
export type TokenPriceProps = { | ||
address?: string; | ||
currency: SpacewalkPrimitivesCurrencyId; | ||
prefix?: ReactNode; | ||
options?: UseQueryOptions; | ||
loader?: ReactNode; | ||
fallback?: ReactNode; | ||
}; | ||
|
||
const TokenPrice = memo(({ currency, prefix = null, loader, fallback = null }: TokenPriceProps): JSX.Element | null => { | ||
const { getTokenPriceForCurrency } = usePriceFetcher(); | ||
const [price, setPrice] = useState<number | undefined | null>(null); | ||
|
||
useEffect(() => { | ||
const run = async () => { | ||
const p = await getTokenPriceForCurrency(currency); | ||
setPrice(p); | ||
}; | ||
|
||
run().catch(console.error); | ||
}, [getTokenPriceForCurrency, currency]); | ||
|
||
const isLoading = price === null; | ||
|
||
if (isLoading) return <>{loader}</> || NumberLoader; | ||
if (!price) return <>{fallback}</>; | ||
return ( | ||
<span> | ||
{prefix}${price} | ||
</span> | ||
); | ||
}); | ||
|
||
export default TokenPrice; |
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.