Skip to content

Commit

Permalink
feat: walletd prominent receive button
Browse files Browse the repository at this point in the history
  • Loading branch information
alexfreska committed Apr 15, 2024
1 parent 61de825 commit 63b0337
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 22 deletions.
5 changes: 5 additions & 0 deletions .changeset/hot-dancers-peel.md
@@ -0,0 +1,5 @@
---
'walletd': minor
---

Added a receive button in addition to the addresses button to make send/receive options more clear. Closes https://github.com/SiaFoundation/walletd/issues/88
4 changes: 2 additions & 2 deletions apps/walletd/components/Wallet/AddressesButton.tsx
@@ -1,5 +1,5 @@
import { LinkButton } from '@siafoundation/design-system'
import { ArrowDownLeft16 } from '@siafoundation/react-icons'
import { ListNumbered16 } from '@siafoundation/react-icons'
import { routes } from '../../config/routes'
import { useRouter } from 'next/router'

Expand All @@ -16,7 +16,7 @@ export function AddressesButton() {
},
}}
>
<ArrowDownLeft16 />
<ListNumbered16 />
Addresses
</LinkButton>
)
Expand Down
63 changes: 44 additions & 19 deletions apps/walletd/components/Wallet/WalletActionsMenu.tsx
@@ -1,5 +1,9 @@
import { Button } from '@siafoundation/design-system'
import { ArrowUpRight16, Settings16 } from '@siafoundation/react-icons'
import {
ArrowDownLeft16,
ArrowUpRight16,
Settings16,
} from '@siafoundation/react-icons'
import { useSyncStatus } from '../../hooks/useSyncStatus'
import BigNumber from 'bignumber.js'
import { AddressesButton } from './AddressesButton'
Expand All @@ -10,6 +14,7 @@ import { useWallets } from '../../contexts/wallets'
import { useDialog } from '../../contexts/dialog'
import { WalletContextMenu } from '../WalletContextMenu'
import { WalletBalanceWithSf } from './WalletBalanceWithSf'
import { useAddresses } from '../../contexts/addresses'

export function WalletActionsMenu() {
const status = useSyncStatus()
Expand All @@ -22,6 +27,7 @@ export function WalletActionsMenu() {
},
})
const { wallet } = useWallets()
const { dataset } = useAddresses()
return (
<div className="flex gap-2">
<WalletBalanceWithSf
Expand All @@ -31,25 +37,44 @@ export function WalletActionsMenu() {
/>
<AddressesButton />
{wallet?.metadata.type !== 'watch' && (
<Button
aria-label="send"
size="small"
variant="accent"
onClick={() => {
if (wallet?.metadata.type === 'seed') {
openDialog('walletSendSeed', {
walletId,
<>
<Button
aria-label="receive"
size="small"
variant="accent"
onClick={() => {
const addressLowestIndex = dataset?.sort((a, b) =>
a.metadata.index > b.metadata.index ? 1 : -1
)[0]?.address
openDialog('addressUpdate', {
walletId: walletId,
address: addressLowestIndex,
})
} else if (wallet?.metadata.type === 'ledger') {
openDialog('walletSendLedger', {
walletId,
})
}
}}
>
<ArrowUpRight16 />
Send
</Button>
}}
>
<ArrowDownLeft16 />
Receive
</Button>
<Button
aria-label="send"
size="small"
variant="accent"
onClick={() => {
if (wallet?.metadata.type === 'seed') {
openDialog('walletSendSeed', {
walletId,
})
} else if (wallet?.metadata.type === 'ledger') {
openDialog('walletSendLedger', {
walletId,
})
}
}}
>
<ArrowUpRight16 />
Send
</Button>
</>
)}
<EventsViewDropdownMenu />
{wallet && (
Expand Down
2 changes: 1 addition & 1 deletion apps/walletd/contexts/events/columns.tsx
Expand Up @@ -122,7 +122,7 @@ export const columns: EventsTableColumn[] = [
return null
}
return (
<div className="flex flex-col gap-2">
<div className="flex flex-col gap-2 items-end">
{!amountSc.isZero() && (
<ValueScFiat displayBoth size="12" value={amountSc} />
)}
Expand Down

0 comments on commit 63b0337

Please sign in to comment.