-
Notifications
You must be signed in to change notification settings - Fork 10
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
e0c4734
commit 9e6640a
Showing
14 changed files
with
126 additions
and
75 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'renterd': patch | ||
--- | ||
|
||
Fixed an issue where network averages shown on pinned field tips did not follow the currency display preference. |
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 @@ | ||
--- | ||
'@siafoundation/design-system': patch | ||
--- | ||
|
||
Fiat fields now show averages and suggestions according to the currency display preference. |
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,11 @@ | ||
import { Page } from 'playwright' | ||
import { fillSelectInputByName } from './selectInput' | ||
|
||
export async function setCurrencyDisplay( | ||
page: Page, | ||
display: 'sc' | 'fiat' | 'bothPreferSc' | 'bothPreferFiat' | ||
) { | ||
await page.getByLabel('App preferences').click() | ||
await fillSelectInputByName(page, 'currencyDisplay', display) | ||
await page.getByRole('dialog').getByLabel('close').click() | ||
} |
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
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,33 @@ | ||
import { CurrencyId, useAppSettings } from '@siafoundation/react-core' | ||
import { useMemo } from 'react' | ||
import BigNumber from 'bignumber.js' | ||
import { useSiaCentralExchangeRates } from '@siafoundation/sia-central-react' | ||
|
||
type Props = { | ||
currency?: CurrencyId | '' | ||
} | ||
|
||
export function useExchangeRate({ currency }: Props): BigNumber { | ||
const { settings } = useAppSettings() | ||
const rates = useSiaCentralExchangeRates({ | ||
disabled: !currency || !settings.siaCentral, | ||
config: { | ||
swr: { | ||
revalidateOnFocus: false, | ||
}, | ||
}, | ||
}) | ||
const rate = useMemo(() => { | ||
if (!settings.siaCentral || !rates.data) { | ||
return new BigNumber(0) | ||
} | ||
return new BigNumber((currency && rates.data?.rates.sc[currency]) || 0) | ||
}, [rates.data, settings, currency]) | ||
|
||
return rate | ||
} | ||
|
||
export function useActiveExchangeRate(): BigNumber { | ||
const { settings } = useAppSettings() | ||
return useExchangeRate({ currency: settings.currency.id }) | ||
} |
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