Skip to content

Commit e9e6732

Browse files
author
Jann Müller
committed
Rename accounts. Copy address from WST table
1 parent e605c73 commit e9e6732

File tree

8 files changed

+31
-25
lines changed

8 files changed

+31
-25
lines changed

frontend/src/app/[username]/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ export default function Profile() {
2727

2828
const getUserAccountDetails = () => {
2929
switch (currentUser) {
30-
case "User A": return accounts.userA;
31-
case "User B": return accounts.userB;
30+
case "Alice": return accounts.alice;
31+
case "Bob": return accounts.bob;
3232
case "Connected Wallet": return accounts.walletUser;
3333
};
3434
};

frontend/src/app/[username]/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import Profile from '.';
22

33
export async function generateStaticParams() {
44
return [
5-
{ username: 'user-a' },
6-
{ username: 'user-b' },
5+
{ username: 'alice' },
6+
{ username: 'bob' },
77
{ username: 'connected-wallet' } // connected wallet
88
]
99
}

frontend/src/app/clientLayout.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,13 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
2222
try {
2323
// retrieve wallet info
2424
const mintAuthorityWallet = await getWalletFromSeed(mintAccount.mnemonic);
25-
const walletA = await getWalletFromSeed(accounts.userA.mnemonic);
26-
const walletB = await getWalletFromSeed(accounts.userB.mnemonic);
25+
const walletA = await getWalletFromSeed(accounts.alice.mnemonic);
26+
const walletB = await getWalletFromSeed(accounts.bob.mnemonic);
2727

2828
// Update Zustand store with the initialized wallet information
2929
changeMintAccountDetails({ ...mintAccount, address: mintAuthorityWallet.address});
30-
changeWalletAccountDetails('userA', { ...accounts.userA, address: walletA.address},);
31-
changeWalletAccountDetails('userB', { ...accounts.userB, address: walletB.address});
30+
changeWalletAccountDetails('alice', { ...accounts.alice, address: walletA.address},);
31+
changeWalletAccountDetails('bob', { ...accounts.bob, address: walletB.address});
3232

3333
const initialLucid = await makeLucid();
3434
setLucidInstance(initialLucid);
@@ -41,7 +41,7 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
4141
fetchUserWallets();
4242
},[]);
4343

