Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

My Female Dev Grant voting Application #1086

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added DevGrants/Chinaza Grant/algo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DevGrants/Chinaza Grant/back.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added DevGrants/Chinaza Grant/choice.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
116 changes: 116 additions & 0 deletions DevGrants/Chinaza Grant/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Choice Coin</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div style="height: 120px; background-color: white; width: 100%; display: flex; align-items: center; justify-content: center;">
<img src="choice.png" style="width: 100px; height: 100px;"/>
<h1 style="color: rgb(0, 0, 0); margin-left: -30px;margin-top: 19px;">HOICE COIN</h1>
<h1 style="margin-left: 30px; font-size: 50px; margin-top: 10px;">X</h1>
<img src="algo.png" style="width: 120px; height: 120px;"/>
<h1 style="color: rgb(0, 0, 0); margin-left: -30px; margin-top: 19px;">LGORAND CHAIN</h1>
</div>
<form action="" class="mainDiv">
<button style="padding: 10px; margin-top: 20px;" type="submit" class="connect">Connect Wallet</button>
<input class="box" placeholder="Issue Number">
<p style="color: white; padding: 10px; font-size: 18px;">Choice Coin Voting Mail</p>
<input name="Password" placeholder="Enter Statement" class="pas">
<div style="margin: 10px;">
<input type="button" value="Yes" class="true">
<input type="button" value="NO" class="false">
</div>
<button type="submit" style="padding: 10px; margin-top: 30px;">Submit</button>
</form>
<script>// Retrieve AlgoSigner sdk from the browser
const { AlgoSigner } = window;

//define the adddresses
const red_address = "";
const blue_address = "";

//Get DOM Elements
const submitBtn = document.querySelector(".submit");
const connectWallet = document.querySelector(".connect");
const yes = document.querySelector(".yes-btn");
const no = document.querySelector(".no-btn");

let yesOrNo = "";
const setValue = (value) => {
yesOrNo = value;
};
//Function to Connect User's Account
const ConnectAccount = async () => {
//Check if AlgoSigner is installed
if (!AlgoSigner) {
return alert("Kindly install AlgoSigner");
}

//Connect Account if AlgoSigner is installed
await AlgoSigner.connect()
.then((d) => {})
.catch((e) => console.log("error in connection"));
};

// Sign the Transaction
const signTransaction = async (receiver = blue_address) => {
const txn = await AlgoSigner.algod({
ledger: "TestNet",
path: "/v2/transactions/params",
})
.then((e) => {
return e;
})
.catch((e) => console.log("error in algorand"));

//retrieve account details
const account = await AlgoSigner.accounts({
ledger: "TestNet",
})
.then((value) => value[0])
.then((result) => {
const { address } = result;

return address;
})

.catch((e) => console.log("failed to retrieve accounts"));

//Transaction signature
await AlgoSigner.sign({
from: account,
to: receiver,
amount: document.querySelector("hello"),
note: "voting",
fee: txn["min-fee"],
})
.then(() => console.log("complete"))
.catch((e) => console.log("error", e));
};

connectWallet.addEventListener("click", async (e) => {
await ConnectAccount();
connectWallet.value = "Connected";
});

submitBtn.addEventListener("click", (e) => {
console.log("welcome user");

//checks to see if the user click an option
if (!yesOrNo) {
alert("Please click either yes or no");
return;
}
if (yesOrNo == "Yes") {
signTransaction(blue_address);
}
if (yesOrNo == "No") {
signTransaction(red_address);
}
alert(`Transaction successful in successful in ${yesOrNo}`);
});</script>
</body>
</html>
70 changes: 70 additions & 0 deletions DevGrants/Chinaza Grant/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
body{
background-color: black;
display: flex;
flex-wrap: wrap;
}

*{
padding: 0;
margin: 0;
}
/* Connect Form */

.mainDiv{
border: 5px solid white;
margin: auto;
display: flex;
flex-direction: column;
height: 440px;
width: 400px;
align-items: center;
margin-top: 70px;
background-color: rgba(255, 255, 255, 0.5);
box-shadow: -5px -5px rgba(0, 0, 0, 0.5);
border-radius: 25px;
}
.box{
width: 350px;
padding: 10px;
height: 50px;
color: white;
margin-top: 6px;
background: transparent;
border-bottom: 1px solid;
border-top: none;
border-right: none;
border-left: none;
}
.box::placeholder {
font-size: 1em;
color: rgb(255, 255, 255);
padding: 5px;
}
.pas{
width: 350px;
padding: 10px;
height: 70px;
margin-top: 6px;
border-radius: 5px;
border-bottom: 1px solid;
border-top: none;
border-right: none;
border-left: none;
}
button{
background: black
;
border-radius: 5px;
color: white;
}
@media only screen and (max-width: 700px) {
body{background-color: black;
}
.mainDiv{
margin: auto;
display: flex;
flex-direction: column;
margin-top: 60px;
}

}