-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConnected.jsx
More file actions
43 lines (38 loc) · 1.49 KB
/
Copy pathConnected.jsx
File metadata and controls
43 lines (38 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import React from "react";
const Connected = (props) => {
return (
<div className="connected-container">
<h1 className="connected-header">You are Connected to Metamask</h1>
<p className="connected-account">Metamask Account: {props.account}</p>
<p className="connected-account">Remaining Time: {props.remainingTime}</p>
{ props.showButton ? (
<p className="connected-account">You have already voted</p>
) : (
<div>
<input type="number" placeholder="Entern Candidate Index" value={props.number} onChange={props.handleNumberChange}></input>
<br />
<button className="login-button" onClick={props.voteFunction}>Vote</button>
</div>
)}
<table id="myTable" className="candidates-table">
<thead>
<tr>
<th>Index</th>
<th>Candidate name</th>
<th>Candidate votes</th>
</tr>
</thead>
<tbody>
{props.candidates.map((candidate, index) => (
<tr key={index}>
<td>{candidate.index}</td>
<td>{candidate.name}</td>
<td>{candidate.voteCount}</td>
</tr>
))}
</tbody>
</table>
</div>
)
}
export default Connected;