Skip to content

Commit 6357693

Browse files
committed
new deploy
1 parent a69e1dc commit 6357693

10 files changed

+364
-364
lines changed

Project crypto/crypto.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!-- <!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
@@ -166,4 +166,4 @@ <h2>Balance</h2>
166166
})
167167
168168
</script>
169-
</html>
169+
</html> -->

Project crypto/login1.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!-- <!DOCTYPE html>
22
<html lang="en">
33
<head>
44
<meta charset="UTF-8">
@@ -40,7 +40,7 @@ <h2>Sign Up</h2>
4040
<label for="password" style="align-self: first baseline;">Password:</label>
4141
<input type="password" name="password" id="signupPassword" placeholder="Enter password" >
4242
<br>
43-
<!-- <input type="submit" name="signUp" id='sighUp' class="signUp" value="Sign Up"> -->
43+
4444
<button id="sighUp" class="signUp" >Sign Up</button>
4545
</form>
4646
</div>
@@ -99,4 +99,4 @@ <h2>Sign Up</h2>
9999
100100
});
101101
</script>
102-
</html>
102+
</html> -->

Project crypto/app.js app.js

+73-73
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,73 @@
1-
2-
window.onload = function (){
3-
const username = localStorage.getItem('username')
4-
const storedBalance = localStorage.getItem(`${username}_balanceValue`);
5-
if( storedBalance !==null) {
6-
document.getElementById('balance').innerText = parseFloat(storedBalance);
7-
}
8-
const storedTrans =JSON.parse(localStorage.getItem(`${username}_transactions`)) || [] ;
9-
const storedList = document.getElementById('transactionList')
10-
if(storedList !== null && storedTrans !== null && storedTrans !== undefined && storedList !== undefined){
11-
storedTrans.forEach( trans =>{
12-
const listItem =document.createElement('li');
13-
listItem.textContent= trans;
14-
storedList.appendChild(listItem);
15-
})
16-
17-
}
18-
19-
}
20-
function openLoginPopup() {
21-
document.getElementById('loginPopup').style.display = 'block';
22-
}
23-
24-
function openSignupPopup() {
25-
document.getElementById('signupPopup').style.display = 'block';
26-
}
27-
function closePopup(id){
28-
document.getElementById(id).style.display='none';
29-
}
30-
function showTransferForm() {
31-
document.getElementById('transferForm').style.display = 'block';
32-
}
33-
function showBalance(){
34-
document.getElementById('Balance').style.display ='block';
35-
}
36-
function showTransactionHistory() {
37-
document.getElementById('transactionHistory').style.display = 'block';
38-
}
39-
const transfer= document.getElementById('transfer'),
40-
balance = document.getElementById('balance'),
41-
transferAmount=document.getElementById('transferAmount')
42-
43-
transfer.addEventListener('click', () => {
44-
const value = transferAmount.value;
45-
if (Number(value) === 0 || Number(value) < 0) {
46-
alert('Please! Enter valid amonut');
47-
} else if (Number(value) > Number(balance.innerText)) {
48-
alert("You don't have that much balance to withdraw");
49-
} else {
50-
const balanceValue = Number(balance.innerText) - Number(value);
51-
balance.innerText = balanceValue;
52-
transferAmount.value = '';
53-
localStorage.setItem(`${username}_balanceValue`,balanceValue);
54-
alert(`${value}BTC succesfully transferred to the profile B. `);
55-
simulateTransaction(value,'debit');
56-
}
57-
})
58-
function simulateTransaction(amount, type) {
59-
const transactionList = document.getElementById('transactionList');
60-
const listItem = document.createElement('li');
61-
const transText = `${type === 'debit' ? '-' : '+'}${amount} BTC, ${new Date().toLocaleString()}`;
62-
const textNode = document.createTextNode(transText);
63-
64-
listItem.appendChild(textNode);
65-
transactionList.appendChild(listItem);
66-
67-
const storedTrans = JSON.parse(localStorage.getItem(`${username}_transactions`)) || [];
68-
storedTrans.push(transText);
69-
localStorage.setItem(`${username}_transactions`, JSON.stringify(storedTrans));
70-
}
71-
72-
73-
1+
2+
window.onload = function (){
3+
const username = localStorage.getItem('username')
4+
const storedBalance = localStorage.getItem(`${username}_balanceValue`);
5+
if( storedBalance !==null) {
6+
document.getElementById('balance').innerText = parseFloat(storedBalance);
7+
}
8+
const storedTrans =JSON.parse(localStorage.getItem(`${username}_transactions`)) || [] ;
9+
const storedList = document.getElementById('transactionList')
10+
if(storedList !== null && storedTrans !== null && storedTrans !== undefined && storedList !== undefined){
11+
storedTrans.forEach( trans =>{
12+
const listItem =document.createElement('li');
13+
listItem.textContent= trans;
14+
storedList.appendChild(listItem);
15+
})
16+
17+
}
18+
19+
}
20+
function openLoginPopup() {
21+
document.getElementById('loginPopup').style.display = 'block';
22+
}
23+
24+
function openSignupPopup() {
25+
document.getElementById('signupPopup').style.display = 'block';
26+
}
27+
function closePopup(id){
28+
document.getElementById(id).style.display='none';
29+
}
30+
function showTransferForm() {
31+
document.getElementById('transferForm').style.display = 'block';
32+
}
33+
function showBalance(){
34+
document.getElementById('Balance').style.display ='block';
35+
}
36+
function showTransactionHistory() {
37+
document.getElementById('transactionHistory').style.display = 'block';
38+
}
39+
const transfer= document.getElementById('transfer'),
40+
balance = document.getElementById('balance'),
41+
transferAmount=document.getElementById('transferAmount')
42+
43+
transfer.addEventListener('click', () => {
44+
const value = transferAmount.value;
45+
if (Number(value) === 0 || Number(value) < 0) {
46+
alert('Please! Enter valid amonut');
47+
} else if (Number(value) > Number(balance.innerText)) {
48+
alert("You don't have that much balance to withdraw");
49+
} else {
50+
const balanceValue = Number(balance.innerText) - Number(value);
51+
balance.innerText = balanceValue;
52+
transferAmount.value = '';
53+
localStorage.setItem(`${username}_balanceValue`,balanceValue);
54+
alert(`${value}BTC succesfully transferred to the profile B. `);
55+
simulateTransaction(value,'debit');
56+
}
57+
})
58+
function simulateTransaction(amount, type) {
59+
const transactionList = document.getElementById('transactionList');
60+
const listItem = document.createElement('li');
61+
const transText = `${type === 'debit' ? '-' : '+'}${amount} BTC, ${new Date().toLocaleString()}`;
62+
const textNode = document.createTextNode(transText);
63+
64+
listItem.appendChild(textNode);
65+
transactionList.appendChild(listItem);
66+
67+
const storedTrans = JSON.parse(localStorage.getItem(`${username}_transactions`)) || [];
68+
storedTrans.push(transText);
69+
localStorage.setItem(`${username}_transactions`, JSON.stringify(storedTrans));
70+
}
71+
72+
73+
File renamed without changes.
File renamed without changes.

Project crypto/index.html index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>Crypto Currency Wallet</title>
7-
<link rel="stylesheet" href="crypto.css">
7+
<link rel="stylesheet" href="./Project crypto/crypto.css">
88
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0" />
99
<link rel="icon" href="wallet.png">
1010
<link rel="preconnect" href="https://fonts.googleapis.com">
@@ -14,7 +14,7 @@
1414
<body>
1515
<div id="nav" class="sticky">
1616
<div id="navItems"><a href="#" style="text-decoration: none;"><h4 class="navEle">home</h4></a></div>
17-
<div id="navItems"><a href="about.html" style="text-decoration: none;"><h4 class="navEle"> about</h4></a></div>
17+
<div id="navItems"><a href="./Project crypto/about.html" style="text-decoration: none;"><h4 class="navEle"> about</h4></a></div>
1818
<div id="navItems"><a href="https://www.coinbase.com/en-gb/learn/crypto-basics/what-is-cryptocurrency" style="text-decoration: none;"><h4 class="navEle"> Learn More</h4></a></div>
1919
<div id="navItems"><a href="" style="text-decoration: none;" id="signout"><h4 class="navEle">logout</h4></a></div>
2020
</div>

0 commit comments

Comments
 (0)