Skip to content

Commit

Permalink
Merge pull request #254 from radixdlt/RC-176
Browse files Browse the repository at this point in the history
feat: open wallet's account list after linking
  • Loading branch information
dawidsowardx authored May 27, 2024
2 parents a416ea4 + e4b81be commit f29d723
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
4 changes: 3 additions & 1 deletion src/components/linked-wallet/linked-wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ import { Account } from '@radixdlt/radix-dapp-toolkit'
export const LinkedWallet = ({
name,
accounts,
isJustLinked,
onRenameWalletLink,
onForgetWallet,
}: {
name: string
isJustLinked: boolean
accounts: Account[]
onRenameWalletLink: () => void
onForgetWallet: () => void
Expand Down Expand Up @@ -114,7 +116,7 @@ export const LinkedWallet = ({
</MenuItem>
</Menu>
</Box>
<SharedAccounts accounts={accounts} />
<SharedAccounts accounts={accounts} isJustLinked={isJustLinked} />
</Box>
)
}
9 changes: 6 additions & 3 deletions src/components/linked-wallet/shared-accounts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ import ChevronDown from './chevron-down.svg'
import { Account as AccountType } from '@radixdlt/radix-dapp-toolkit'
import { Account } from 'components/account/account'
import { Box, Collapse } from '@mui/material'
import { useState } from 'react'
import { useEffect, useState } from 'react'

export const SharedAccounts = (props: { accounts?: AccountType[] }) => {
const [isCollapsed, setIsCollapsed] = useState(true)
export const SharedAccounts = (props: {
accounts?: AccountType[]
isJustLinked?: boolean
}) => {
const [isCollapsed, setIsCollapsed] = useState(!props.isJustLinked)

return (
<Box sx={{ marginTop: '-5px', marginBottom: '5px' }}>
Expand Down
6 changes: 5 additions & 1 deletion src/pairing/components/connection-status.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ export const ConnectionStatus = () => {
const [changingName, setChangingName] = useState<
{ walletPublicKey: string; isInitial: boolean } | undefined
>(undefined)
const [recentlyLinkedWallet, setRecentlyLinkedWallet] = useState<
string | undefined
>(undefined)

useEffect(() => {
if (searchParams.has('newWallet')) {
const newWalletPublicKey = searchParams.get('newWallet') as string
const isKnownWallet = searchParams.get('isKnownConnection') === 'true'

setRecentlyLinkedWallet(newWalletPublicKey)
setChangingName(
!isKnownWallet
? { walletPublicKey: newWalletPublicKey, isInitial: true }
Expand Down Expand Up @@ -93,6 +96,7 @@ export const ConnectionStatus = () => {
{connectionsClient.entries().map(([id, connection]) => (
<LinkedWallet
key={id}
isJustLinked={recentlyLinkedWallet === id}
accounts={connection.accounts}
name={connection.walletName}
onForgetWallet={() => setConnectionIdToForget(id)}
Expand Down

0 comments on commit f29d723

Please sign in to comment.