@mezo-org/passport 0.16.0-dev.1 → 0.16.0-dev.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/dist/src/hooks/useAuthenticateWithWallet.d.ts +11 -11
  2. package/dist/src/hooks/useSignInWithWallet.d.ts +11 -11
  3. package/dist/src/hooks/useSignUpWithWallet.d.ts +11 -11
  4. package/dist/src/index.d.ts +0 -1
  5. package/dist/src/index.d.ts.map +1 -1
  6. package/dist/src/index.js +0 -1
  7. package/dist/src/index.js.map +1 -1
  8. package/package.json +1 -2
  9. package/src/index.ts +0 -1
  10. package/dist/src/assets/DefaultAvatar.d.ts +0 -5
  11. package/dist/src/assets/DefaultAvatar.d.ts.map +0 -1
  12. package/dist/src/assets/DefaultAvatar.js +0 -21
  13. package/dist/src/assets/DefaultAvatar.js.map +0 -1
  14. package/dist/src/assets/EditIcon.d.ts +0 -5
  15. package/dist/src/assets/EditIcon.d.ts.map +0 -1
  16. package/dist/src/assets/EditIcon.js +0 -10
  17. package/dist/src/assets/EditIcon.js.map +0 -1
  18. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts +0 -8
  19. package/dist/src/components/Dropdown/ConnectedTrigger.d.ts.map +0 -1
  20. package/dist/src/components/Dropdown/ConnectedTrigger.js +0 -39
  21. package/dist/src/components/Dropdown/ConnectedTrigger.js.map +0 -1
  22. package/dist/src/components/Dropdown/Content.d.ts +0 -8
  23. package/dist/src/components/Dropdown/Content.d.ts.map +0 -1
  24. package/dist/src/components/Dropdown/Content.js +0 -29
  25. package/dist/src/components/Dropdown/Content.js.map +0 -1
  26. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts +0 -7
  27. package/dist/src/components/Dropdown/DisconnectedTrigger.d.ts.map +0 -1
  28. package/dist/src/components/Dropdown/DisconnectedTrigger.js +0 -13
  29. package/dist/src/components/Dropdown/DisconnectedTrigger.js.map +0 -1
  30. package/dist/src/components/Dropdown/Dropdown.d.ts +0 -23
  31. package/dist/src/components/Dropdown/Dropdown.d.ts.map +0 -1
  32. package/dist/src/components/Dropdown/Dropdown.js +0 -45
  33. package/dist/src/components/Dropdown/Dropdown.js.map +0 -1
  34. package/dist/src/components/Dropdown/ListingItem.d.ts +0 -14
  35. package/dist/src/components/Dropdown/ListingItem.d.ts.map +0 -1
  36. package/dist/src/components/Dropdown/ListingItem.js +0 -42
  37. package/dist/src/components/Dropdown/ListingItem.js.map +0 -1
  38. package/dist/src/components/Dropdown/NestedViewLayout.d.ts +0 -8
  39. package/dist/src/components/Dropdown/NestedViewLayout.d.ts.map +0 -1
  40. package/dist/src/components/Dropdown/NestedViewLayout.js +0 -33
  41. package/dist/src/components/Dropdown/NestedViewLayout.js.map +0 -1
  42. package/dist/src/components/Dropdown/Receive/Receive.d.ts +0 -4
  43. package/dist/src/components/Dropdown/Receive/Receive.d.ts.map +0 -1
  44. package/dist/src/components/Dropdown/Receive/Receive.js +0 -64
  45. package/dist/src/components/Dropdown/Receive/Receive.js.map +0 -1
  46. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts +0 -4
  47. package/dist/src/components/Dropdown/Root/AccountAddressActions.d.ts.map +0 -1
  48. package/dist/src/components/Dropdown/Root/AccountAddressActions.js +0 -49
  49. package/dist/src/components/Dropdown/Root/AccountAddressActions.js.map +0 -1
  50. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts +0 -6
  51. package/dist/src/components/Dropdown/Root/AccountBalance.d.ts.map +0 -1
  52. package/dist/src/components/Dropdown/Root/AccountBalance.js +0 -32
  53. package/dist/src/components/Dropdown/Root/AccountBalance.js.map +0 -1
  54. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts +0 -6
  55. package/dist/src/components/Dropdown/Root/AccountBtcListing.d.ts.map +0 -1
  56. package/dist/src/components/Dropdown/Root/AccountBtcListing.js +0 -28
  57. package/dist/src/components/Dropdown/Root/AccountBtcListing.js.map +0 -1
  58. package/dist/src/components/Dropdown/Root/AccountError.d.ts +0 -8
  59. package/dist/src/components/Dropdown/Root/AccountError.d.ts.map +0 -1
  60. package/dist/src/components/Dropdown/Root/AccountError.js +0 -17
  61. package/dist/src/components/Dropdown/Root/AccountError.js.map +0 -1
  62. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts +0 -4
  63. package/dist/src/components/Dropdown/Root/AccountMusdListing.d.ts.map +0 -1
  64. package/dist/src/components/Dropdown/Root/AccountMusdListing.js +0 -21
  65. package/dist/src/components/Dropdown/Root/AccountMusdListing.js.map +0 -1
  66. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts +0 -8
  67. package/dist/src/components/Dropdown/Root/AccountOtherAssets.d.ts.map +0 -1
  68. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js +0 -43
  69. package/dist/src/components/Dropdown/Root/AccountOtherAssets.js.map +0 -1
  70. package/dist/src/components/Dropdown/Root/Root.d.ts +0 -8
  71. package/dist/src/components/Dropdown/Root/Root.d.ts.map +0 -1
  72. package/dist/src/components/Dropdown/Root/Root.js +0 -49
  73. package/dist/src/components/Dropdown/Root/Root.js.map +0 -1
  74. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts +0 -4
  75. package/dist/src/components/Dropdown/Root/WalletAddress.d.ts.map +0 -1
  76. package/dist/src/components/Dropdown/Root/WalletAddress.js +0 -66
  77. package/dist/src/components/Dropdown/Root/WalletAddress.js.map +0 -1
  78. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts +0 -6
  79. package/dist/src/components/Dropdown/Root/WelcomeBlock.d.ts.map +0 -1
  80. package/dist/src/components/Dropdown/Root/WelcomeBlock.js +0 -88
  81. package/dist/src/components/Dropdown/Root/WelcomeBlock.js.map +0 -1
  82. package/dist/src/components/Dropdown/Settings/InlineEditField.d.ts +0 -12
  83. package/dist/src/components/Dropdown/Settings/InlineEditField.d.ts.map +0 -1
  84. package/dist/src/components/Dropdown/Settings/InlineEditField.js +0 -95
  85. package/dist/src/components/Dropdown/Settings/InlineEditField.js.map +0 -1
  86. package/dist/src/components/Dropdown/Settings/Settings.d.ts +0 -4
  87. package/dist/src/components/Dropdown/Settings/Settings.d.ts.map +0 -1
  88. package/dist/src/components/Dropdown/Settings/Settings.js +0 -36
  89. package/dist/src/components/Dropdown/Settings/Settings.js.map +0 -1
  90. package/dist/src/components/Dropdown/SlotNumber.d.ts +0 -19
  91. package/dist/src/components/Dropdown/SlotNumber.d.ts.map +0 -1
  92. package/dist/src/components/Dropdown/SlotNumber.js +0 -67
  93. package/dist/src/components/Dropdown/SlotNumber.js.map +0 -1
  94. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts +0 -3
  95. package/dist/src/components/Dropdown/TestnetTopBanner.d.ts.map +0 -1
  96. package/dist/src/components/Dropdown/TestnetTopBanner.js +0 -14
  97. package/dist/src/components/Dropdown/TestnetTopBanner.js.map +0 -1
  98. package/dist/src/components/Dropdown/index.d.ts +0 -3
  99. package/dist/src/components/Dropdown/index.d.ts.map +0 -1
  100. package/dist/src/components/Dropdown/index.js +0 -2
  101. package/dist/src/components/Dropdown/index.js.map +0 -1
  102. package/dist/src/components/index.d.ts +0 -2
  103. package/dist/src/components/index.d.ts.map +0 -1
  104. package/dist/src/components/index.js +0 -2
  105. package/dist/src/components/index.js.map +0 -1
  106. package/src/assets/DefaultAvatar.tsx +0 -74
  107. package/src/assets/EditIcon.tsx +0 -33
  108. package/src/components/Dropdown/ConnectedTrigger.tsx +0 -76
  109. package/src/components/Dropdown/Content.tsx +0 -56
  110. package/src/components/Dropdown/DisconnectedTrigger.tsx +0 -36
  111. package/src/components/Dropdown/Dropdown.tsx +0 -100
  112. package/src/components/Dropdown/ListingItem.tsx +0 -176
  113. package/src/components/Dropdown/NestedViewLayout.tsx +0 -88
  114. package/src/components/Dropdown/README.md +0 -41
  115. package/src/components/Dropdown/Receive/Receive.tsx +0 -144
  116. package/src/components/Dropdown/Root/AccountAddressActions.tsx +0 -99
  117. package/src/components/Dropdown/Root/AccountBalance.tsx +0 -69
  118. package/src/components/Dropdown/Root/AccountBtcListing.tsx +0 -53
  119. package/src/components/Dropdown/Root/AccountError.tsx +0 -34
  120. package/src/components/Dropdown/Root/AccountMusdListing.tsx +0 -45
  121. package/src/components/Dropdown/Root/AccountOtherAssets.tsx +0 -85
  122. package/src/components/Dropdown/Root/Root.tsx +0 -104
  123. package/src/components/Dropdown/Root/WalletAddress.tsx +0 -123
  124. package/src/components/Dropdown/Root/WelcomeBlock.tsx +0 -173
  125. package/src/components/Dropdown/Settings/InlineEditField.tsx +0 -212
  126. package/src/components/Dropdown/Settings/Settings.tsx +0 -87
  127. package/src/components/Dropdown/SlotNumber.tsx +0 -131
  128. package/src/components/Dropdown/TestnetTopBanner.tsx +0 -32
  129. package/src/components/Dropdown/index.ts +0 -2
  130. package/src/components/index.ts +0 -1
