-
Notifications
You must be signed in to change notification settings - Fork 21
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
27bb2d7
commit b94a610
Showing
20 changed files
with
331 additions
and
45 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,23 @@ | ||
import { useFiatCurrency } from 'hooks/useFiatCurrency'; | ||
import { useGetTokenPrice } from 'libs/queries'; | ||
import { SafeDecimal } from 'libs/safedecimal'; | ||
import { Token } from 'libs/tokens'; | ||
import { FC } from 'react'; | ||
import { cn, getFiatDisplayValue } from 'utils/helpers'; | ||
|
||
interface Props { | ||
token?: Token; | ||
amount: SafeDecimal | string | number; | ||
className?: string; | ||
} | ||
export const FiatPrice: FC<Props> = ({ token, amount, className }) => { | ||
const query = useGetTokenPrice(token?.address); | ||
const { selectedFiatCurrency: currentCurrency } = useFiatCurrency(); | ||
const loading = !token || query.isPending; | ||
const value = new SafeDecimal(query.data?.[currentCurrency] || 0).mul(amount); | ||
return ( | ||
<span className={cn(className, { invisible: loading })}> | ||
{getFiatDisplayValue(value, currentCurrency)} | ||
</span> | ||
); | ||
}; |
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
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,43 @@ | ||
import { useNavigate, useSearch } from '@tanstack/react-router'; | ||
import { Radio, RadioGroup } from 'components/common/radio/RadioGroup'; | ||
import { ReactComponent as IconGrid } from 'assets/icons/grid.svg'; | ||
import { ReactComponent as IconTable } from 'assets/icons/table.svg'; | ||
import { FC } from 'react'; | ||
|
||
const urls = { | ||
explorer: '/explore/$type/$slug/' as const, | ||
myStrategy: '/my-strategy-layout/' as const, | ||
}; | ||
interface Props { | ||
from: keyof typeof urls; | ||
} | ||
export const StrategySelectLayout: FC<Props> = ({ from }) => { | ||
const { layout } = useSearch({ from: urls[from] }); | ||
const nav = useNavigate({ from: urls[from] }); | ||
const set = (layout: 'list' | 'table') => { | ||
nav({ search: (s) => ({ ...s, layout }) }); | ||
}; | ||
return ( | ||
<RadioGroup | ||
aria-label="Select strategy list layout" | ||
className="border-2 border-white/10" | ||
> | ||
<Radio | ||
name="layout" | ||
checked={layout !== 'table'} | ||
onChange={() => set('list')} | ||
aria-label="List" | ||
> | ||
<IconGrid className="size-20" /> | ||
</Radio> | ||
<Radio | ||
name="layout" | ||
checked={layout === 'table'} | ||
onChange={() => set('table')} | ||
aria-label="Table" | ||
> | ||
<IconTable className="size-20" /> | ||
</Radio> | ||
</RadioGroup> | ||
); | ||
}; |
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.