Skip to content

Commit 6df54de

Browse files
committed
Add study notes for 2025-08-16
1 parent 77bdd9a commit 6df54de

1 file changed

Lines changed: 128 additions & 0 deletions

File tree

zhenghaoailimiao.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,134 @@ timezone: UTC+8
1515
## Notes
1616

1717
<!-- Content_START -->
18+
# 2025-08-16
19+
20+
今日编写了前端重要代码:
21+
Welcome.tsx
22+
~~~ tsx
23+
import { useContext } from "react";
24+
import { AiFillPlayCircle } from "react-icons/ai";
25+
import { SiEthereum } from "react-icons/si";
26+
import { BsInfoCircle } from "react-icons/bs";
27+
28+
import { TransactionContext } from "../context/TransactionContext";
29+
import { Loader } from ".";
30+
31+
const commomStyles = "min-h-[70px] sm:px-0 px-2 sm:min-w-[120px] flex justify-center items-center border-[0.5px] border-gray-400 text-sm font-light text-white";
32+
33+
const Input = ({ placeholder, name, type, value, handleChange }: any) => (
34+
<input
35+
placeholder={placeholder}
36+
type={type}
37+
step="0.0001"
38+
value={value}
39+
onChange={(e) => handleChange(e, name)}
40+
className="my-2 w-full rounded-sm p-2 outline-none bg-transparent border-none text-white text-sm white-glassmorphism"
41+
/>
42+
);
43+
const Welcome = () => {
44+
const { connectWallet, currentAccount, formData, sendTransaction, handleChange } = useContext(TransactionContext);
45+
46+
const handleSubmit = (e: { preventDefault: () => void; }) => {
47+
const { addressTo, amount, keyword, message } = formData;
48+
49+
e.preventDefault();
50+
51+
if (!addressTo || !amount || !keyword || !message) return;
52+
53+
sendTransaction(currentAccount, addressTo, amount, message, keyword);
54+
};
55+
56+
return (
57+
<div className="flex w-full justify-center items-center ">
58+
<div className="flex md:flex-row flex-col items-start justify-betwwen md:p-10 py-2 px-4">
59+
<div className="flex flex-1 justify-start flex-col md:mr-10">
60+
<h1 className="text-3xl sm:text-5xl text-white text-gradient py-1">
61+
Send Crypto <br /> across the world
62+
</h1>
63+
<p className="text-left mt-5 text-white font-light md:w-9/12 w-11/12 text-base">
64+
Explore the crypto world. Buy and sell cryptocurrencies easily on Krypto.
65+
</p>
66+
{!currentAccount && (<button
67+
type="button"
68+
onClick={connectWallet}
69+
className="flex flex-row justify-center items-center my-5 bg-[#2952e3] p-3 rounded-full cursor-ponter
70+
hover:bg-[#2546bd]"
71+
>
72+
<p className="text-white text-base font-semibold">Connect Wallet</p>
73+
</button>)}
74+
<div className="grid sm:grid-cols-3 grid-cols-2 w-full mt-10">
75+
<div className={`rounded-tl-2xl ${commomStyles}`}>
76+
Reliability
77+
</div>
78+
<div className={commomStyles}>
79+
Security
80+
</div>
81+
<div className={`rounded-tr-2xl ${commomStyles}`}>
82+
Ethereum
83+
</div>
84+
<div className={`rounded-bl-2xl ${commomStyles}`}>
85+
Web 3.0
86+
</div>
87+
<div className={commomStyles}>
88+
Low fees
89+
</div>
90+
<div className={`rounded-br-2xl ${commomStyles}`}>
91+
Blockchain
92+
</div>
93+
</div>
94+
</div>
95+
96+
<div className="flex flex-col flex-1 items-center justify-start w-full md:mt-0 mt-10">
97+
<div className="p-3 justify-end items-start flex-col rounded-xl h-40 sm:w-72 w-full my-5
98+
eth-card white-glassmorphism">
99+
<div className="flex justify-between flex-col w-full h-full">
100+
<div className="flex justify-between items-start">
101+
<div className="w-10 h-10 rounded-full border-2 border-white flex justify-center items-center">
102+
<SiEthereum fontSize={21} color="#fff" />
103+
</div>
104+
<BsInfoCircle fontSize={17} color="#fff" />
105+
</div>
106+
<div>
107+
<p className="text-white font-light text-sm">
108+
Adress
109+
</p>
110+
<p className="text-white font-semibold text-lg mt-1">
111+
Ethereum
112+
</p>
113+
</div>
114+
</div>
115+
</div>
116+
117+
<div className="p-5 sm:w-96 w-full flex flex-col justify-start items-center blue-glassmorphism">
118+
<Input placeholder="Adress To" name="addressTo" type="text" handleChange={handleChange} />
119+
<Input placeholder="Amount(ETH)" name="amount" type="number" handleChange={handleChange} />
120+
<Input placeholder="Keyword(Gif)" name="keyword" type="text" handleChange={handleChange} />
121+
<Input placeholder="Enter Message" name="message" type="text" handleChange={handleChange} />
122+
123+
<div className="h-[1px] w-full bg-gray-400 my-2" />
124+
125+
{false ? (
126+
<Loader />
127+
) : (
128+
<button
129+
type="button"
130+
onClick={handleSubmit}
131+
className="text-white w-full mt-2 border-[1px] p-2 border-[#3d4f7c] rounded-full cursor-pointer"
132+
>
133+
Send Now
134+
</button>
135+
)}
136+
</div>
137+
</div>
138+
</div>
139+
</div>
140+
)
141+
};
142+
143+
export default Welcome;
144+
~~~
145+
18146
# 2025-08-15
19147

20148
**今天继续编写智能合约及其交互代码:**

0 commit comments

Comments
 (0)