@@ -1,99 +0,0 @@
1
- import {
2
- ArrowNarrowLeft,
3
- Block,
4
- BlockProps,
5
- Button,
6
- ButtonProps,
7
- mergeOverrides,
8
- useStyletron,
9
- } from "@mezo-org/mezo-clay"
10
- import React from "react"
11
- import { usePassportContext } from "../../../hooks/usePassportContext"
12
- import { getAddressExplorerUrl } from "../../../utils/address"
13
- import useDropdownStore, { DropdownView } from "../../../stores/dropdownStore"
14
- import { useWalletAccount } from "../../../hooks/useWalletAccount"
15
-
16
- const buttonStartEnhancerSize = 12
17
-
18
- const commonButtonProps: Partial<ButtonProps> = {
19
- kind: "secondary",
20
- size: "small",
21
- shape: "pill",
22
- overrides: {
23
- BaseButton: {
24
- style: {
25
- flex: 1,
26
- },
27
- },
28
- StartEnhancer: {
29
- style: {
30
- stroke: "currentColor",
31
- },
32
- },
33
- },
34
- }
35
-
36
- export default function AccountAddressActions(props: BlockProps) {
37
- const { overrides, ...restProps } = props
38
-
39
- const [, theme] = useStyletron()
40
- const { environment } = usePassportContext()
41
- const setDropdownView = useDropdownStore((state) => state.setView)
42
- const handleReceiveClick = () => setDropdownView(DropdownView.RECEIVE)
43
-
44
- const walletAccount = useWalletAccount()
45
-
46
- const blockExplorerUrl = getAddressExplorerUrl(
47
- walletAccount.accountAddress!,
48
- "mezo",
49
- environment === "testnet",
50
- )
51
-
52
- return (
53
- <Block
54
- display="flex"
55
- alignItems="center"
56
- backgroundColor="transparent"
57
- padding={`0 ${theme.sizing.scale600} ${theme.sizing.scale800}`}
58
- overrides={mergeOverrides(
59
- {
60
- Block: {
61
- style: {
62
- gap: theme.sizing.scale600,
63
- },
64
- },
65
- },
66
- overrides,
67
- )}
68
- {...restProps}
69
- >
70
- <Button
71
- onClick={handleReceiveClick}
72
- startEnhancer={
73
- <ArrowNarrowLeft
74
- size={buttonStartEnhancerSize}
75
- overrides={{
76
- Svg: {
77
- style: {
78
- transform: "rotate(-45deg)",
79
- },
80
- },
81
- }}
82
- />
83
- }
84
- {...commonButtonProps}
85
- >
86
- Receive
87
- </Button>
88
-
89
- <Button
90
- $as="a"
91
- href={blockExplorerUrl}
92
- target="_blank"
93
- {...commonButtonProps}
94
- >
95
- Block Explorer
96
- </Button>
97
- </Block>
98
- )
99
- }
@@ -1,69 +0,0 @@
1
- import React from "react"
2
- import { BlockProps, useStyletron } from "@mezo-org/mezo-clay"
3
- import { formatUnits } from "viem"
4
- import ListingItem from "../ListingItem"
5
- import { useTokensBalances } from "../../../hooks/useTokensBalances"
6
- import { useBorrowData } from "../../../hooks/useBorrowData"
7
- import AccountError from "./AccountError"
8
- import { CONVERSION_RATE_DECIMALS } from "../../../hooks/useAssetsConversionRates"
9
- import { usePassportContext } from "../../../hooks/usePassportContext"
10
-
11
- type AccountBalanceProps = Omit<BlockProps, "children">
12
-
13
- export default function AccountBalance(props: AccountBalanceProps) {
14
- const { overrides, ...restProps } = props
15
- const [, theme] = useStyletron()
16
- const { nativeBalanceRefetchInterval } = usePassportContext()
17
-
18
- const {
19
- data: tokensBalancesData,
20
- isError: isTokensBalancesError,
21
- isPending: isTokensBalancesDataPending,
22
- } = useTokensBalances({
23
- queryOptions: {
24
- staleTime: nativeBalanceRefetchInterval,
25
- refetchInterval: nativeBalanceRefetchInterval,
26
- },
27
- })
28
- const {
29
- data: borrowData,
30
- isError: isBorrowDataError,
31
- isPending: isBorrowDataPending,
32
- } = useBorrowData()
33
-
34
- if (isTokensBalancesDataPending || isBorrowDataPending) {
35
- return <ListingItem isLoading overrides={overrides} />
36
- }
37
-
38
- if (isTokensBalancesError || isBorrowDataError) {
39
- return (
40
- <AccountError
41
- padding={`${theme.sizing.scale500} ${theme.sizing.scale800}`}
42
- topic="account balance"
43
- overrides={overrides}
44
- />
45
- )
46
- }
47
-
48
- const totalBalanceInUsd = Object.values(tokensBalancesData).reduce(
49
- (acc, tokenBalance) => acc + tokenBalance.usd.value,
50
- 0n,
51
- )
52
-
53
- const totalBalanceNumber = Number(
54
- formatUnits(totalBalanceInUsd, CONVERSION_RATE_DECIMALS),
55
- )
56
-
57
- const totalDebtNumber = Number(borrowData.debtInUsd.formatted)
58
-
59
- return (
60
- <ListingItem
61
- label="Total assets"
62
- value={totalBalanceNumber}
63
- subLabel="Total liabilities"
64
- subValue={totalDebtNumber}
65
- overrides={overrides}
66
- {...restProps}
67
- />
68
- )
69
- }
@@ -1,53 +0,0 @@
1
- import React from "react"
2
- import { BitcoinCircle, BlockProps } from "@mezo-org/mezo-clay"
3
- import ListingItem from "../ListingItem"
4
- import { getAsset } from "../../../utils/assets"
5
- import { useBorrowData } from "../../../hooks/useBorrowData"
6
- import { useTokensBalances } from "../../../hooks/useTokensBalances"
7
- import AccountError from "./AccountError"
8
- import { usePassportContext } from "../../../hooks/usePassportContext"
9
-
10
- type AccountBTCListingProps = Omit<BlockProps, "children">
11
-
12
- export default function AccountBTCListing(props: AccountBTCListingProps) {
13
- const { nativeBalanceRefetchInterval } = usePassportContext()
14
-
15
- const {
16
- data: borrowData,
17
- isError: isBorrowDataError,
18
- isPending: isBorrowDataPending,
19
- } = useBorrowData()
20
-
21
- const {
22
- data: tokensBalancesData,
23
- isError: isTokensBalancesError,
24
- isPending: isTokensBalancesPending,
25
- } = useTokensBalances({
26
- queryOptions: {
27
- staleTime: nativeBalanceRefetchInterval,
28
- refetchInterval: nativeBalanceRefetchInterval,
29
- },
30
- })
31
-
32
- if (isTokensBalancesPending || isBorrowDataPending) {
33
- return <ListingItem isLoading />
34
- }
35
-
36
- if (isTokensBalancesError || isBorrowDataError) {
37
- return <AccountError topic="Bitcoin balance" />
38
- }
39
-
40
- const btcBalance = Number(tokensBalancesData.BTC.usd.formatted)
41
- const lockedCollateral = Number(borrowData.collateral.usd.formatted)
42
-
43
- return (
44
- <ListingItem
45
- icon={<BitcoinCircle />}
46
- label={getAsset("BTC").name}
47
- value={btcBalance}
48
- subLabel="Locked collateral"
49
- subValue={lockedCollateral}
50
- {...props}
51
- />
52
- )
53
- }
@@ -1,34 +0,0 @@
1
- import React from "react"
2
- import {
3
- BlockProps,
4
- LabelSmall,
5
- mergeOverrides,
6
- useStyletron,
7
- } from "@mezo-org/mezo-clay"
8
-
9
- type AccountErrorProps = {
10
- topic: string
11
- } & BlockProps
12
-
13
- export default function AccountError(props: AccountErrorProps) {
14
- const { topic, overrides, ...restProps } = props
15
-
16
- const [, theme] = useStyletron()
17
-
18
- return (
19
- <LabelSmall
20
- padding={`${theme.sizing.scale600} ${theme.sizing.scale800}`}
21
- color="negative"
22
- overrides={mergeOverrides(overrides, {
23
- Block: {
24
- style: {
25
- lineHeight: theme.sizing.scale700,
26
- },
27
- },
28
- })}
29
- {...restProps}
30
- >
31
- An error occured loading {topic}.
32
- </LabelSmall>
33
- )
34
- }
@@ -1,45 +0,0 @@
1
- import React from "react"
2
- import { BlockProps, MUsdCircle02 } from "@mezo-org/mezo-clay"
3
- import ListingItem from "../ListingItem"
4
- import { getAsset } from "../../../utils/assets"
5
- import { useBorrowData } from "../../../hooks/useBorrowData"
6
- import { useTokensBalances } from "../../../hooks/useTokensBalances"
7
- import AccountError from "./AccountError"
8
-
9
- export default function AccountMusdListing(
10
- props: Omit<BlockProps, "children">,
11
- ) {
12
- const {
13
- data: borrowData,
14
- isError: isBorrowDataError,
15
- isPending: isBorrowDataPending,
16
- } = useBorrowData()
17
-
18
- const {
19
- data: tokensBalancesData,
20
- isError: isTokensBalancesError,
21
- isPending: isTokensBalancesPending,
22
- } = useTokensBalances()
23
-
24
- if (isBorrowDataPending || isTokensBalancesPending) {
25
- return <ListingItem isLoading />
26
- }
27
-
28
- if (isBorrowDataError || isTokensBalancesError) {
29
- return <AccountError topic="MUSD balance" />
30
- }
31
-
32
- const musdBalance = Number(tokensBalancesData.MUSD.usd.formatted)
33
- const lockedCollateral = Number(borrowData.debtInUsd.formatted)
34
-
35
- return (
36
- <ListingItem
37
- icon={<MUsdCircle02 />}
38
- label={getAsset("MUSD").name}
39
- value={musdBalance}
40
- subLabel="Borrowed"
41
- subValue={lockedCollateral}
42
- {...props}
43
- />
44
- )
45
- }
@@ -1,85 +0,0 @@
1
- import React from "react"
2
- import {
3
- useStyletron,
4
- CoinsStacked02,
5
- mergeOverrides,
6
- BlockProps,
7
- } from "@mezo-org/mezo-clay"
8
- import { formatUnits } from "viem"
9
- import ListingItem from "../ListingItem"
10
- import { useTokensBalances } from "../../../hooks/useTokensBalances"
11
- import AccountError from "./AccountError"
12
- import { CONVERSION_RATE_DECIMALS } from "../../../hooks/useAssetsConversionRates"
13
-
14
- type AccountOtherAssetsProps = {
15
- onClick?: () => void
16
- } & Omit<BlockProps, "children">
17
-
18
- export default function AccountOtherAssets(props: AccountOtherAssetsProps) {
19
- const { onClick, overrides, ...restProps } = props
20
-
21
- const [, theme] = useStyletron()
22
-
23
- const {
24
- data: tokensBalancesData,
25
- isPending: isTokensBalancesPending,
26
- isError: isTokensBalancesError,
27
- } = useTokensBalances()
28
-
29
- if (isTokensBalancesPending) {
30
- return <ListingItem isLoading overrides={overrides} />
31
- }
32
-
33
- if (isTokensBalancesError) {
34
- return (
35
- <AccountError
36
- topic="other assets"
37
- paddingTop={theme.sizing.scale100}
38
- paddingBottom={theme.sizing.scale100}
39
- overrides={overrides}
40
- />
41
- )
42
- }
43
-
44
- const otherAssets = Object.values(tokensBalancesData)
45
- .filter((asset) => !["BTC", "MUSD"].includes(asset.symbol))
46
- .filter((asset) => asset.value > 0n)
47
-
48
- const assetsCount = otherAssets.length
49
- const totalAssetsInUsd = Number(
50
- formatUnits(
51
- otherAssets.reduce((total, asset) => total + asset.usd.value, 0n),
52
- CONVERSION_RATE_DECIMALS,
53
- ),
54
- )
55
-
56
- let label = "No other assets"
57
- if (assetsCount === 1) label = "1 more asset"
58
- if (assetsCount > 1) label = `${assetsCount} more assets`
59
-
60
- return (
61
- <ListingItem
62
- icon={<CoinsStacked02 color={theme.colors.contentPrimary} />}
63
- label={label}
64
- value={totalAssetsInUsd}
65
- overrides={mergeOverrides(
66
- {
67
- Block: {
68
- props: {
69
- $as: "button",
70
- onClick,
71
- },
72
- style: {
73
- borderWidth: 0,
74
- cursor: "pointer",
75
- backgroundColor: "transparent",
76
- minHeight: "56px",
77
- },
78
- },
79
- },
80
- overrides,
81
- )}
82
- {...restProps}
83
- />
84
- )
85
- }
@@ -1,104 +0,0 @@
1
- import {
2
- Block,
3
- Button,
4
- LogOut01,
5
- Settings01,
6
- useStyletron,
7
- } from "@mezo-org/mezo-clay"
8
- import React, { useCallback } from "react"
9
- import { useDisconnect } from "wagmi"
10
- import { useSignOut } from "../../../hooks"
11
- import WalletAddress from "./WalletAddress"
12
- import AccountBalance from "./AccountBalance"
13
- import WelcomeBlock from "./WelcomeBlock"
14
- import AccountAddressActions from "./AccountAddressActions"
15
- import AccountOtherAssets from "./AccountOtherAssets"
16
- import AccountBtcListing from "./AccountBtcListing"
17
- import AccountMusdListing from "./AccountMusdListing"
18
- import useDropdownStore, { DropdownView } from "../../../stores/dropdownStore"
19
-
20
- type RootProps = {
21
- onSignOut?: () => void
22
- onOtherAssetsClick?: () => void
23
- }
24
-
25
- export default function Root(props: RootProps) {
26
- const { onSignOut, onOtherAssetsClick } = props
27
-
28
- const [, theme] = useStyletron()
29
-
30
- const { disconnect } = useDisconnect()
31
- const { signOut } = useSignOut()
32
-
33
- const setDropdownView = useDropdownStore((state) => state.setView)
34
- const handleSettingsClick = useCallback(
35
- () => setDropdownView(DropdownView.SETTINGS),
36
- [setDropdownView],
37
- )
38
-
39
- const handleLogOut = useCallback(() => {
40
- if (onSignOut) {
41
- onSignOut()
42
- return
43
- }
44
- signOut()
45
- disconnect()
46
- }, [signOut, disconnect, onSignOut])
47
-
48
- const overridesWithDivider = {
49
- Block: {
50
- style: {
51
- borderBottomWidth: "1px",
52
- borderBottomStyle: "solid",
53
- borderBottomColor: theme.colors.borderOpaque,
54
- },
55
- },
56
- }
57
-
58
- return (
59
- <Block display="inline-flex" flexDirection="column">
60
- <WelcomeBlock />
61
-
62
- <AccountAddressActions overrides={overridesWithDivider} />
63
-
64
- <WalletAddress overrides={overridesWithDivider} />
65
-
66
- <AccountBalance overrides={overridesWithDivider} />
67
-
68
- <AccountBtcListing />
69
-
70
- <AccountMusdListing />
71
-
72
- <AccountOtherAssets
73
- onClick={onOtherAssetsClick}
74
- overrides={overridesWithDivider}
75
- />
76
-
77
- <Block
78
- display="flex"
79
- alignItems="center"
80
- justifyContent="space-between"
81
- padding={theme.sizing.scale300}
82
- >
83
- <Button
84
- size="small"
85
- shape="pill"
86
- kind="tertiary"
87
- startEnhancer={<Settings01 color="currentColor" size={16} />}
88
- onClick={handleSettingsClick}
89
- >
90
- Settings
91
- </Button>
92
- <Button
93
- size="small"
94
- shape="pill"
95
- kind="tertiary"
96
- startEnhancer={<LogOut01 color="currentColor" size={16} />}
97
- onClick={handleLogOut}
98
- >
99
- Sign out
100
- </Button>
101
- </Block>
102
- </Block>
103
- )
104
- }
@@ -1,123 +0,0 @@
1
- import {
2
- BitcoinCircle,
3
- Block,
4
- BlockProps,
5
- EthCircle,
6
- LabelMedium,
7
- LabelXSmall,
8
- mergeOverrides,
9
- MonoLabelXSmall,
10
- useStyletron,
11
- } from "@mezo-org/mezo-clay"
12
- import React, { useState } from "react"
13
- import { useCopyToClipboard } from "usehooks-ts"
14
- import { usePassportContext } from "../../../hooks/usePassportContext"
15
- import { getAddressExplorerUrl, trimAddress } from "../../../utils/address"
16
- import { useWalletAccount } from "../../../hooks/useWalletAccount"
17
-
18
- export default function WalletAddress(props: BlockProps) {
19
- const { overrides, ...restProps } = props
20
- const { walletAddress, networkFamily } = useWalletAccount()
21
- const { environment = "mainnet" } = usePassportContext()
22
- const [, theme] = useStyletron()
23
- const [, copy] = useCopyToClipboard()
24
- const [isCopiedMessageVisible, setIsCopiedMessageVisible] = useState(false)
25
-
26
- const handleCopyAddress = () => {
27
- copy(walletAddress!)
28
- setIsCopiedMessageVisible(true)
29
-
30
- setTimeout(() => {
31
- setIsCopiedMessageVisible(false)
32
- }, 2000)
33
- }
34
-
35
- const blockExplorerUrl = getAddressExplorerUrl(
36
- walletAddress!,
37
- networkFamily,
38
- environment === "testnet",
39
- )
40
- const trimmedAddress = trimAddress(walletAddress!)
41
- const AccountIcon = networkFamily === "bitcoin" ? BitcoinCircle : EthCircle
42
-
43
- return (
44
- <Block
45
- as="button"
46
- onClick={handleCopyAddress}
47
- display="flex"
48
- alignItems="center"
49
- backgroundColor="transparent"
50
- padding={`${theme.sizing.scale800} ${theme.sizing.scale700}`}
51
- overrides={mergeOverrides(
52
- {
53
- Block: {
54
- style: {
55
- gap: theme.sizing.scale700,
56
- borderWidth: 0,
57
- cursor: "pointer",
58
- ":hover": {
59
- backgroundColor: theme.colors.backgroundTertiary,
60
- },
61
- },
62
- },
63
- },
64
- overrides,
65
- )}
66
- {...restProps}
67
- >
68
- <AccountIcon
69
- color={theme.colors.black}
70
- size={theme.sizing.scale800}
71
- overrides={{
72
- Svg: {
73
- style: {
74
- backgroundColor: theme.colors.black,
75
- overflow: "hidden",
76
- borderRadius: theme.borders.radius200,
77
- },
78
- },
79
- }}
80
- />
81
- <Block
82
- display="flex"
83
- flexDirection="column"
84
- alignItems="flex-start"
85
- overrides={{
86
- Block: {
87
- style: {
88
- gap: theme.sizing.scale100,
89
- },
90
- },
91
- }}
92
- >
93
- <LabelMedium>Connected Wallet</LabelMedium>
94
-
95
- {isCopiedMessageVisible ? (
96
- <LabelXSmall color={theme.colors.contentSecondary}>
97
- Copied address to clipboard
98
- </LabelXSmall>
99
- ) : (
100
- <Block
101
- as="a"
102
- color={theme.colors.contentSecondary}
103
- href={blockExplorerUrl}
104
- target="_blank"
105
- overrides={{
106
- Block: {
107
- style: {
108
- color: "inherit",
109
- textDecoration: "none",
110
- ":hover": {
111
- textDecoration: "underline",
112
- },
113
- },
114
- },
115
- }}
116
- >
117
- <MonoLabelXSmall>{trimmedAddress}</MonoLabelXSmall>
118
- </Block>
119
- )}
120
- </Block>
121
- </Block>
122
- )
123
- }