Skip to content

Commit 2ef7f5b

Browse files
committed
chore: frontend linter errors
1 parent afb3f87 commit 2ef7f5b

File tree

4 files changed

+44
-45
lines changed

4 files changed

+44
-45
lines changed

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

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ import type { SelectChangeEvent } from '@mui/material/Select';
1212
//Local components
1313
import useStore from '../store/store';
1414
import { Accounts } from '../store/types';
15-
import { getWalletBalance, signAndSentTx, getProgrammableTokenAddress, areStakeScriptsRegistered, getFreezePolicyId, fetchPolicyHolders, deriveProgrammableAddress, getUserTotalProgrammableValue, PolicyTokenBalance, getPolicyIssuer } from '../utils/walletUtils';
15+
import { getWalletBalance, signAndSentTx, getProgrammableTokenAddress, areStakeScriptsRegistered, getFreezePolicyId, fetchPolicyHolders, getUserTotalProgrammableValue, PolicyTokenBalance, getPolicyIssuer } from '../utils/walletUtils';
1616
import WalletCard from '../components/Card';
1717
import WSTTextField from '../components/WSTTextField';
1818
import CopyTextField from '../components/CopyTextField';
1919
import WSTTable, { WSTTableRow } from '../components/WSTTable';
2020
import DemoEnvironmentContext from '../context/demoEnvironmentContext';
2121

2222
export default function Profile() {
23-
const { lucid, currentUser, mintAccount, changeAlertInfo, changeWalletAccountDetails, selectedTab } = useStore();
23+
const { lucid, currentUser, changeAlertInfo, changeWalletAccountDetails, selectedTab } = useStore();
2424
const accounts = useStore((state) => state.accounts);
2525
const [overrideTx, setOverrideTx] = useState<boolean>(false);
2626
const [isRegistering, setIsRegistering] = useState<boolean>(false);
@@ -74,7 +74,7 @@ export default function Profile() {
7474
return () => {
7575
cancelled = true;
7676
};
77-
}, [accounts.walletUser.hasRegisteredScripts, accounts.walletUser.regular_address, changeWalletAccountDetails, demoEnv, lucid]);
77+
}, [accounts.walletUser, accounts.walletUser.hasRegisteredScripts, accounts.walletUser.regular_address, changeWalletAccountDetails, demoEnv, lucid]);
7878

