Skip to content
This repository was archived by the owner on Mar 21, 2026. It is now read-only.

Commit bd30477

Browse files
committed
new wallet manager
1 parent 1aa5d58 commit bd30477

7 files changed

Lines changed: 25 additions & 28 deletions

File tree

src/components/walletManager/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ const Index = () => {
9595
</div>
9696
</div>
9797
) : (
98-
<div className="flex gap-3 items-center">
98+
<div className="flex gap-3 items-center" onClick={() => setShowWallets(true)}>
9999
<p
100100
className={`items-center text-center bg-oppurple text-[14px] uppercase w-full justify-center text-opwhite font-normal tracking-[1.25px] ${archivo.className}`}
101101
>
102102
connect
103103
</p>
104104
<div className="p-2 cursor-pointer">
105-
<FaAngleDown onClick={() => setShowWallets(true)} />
105+
<FaAngleDown />
106106
</div>
107107
</div>
108108
)}

src/pages/claim/[claim].tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,12 @@ export default function Claim() {
6767
isBeneficiary && findContractCanClaimInLocalStorage(contractAddress, account?.address);
6868
}, [isBeneficiary]);
6969

70+
useEffect(() => {
71+
account === undefined && router.push('/');
72+
}, [account]);
73+
7074
return (
71-
<main className={`flex flex-col md:flex-row ${archivo.className}`}>
75+
<main className={account ? `flex flex-col md:flex-row ${archivo.className}` : `flex flex-col ${archivo.className}`}>
7276
<Nav />
7377
<div className="w-10/12 md:w-8/12 overflow-x-auto min-h-screen mx-auto flex flex-col gap-[40px] py-[10vh] md:py-0 md:pb-[20vh]">
7478
<div className="hidden md:flex h-[100px] justify-end">

src/pages/claim/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default function Claim() {
2323
useFindContractToClaim();
2424

2525
return (
26-
<main className={`flex flex-col md:flex-row ${archivo.className}`}>
26+
<main className={account ? `flex flex-col md:flex-row ${archivo.className}` : `flex flex-col ${archivo.className}`}>
2727
<Nav />
2828
<Toaster
2929
position="top-right"

src/pages/contracts/[contract].tsx

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -61,21 +61,18 @@ export default function Contract() {
6161
const textToCopy = contractAddress;
6262
textToCopy !== undefined && navigator.clipboard.writeText(textToCopy.toString());
6363
setCopied(true);
64+
toast('👍 Address copied');
6465
setTimeout(function () {
6566
setCopied(false);
6667
}, 5000);
6768
};
6869

69-
const [toAdd, settoAdd] = useState<any | undefined>(undefined);
70-
const transfer = useTransfer();
71-
7270
useEffect(() => {
73-
console.log('toAdd', toAdd);
74-
console.log('contractAddress', contractAddress);
75-
}, [toAdd]);
71+
account === undefined && router.push('/');
72+
}, [account]);
7673

7774
return (
78-
<main className={`flex flex-col md:flex-row ${archivo.className}`}>
75+
<main className={account ? `flex flex-col md:flex-row ${archivo.className}` : `flex flex-col ${archivo.className}`}>
7976
<Nav />
8077
<Toaster
8178
position="top-right"
@@ -120,16 +117,6 @@ export default function Contract() {
120117
)}
121118
</div>
122119
<div className="flex gap-[20px] ml-auto md:ml-0">
123-
<div>
124-
{/* TODO: Add funds */}
125-
<Button
126-
type="active"
127-
text="add funds"
128-
action={() => transfer?.signAndSend(contractAddress!, toAdd)}
129-
/>
130-
<input type="number" onChange={(e) => settoAdd(e.target.value)} />
131-
<p>Hash {transfer?.hash || '--'}</p>
132-
</div>
133120
<Link href={`/edit/${contractAddress}`}>
134121
<Button type="active" text="edit" />
135122
</Link>

src/pages/contracts/index.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ export default function Contracts() {
3131
const { ownerContracts, getStoredContracts } = context;
3232

3333
useEffect(() => {
34-
console.log(account);
3534
account === undefined && router.push('/');
36-
// router.push('/dashboard')
3735
}, [account]);
3836

3937
useEffect(() => {

src/pages/create/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import StepTwo from '../../components/create/steps/stepTwo';
1313
import StepThree from '../../components/create/steps/stepThree';
1414
import StepFour from '../../components/create/steps/stepFour';
1515
import StepFive from '../../components/create/steps/stepFive';
16-
import Result from '../../components/create/results';
1716
import Text from '@/components/generals/text';
1817

1918
import { useWallet } from 'useink';
@@ -27,6 +26,8 @@ import { Toaster } from 'react-hot-toast';
2726
//---------------------------------Interfaces---------------------------------
2827

2928
const Index = () => {
29+
const router = useRouter();
30+
const { account } = useWallet();
3031
const createContext = useContext(CreateContext);
3132

3233
if (!createContext) {
@@ -45,8 +46,12 @@ const Index = () => {
4546
}
4647
};
4748

49+
useEffect(() => {
50+
account === undefined && router.push('/');
51+
}, [account]);
52+
4853
return (
49-
<main className={`flex flex-col md:flex-row ${archivo.className}`}>
54+
<main className={account ? `flex flex-col md:flex-row ${archivo.className}` : `flex flex-col ${archivo.className}`}>
5055
<Nav />
5156
<Toaster
5257
position="top-right"

src/pages/edit/[edit].tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Text from '../../components/generals/text';
44
import Button from '../../components/generals/button';
55
import { Archivo } from 'next/font/google';
66
import { useRouter } from 'next/router';
7-
import { useContract } from 'useink';
7+
import { useContract, useWallet } from 'useink';
88
import WalletManager from '@/components/walletManager';
99
const archivo = Archivo({ subsets: ['latin'] });
1010
import metadata from '../../contract/open_payroll.json';
@@ -16,6 +16,7 @@ import toast, { Toaster } from 'react-hot-toast';
1616
import Loader from '@/components/generals/Loader';
1717

1818
export default function Edit() {
19+
const { account } = useWallet();
1920
//---------------------------------Get contract address---------------------------------
2021
const router = useRouter();
2122
const {
@@ -28,7 +29,9 @@ export default function Edit() {
2829
//---------------------------------Get contract---------------------------------
2930
const _contract = useContract(contractAddress, metadata);
3031

31-
// Tabs
32+
useEffect(() => {
33+
account === undefined && router.push('/');
34+
}, [account]);
3235

3336
useEffect(() => {
3437
if (edit?.toString()) {
@@ -43,7 +46,7 @@ export default function Edit() {
4346
}, [_contract]);
4447

4548
return (
46-
<main className={`flex flex-col md:flex-row ${archivo.className}`}>
49+
<main className={account ? `flex flex-col md:flex-row ${archivo.className}` : `flex flex-col ${archivo.className}`}>
4750
<Nav />
4851
<Toaster
4952
position="top-right"

0 commit comments

Comments
 (0)