44-
if(accounts.userB.address === '') {
44+
if(accounts.bob.address === '') {
4545
return <div className="mainLoadingContainer">
4646
<div className="mainLoader" />
4747
</div>;

frontend/src/app/components/ProfileSwitcher.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,9 @@ export default function ProfileSwitcher() {
8686
onClose={handleClose}
8787
>
8888
<MenuItem onClick={() => handleSelect('Mint Authority')}>Mint Authority</MenuItem>
89-
<MenuItem onClick={() => handleSelect('User A')}>User A</MenuItem>
90-
<MenuItem onClick={() => handleSelect('User B')}>User B</MenuItem>
91-
<MenuItem onClick={() => handleWalletConnect('Connected Wallet')}>Lace</MenuItem>
89+
<MenuItem onClick={() => handleSelect('Alice')}>Alice</MenuItem>
90+
<MenuItem onClick={() => handleSelect('Bob')}>Bob</MenuItem>
91+
{/* <MenuItem onClick={() => handleWalletConnect('Connected Wallet')}>Lace</MenuItem> */}
9292
</Menu>
9393
</>
9494
);

frontend/src/app/components/WSTTable.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@ import TableCell from "@mui/material/TableCell";
1212
import TableHead from "@mui/material/TableHead";
1313
import TableRow from "@mui/material/TableRow";
1414
import Paper from "@mui/material/Paper";
15+
import ContentCopyIcon from '@mui/icons-material/ContentCopy';
1516

1617
//Local Imports
1718
import useStore from '../store/store';
1819
import { useEffect } from "react";
20+
import IconButton from './WSTIconButton';
1921

2022
const progLogicBase : LucidCredential = {
2123
type: "Script",
@@ -43,6 +45,9 @@ export default function WSTTable() {
4345
getAccounts();
4446
}, []);
4547

48+
const copyToClipboard = (str: string) => {
49+
navigator.clipboard.writeText(str);
50+
}
4651

4752
return (
4853
<Box className="tableContainerBox">
@@ -61,6 +66,7 @@ export default function WSTTable() {
6166
<TableRow key={i}>
6267
<TableCell>
6368
{`${acct?.address.slice(0,15)}...${acct?.address.slice(104,108)}`}
69+
<IconButton onClick={() => copyToClipboard(acct.address)} icon={<ContentCopyIcon />}/>
6470
</TableCell>
6571
<TableCell sx={{color: acct.status === 'Frozen' ? 'error.main' : 'success.main', fontWeight: '500'}}>
6672
{acct.status}

frontend/src/app/mint-authority/page.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ export default function Home() {
4949

5050
const fetchUserDetails = async () => {
5151
const mintBalance = await getWalletBalance(mintAccount.address);
52-
const userABalance = await getWalletBalance(accounts.userA.address);
53-
const userBBalance = await getWalletBalance(accounts.userB.address);
52+
const userABalance = await getWalletBalance(accounts.alice.address);
53+
const userBBalance = await getWalletBalance(accounts.bob.address);
5454

5555
// Update Zustand store with the initialized wallet information
5656
await changeMintAccountDetails({ ...mintAccount, balance: mintBalance});
57-
await changeWalletAccountDetails('userA', { ...accounts.userA, balance: userABalance});
58-
await changeWalletAccountDetails('userB', { ...accounts.userB, balance: userBBalance});
57+
await changeWalletAccountDetails('alice', { ...accounts.alice, balance: userABalance});
58+
await changeWalletAccountDetails('bob', { ...accounts.bob, balance: userBBalance});
5959
};
6060

6161
const fetchBlacklistStatus = async () => {
@@ -400,7 +400,7 @@ maxRows={3}
400400
return <>
401401
<Box sx={{display: 'flex', justifyContent: 'space-between', alignItems: 'end', marginBottom: '16px'}}>
402402
<Box>
403-
<Typography variant='h4'>Mint Balance</Typography>
403+
<Typography variant='h4'>Mint Authority Balance</Typography>
404404
<Typography variant='h1'>{mintAccount.balance} WST</Typography>
405405
</Box>
406406
<Typography variant='h5'>UserID: {mintAccount.address.slice(0,15)}</Typography>

frontend/src/app/store/store.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ const useStore = create<State & Actions>((set) => ({
3232
balance: 0,
3333
},
3434
accounts: {
35-
userA: {
35+
alice: {
3636
address: '',
3737
mnemonic: 'during dolphin crop lend pizza guilt hen earn easy direct inhale deputy detect season army inject exhaust apple hard front bubble emotion short portion',
3838
balance: 0,
3939
status: 'Active',
4040
},
41-
userB: {
41+
bob: {
4242
address: '',
4343
mnemonic: 'silver legal flame powder fence kiss stable margin refuse hold unknown valid wolf kangaroo zero able waste jewel find salad sadness exhibit hello tape',
4444
balance: 0,
@@ -82,8 +82,8 @@ const useStore = create<State & Actions>((set) => ({
8282
case 'Mint Authority':
8383
firstAccessibleTab = 'Mint Actions';
8484
break;
85-
case 'User A':
86-
case 'User B':
85+
case 'Alice':
86+
case 'Bob':
8787
firstAccessibleTab = 'Wallet';
8888
break;
8989
case 'Connected Wallet':

frontend/src/app/store/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
export type UserName = 'Mint Authority' | 'User A' | 'User B' | 'Connected Wallet';
1+
export type UserName = 'Mint Authority' | 'Alice' | 'Bob' | 'Connected Wallet';
22
export type MenuTab = 'Mint Actions' | 'Addresses' | 'Wallet';
33
export type AccountInfo = {
44
address: string,
55
mnemonic: string,
66
balance: number,
77
status?: 'Active' | 'Frozen',
88
};
9-
export type AccountKey = 'userA' | 'userB' | 'walletUser';
9+
export type AccountKey = 'alice' | 'bob' | 'walletUser';
1010
export type Accounts = {
11-
userA: AccountInfo;
12-
userB: AccountInfo;
11+
alice: AccountInfo;
12+
bob: AccountInfo;
1313
walletUser: AccountInfo;
1414
};
1515
export type Severity = 'success' | 'error' | 'info' | 'warning';

0 commit comments

Comments
 (0)