7979
const getUserAccountDetails = () => {
8080
switch (currentUser) {
@@ -212,7 +212,6 @@ export default function Profile() {
212212
const holders = await fetchPolicyHolders(demoEnv, selectedPolicy);
213213
const rows = await Promise.all(
214214
holders.map(async (holder) => {
215-
let programmableAddress = '';
216215
return {
217216
regularAddress: '',
218217
programmableAddress: holder.address,

frontend/src/app/clientLayout.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async function loadDemoEnvironment(): Promise<DemoEnvironment> {
2828
}
2929

3030
export default function ClientLayout({ children }: { children: React.ReactNode }) {
31-
const { mintAccount, accounts, changeMintAccountDetails, changeWalletAccountDetails, setLucidInstance } = useStore();
31+
const { accounts, changeMintAccountDetails, changeWalletAccountDetails, setLucidInstance } = useStore();
3232
const [demoEnv, setDemoEnv] = useState<DemoEnvironment>(previewEnv);
3333

3434
useEffect(() => {
@@ -45,11 +45,12 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
4545
const walletATokenAddr = await getProgrammableTokenAddress(walletA.address);
4646
const walletBTokenAddr = await getProgrammableTokenAddress(walletB.address);
4747
const mintAuthorityTokenAddr = await getProgrammableTokenAddress(mintAuthorityWallet.address);
48-
48+
const { mintAccount: currentMintAccount, accounts: currentAccounts } = useStore.getState();
49+
4950
// Update Zustand store with the initialized wallet information
50-
changeMintAccountDetails({ ...mintAccount, regular_address: mintAuthorityWallet.address, programmable_token_address: mintAuthorityTokenAddr});
51-
changeWalletAccountDetails('alice', { ...accounts.alice, regular_address: walletA.address, programmable_token_address: walletATokenAddr},);
52-
changeWalletAccountDetails('bob', { ...accounts.bob, regular_address: walletB.address, programmable_token_address: walletBTokenAddr});
51+
changeMintAccountDetails({ ...currentMintAccount, regular_address: mintAuthorityWallet.address, programmable_token_address: mintAuthorityTokenAddr});
52+
changeWalletAccountDetails('alice', { ...currentAccounts.alice, regular_address: walletA.address, programmable_token_address: walletATokenAddr},);
53+
changeWalletAccountDetails('bob', { ...currentAccounts.bob, regular_address: walletB.address, programmable_token_address: walletBTokenAddr});
5354

5455
const initialLucid = await makeLucid(demoEnv);
5556
setLucidInstance(initialLucid);
@@ -60,7 +61,7 @@ export default function ClientLayout({ children }: { children: React.ReactNode }
6061
};
6162

6263
fetchUserWallets();
63-
},[]);
64+
},[changeMintAccountDetails, changeWalletAccountDetails, setLucidInstance]);
6465

6566
if(accounts.bob.regular_address === '') {
6667
return <div className="mainLoadingContainer">

frontend/src/app/components/ProfileSwitcher.tsx

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
2-
'use client'
3-
//React Imports
4-
import * as React from 'react';
5-
6-
//Next.js Imports
7-
import { useRouter } from 'next/navigation';
8-
9-
//MUI Imports
1+
2+
'use client'
3+
//React Imports
4+
import * as React from 'react';
5+
6+
//Next.js Imports
7+
import { useRouter } from 'next/navigation';
8+
9+
//MUI Imports
1010
import Button from '@mui/material/Button';
1111
import Menu from '@mui/material/Menu';
1212
import MenuItem from '@mui/material/MenuItem';
1313
import KeyboardArrowDownIcon from '@mui/icons-material/KeyboardArrowDown';
1414

1515
//Local Imports
1616
import useStore from '../store/store';
17-
import { UserName } from '../store/types';
1817
import { selectLucidWallet, getWalletBalance, getProgrammableTokenAddress, areStakeScriptsRegistered, WalletType } from '../utils/walletUtils';
1918
import DemoEnvironmentContext from '../context/demoEnvironmentContext';
2019

@@ -35,16 +34,16 @@ export default function ProfileSwitcher() {
3534
currentUser === 'Mint Authority'
3635
? '/mint-authority'
3736
: `/${currentUser.toLowerCase().replace(/\s+/g, '-')}`;
38-
const currentPath = window.location.pathname;
39-
40-
if (currentPath !== expectedPath) {
41-
router.push(expectedPath);
42-
}
43-
}, [currentUser, router]);
44-
45-
const handleClick = (event: React.MouseEvent<HTMLDivElement>) => {
46-
setAnchorEl(event.currentTarget as HTMLElement);
47-
};
37+
const currentPath = window.location.pathname;
38+
39+
if (currentPath !== expectedPath) {
40+
router.push(expectedPath);
41+
}
42+
}, [currentUser, router]);
43+
44+
const handleClick = (event: React.MouseEvent<HTMLButtonElement>) => {
45+
setAnchorEl(event.currentTarget as HTMLElement);
46+
};
4847

4948
const handleClose = () => {
5049
setAnchorEl(null);

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
'use client';
2-
//React imports
3-
import React, { useContext, useEffect, useState } from 'react';
1+
'use client';
2+
//React imports
3+
import React, { useCallback, useContext, useEffect, useState } from 'react';
44

55
//Axios imports
66
import axios from 'axios';
@@ -46,24 +46,24 @@ export default function Home() {
4646
changeUserAccount('Mint Authority');
4747
}, [changeUserAccount]);
4848

49+
const fetchUserDetails = useCallback(async () => {
50+
const mintBalance = await getWalletBalance(demoEnv, mintAccount.regular_address);
51+
const userABalance = await getWalletBalance(demoEnv, accounts.alice.regular_address);
52+
const userBBalance = await getWalletBalance(demoEnv, accounts.bob.regular_address);
53+
54+
// Update Zustand store with the initialized wallet information
55+
await changeMintAccountDetails({ ...mintAccount, balance: mintBalance});
56+
await changeWalletAccountDetails('alice', { ...accounts.alice, balance: userABalance});
57+
await changeWalletAccountDetails('bob', { ...accounts.bob, balance: userBBalance});
58+
}, [accounts.alice, accounts.bob, changeMintAccountDetails, changeWalletAccountDetails, demoEnv, mintAccount]);
59+
4960
useEffect(() => {
5061
const initialize = async () => {
5162
await fetchUserDetails();
5263
await fetchBlacklistStatus();
5364
};
5465
initialize();
55-
}, [demoEnv]);
56-
57-
const fetchUserDetails = async () => {
58-
const mintBalance = await getWalletBalance(demoEnv, mintAccount.regular_address);
59-
const userABalance = await getWalletBalance(demoEnv, accounts.alice.regular_address);
60-
const userBBalance = await getWalletBalance(demoEnv, accounts.bob.regular_address);
61-
62-
// Update Zustand store with the initialized wallet information
63-
await changeMintAccountDetails({ ...mintAccount, balance: mintBalance});
64-
await changeWalletAccountDetails('alice', { ...accounts.alice, balance: userABalance});
65-
await changeWalletAccountDetails('bob', { ...accounts.bob, balance: userBBalance});
66-
};
66+
}, [demoEnv, fetchUserDetails]);
6767

6868
const fetchBlacklistStatus = async () => {
6969
const { accounts, changeWalletAccountDetails, currentUser, mintAccount } = useStore.getState();

0 commit comments

Comments
 (0)