Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address table refresh #142

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import Nft from './pages/Nft';
import { NftList } from './pages/NftList';
import { Offers } from './pages/Offers';
import PeerList from './pages/PeerList';
import Receive from './pages/Receive';
import Addresses from './pages/Addresses';
import Send from './pages/Send';
import Settings from './pages/Settings';
import Token from './pages/Token';
Expand Down Expand Up @@ -58,7 +58,7 @@ const router = createHashRouter(
<Route path='token/:asset_id' element={<Token />} />
<Route path='issue-token' element={<IssueToken />} />
<Route path='send/:asset_id' element={<Send />} />
<Route path='receive' element={<Receive />} />
<Route path='addresses' element={<Addresses />} />
</Route>
<Route path='/nfts' element={<Wallet />}>
<Route path='' element={<NftList />} />
Expand Down
20 changes: 18 additions & 2 deletions src/components/AddressList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
import { ChevronLeft, ChevronRight } from 'lucide-react';
import { useMemo } from 'react';
import { Button } from './ui/button';
import { CopyButton } from './CopyButton';

export interface AddressListProps {
addresses: string[];
Expand Down Expand Up @@ -46,6 +47,18 @@ export default function AddressList(props: AddressListProps) {
cell: (info) => (
<div className='truncate'>{info.getValue() as string}</div>
),
size: 140,
},
{
header: 'Actions',
cell: (info) => (
<div>
<CopyButton
value={info.row.original.address}
className='flex-shrink-0'
/>
</div>
),
},
];

Expand Down Expand Up @@ -85,9 +98,12 @@ export default function AddressList(props: AddressListProps) {
<TableBody>
{table.getRowModel().rows?.length ? (
table.getRowModel().rows.map((row) => (
<TableRow key={row.id} className='h-[52px]'>
<TableRow key={row.id} className='-inset-x-2/40px]'>
{row.getVisibleCells().map((cell) => (
<TableCell key={cell.id}>
<TableCell
key={cell.id}
style={{ maxWidth: `${cell.column.getSize()}px` }}
>
{flexRender(
cell.column.columnDef.cell,
cell.getContext(),
Expand Down
2 changes: 1 addition & 1 deletion src/components/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export function Nav() {
<ArrowLeftRight className='h-4 w-4' />
Offers
</NavLink>
<NavLink url={'/wallet/receive'}>
<NavLink url={'/wallet/addresses'}>
<BookUser className='h-4 w-4' />
Addresses
</NavLink>
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Receive.tsx → src/pages/Addresses.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { commands, events } from '../bindings';
import AddressList from '../components/AddressList';
import { useWalletState } from '../state';

export default function Receive() {
export default function Addresses() {
const walletState = useWalletState();

const [addresses, setAddresses] = useState<string[]>([]);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export default function Token() {
<Send className='mr-2 h-4 w-4' /> Send
</Button>
</Link>
<Link to='/wallet/receive'>
<Link to='/wallet/addresses'>
<Button variant={'outline'}>
<HandHelping className='mr-2 h-4 w-4' /> Receive
</Button>
Expand Down