-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4700 from leather-wallet/release/thursday
Release/thursday
- Loading branch information
Showing
49 changed files
with
1,787 additions
and
1,179 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
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
File renamed without changes
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
45 changes: 12 additions & 33 deletions
45
src/app/components/bitcoin-contract-entry-point/bitcoin-contract-entry-point.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 |
---|---|---|
@@ -1,51 +1,30 @@ | ||
import { useState } from 'react'; | ||
import { useAsync } from 'react-async-hook'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import { Money, createMoneyFromDecimal } from '@shared/models/money.model'; | ||
import { RouteUrls } from '@shared/route-urls'; | ||
|
||
import { useBitcoinContracts } from '@app/common/hooks/use-bitcoin-contracts'; | ||
import { i18nFormatCurrency } from '@app/common/money/format-money'; | ||
import { useCalculateBitcoinFiatValue } from '@app/query/common/market-data/market-data.hooks'; | ||
import { useGetBitcoinContractsBalance } from '@app/query/bitcoin/balance/bitcoin-contracts-balance.hooks'; | ||
import { BitcoinContractIcon } from '@app/ui/components/icons/bitcoin-contract-icon'; | ||
|
||
import { BitcoinContractEntryPointLayout } from './bitcoin-contract-entry-point-layout'; | ||
|
||
interface BitcoinContractEntryPointProps { | ||
btcAddress: string; | ||
} | ||
export function BitcoinContractEntryPoint({ btcAddress }: BitcoinContractEntryPointProps) { | ||
export function BitcoinContractEntryPoint() { | ||
const navigate = useNavigate(); | ||
const { sumBitcoinContractCollateralAmounts } = useBitcoinContracts(); | ||
const [isLoading, setIsLoading] = useState(true); | ||
const calculateFiatValue = useCalculateBitcoinFiatValue(); | ||
const [bitcoinContractSum, setBitcoinContractSum] = useState<Money>( | ||
createMoneyFromDecimal(0, 'BTC') | ||
); | ||
|
||
useAsync(async () => { | ||
setIsLoading(true); | ||
const currentBitcoinContractSum = await sumBitcoinContractCollateralAmounts(); | ||
if (!currentBitcoinContractSum) return; | ||
setBitcoinContractSum(currentBitcoinContractSum); | ||
setIsLoading(false); | ||
}, [btcAddress]); | ||
const { bitcoinContractsBalance, bitcoinContractsBalanceInUSD, isLoading } = | ||
useGetBitcoinContractsBalance(); | ||
|
||
function onClick() { | ||
navigate(RouteUrls.BitcoinContractList); | ||
} | ||
|
||
return ( | ||
!bitcoinContractSum.amount.isZero() && ( | ||
<BitcoinContractEntryPointLayout | ||
isLoading={isLoading} | ||
balance={bitcoinContractSum} | ||
caption={bitcoinContractSum.symbol} | ||
icon={<BitcoinContractIcon />} | ||
usdBalance={i18nFormatCurrency(calculateFiatValue(bitcoinContractSum))} | ||
onClick={onClick} | ||
/> | ||
) | ||
<BitcoinContractEntryPointLayout | ||
isLoading={isLoading} | ||
balance={bitcoinContractsBalance} | ||
caption={bitcoinContractsBalance.symbol} | ||
icon={<BitcoinContractIcon />} | ||
usdBalance={bitcoinContractsBalanceInUSD} | ||
onClick={onClick} | ||
/> | ||
); | ||
} |
25 changes: 25 additions & 0 deletions
25
src/app/components/crypto-assets/choose-crypto-asset/choose-asset-container.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,25 @@ | ||
import { Flex } from 'leather-styles/jsx'; | ||
|
||
import { HasChildren } from '@app/common/has-children'; | ||
import { whenPageMode } from '@app/common/utils'; | ||
|
||
export function ChooseAssetContainer({ children }: HasChildren) { | ||
return whenPageMode({ | ||
full: ( | ||
<Flex | ||
borderRadius={['unset', '16px']} | ||
height="fit-content" | ||
maxWidth={['100%', 'centeredPageFullWidth']} | ||
minWidth={['100%', 'centeredPageFullWidth']} | ||
background="accent.background-primary" | ||
> | ||
{children} | ||
</Flex> | ||
), | ||
popup: ( | ||
<Flex background="accent.background-primary" width="100%"> | ||
{children} | ||
</Flex> | ||
), | ||
}); | ||
} |
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,50 @@ | ||
import { BrowserClient, Feedback, getCurrentHub } from '@sentry/react'; | ||
import { Flex } from 'leather-styles/jsx'; | ||
|
||
import { analytics } from '@shared/utils/analytics'; | ||
|
||
import { useThemeSwitcher } from '@app/common/theme-provider'; | ||
import { LeatherButton } from '@app/ui/components/button'; | ||
import { MegaphoneIcon } from '@app/ui/components/icons/megaphone-icon'; | ||
|
||
export function openFeedbackDialog() { | ||
void analytics.track('user_clicked_feedback_button'); | ||
const client = getCurrentHub().getClient<BrowserClient>(); | ||
const feedback = client?.getIntegration(Feedback); | ||
if (!feedback) return; | ||
feedback.openDialog(); | ||
} | ||
|
||
export function FeedbackButton() { | ||
const { theme } = useThemeSwitcher(); | ||
return ( | ||
<LeatherButton | ||
background="brown.1" | ||
_hover={{ background: 'brown.2' }} | ||
variant="ghost" | ||
size="sm" | ||
pos="fixed" | ||
bottom="space.04" | ||
right="space.04" | ||
left="auto" | ||
top="auto" | ||
boxShadow={ | ||
theme === 'light' | ||
? '0px 12px 24px 0px rgba(18, 16, 15, 0.08), 0px 4px 8px 0px rgba(18, 16, 15, 0.08), 0px 0px 2px 0px rgba(18, 16, 15, 0.08);' | ||
: undefined | ||
} | ||
filter={ | ||
theme === 'dark' | ||
? 'drop-shadow(0px 12px 24px rgba(247, 245, 243, 0.08)) drop-shadow(0px 4px 8px rgba(247, 245, 243, 0.08)) drop-shadow(0px 0px 2px rgba(247, 245, 243, 0.50));' | ||
: undefined | ||
} | ||
zIndex={9} | ||
onClick={openFeedbackDialog} | ||
> | ||
<Flex> | ||
<MegaphoneIcon mr="space.01" mt="2px" /> | ||
Give feedback | ||
</Flex> | ||
</LeatherButton> | ||
); | ||
} |
Oops, something went wrong.