-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
156 lines (135 loc) · 4.88 KB
/
index.html
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!doctype html>
<head>
<title>Governance Demo</title>
<style>
.hidden {
display: none
}
.wait {
cursor: wait
}
fieldset label {
display: block
}
#positions {
list-style: none;
}
nav ul {
list-style: none;
padding: 0;
margin: 0;
}
nav li {
display: inline;
border: solid;
border-width: 1px 1px 0 1px;
margin: 0 5px 0 0;
}
nav li label {
padding: 0 10px;
}
nav label>input[type='radio']:checked {
padding-bottom: 2px;
background: yellow;
}
</style>
</head>
<body>
<h1>Governance Demo</h1>
<address>
<a href="https://github.com/agoric-labs/gov-demo1">view source</a>
</address>
<p id='needDappApproval' class='hidden'>Please approve this dapp.</p>
<nav>
<ul>
<li><label><input type='radio' checked name='section' value='member' />Committe Member</label></li>
<li><label><input type='radio' name='section' value='creator' />Committee Creator</label></li>
<li><label><input type='radio' name='section' value='registrar' />Committe Registrar</label></li>
</ul>
</nav>
<section id='member'>
<form>
<fieldset>
<label>Voter Invitation boardID: <input name='voterInvitation' /></label>
<button type='button' id='claim'>Claim</button>
<p><em>TODO: trigger on invitation from wallet...</em></p>
<hr />
<legend>Questions</legend>
<select name=question>
<option value="1">(questions: claim invitation to subscribe)</option>
</select>
<p>Positions:</p>
<ul id='positions'>
<li><label><input type="radio" name="position" value="yes">yes</label></li>
<li><label><input type="radio" name="position" value="no">no</label></li>
<li><label><input type="radio" name="position" value="abstain">abstain</label></li>
</ul>
<label>Deadline: <input readonly name='deadline' /></label>
<button type='button' id='vote' disabled>Vote</button>
<hr />
<h3>Outcomes</h3>
<ul id='outcomes'>
<li><em>(claim invitation to subscribe)</em></li>
</ul>
</fieldset>
</form>
</section>
<section id='creator' class='hidden'>
<form>
<fieldset>
<legend>Committee Registrar</legend>
<label>Registrar Installation boardID: <input name='registrarInstallation' value='495234043' /></label>
<label>Committe name: <input name='committeeName' value="The Three Stooges" /></label>
<label>Committe size: <input name='committeeSize' type='number' value="3" /></label>
<button type="button" id='createRegistrar'>Create Registrar</button>
<hr />
<h4>Invitations</h4>
<textarea name='invitations' rows='5' , cols='10' readonly></textarea>
<label>Registrar Public Facet boardID: <input name='registrarPublicFacet' /></label>
</fieldset>
</form>
</section>
<section id='registrar' class='hidden'>
<form>
<fieldset>
<legend>Add Question</legend>
<p><em>Enter the question on the first line and each option on a separate line following.</em></p>
<textarea name='issue' rows='6' cols='80'>When shall we meet?
Tue, 9am
Wed, 10am</textarea>
<br />
<label>Registrar Creator Facet boardID: <input name='registrarCreatorFacet' /></label>
<label>Counter Installation boardID: <input name='counterInstallation' value='1178513834' /></label>
<label>chainTimerService boardID: <input name='chainTimerService' value='254080728' /></label>
<label>Seconds till close of votes: <input name='secondsTillClose' value='120' /></label>
<label>Quorum Rule <select name="quorumRule">
<option value="majority">majority</option>
</select></label>
<label>Election Type <select name="electionType">
<option value="survey">survey</option>
</select></label>
<label>Choice Method <select name="method">
<option value="unranked">unranked</option>
</select></label>
<button type="button" id='addQuestion'>Add Question</button>
<hr />
</fieldset>
</form>
</section>
<agoric-wallet-connection></agoric-wallet-connection>
<button>Connect to Wallet</button>
<script type="module">
import './src/install-ses-lockdown.js';
import { E } from '@agoric/eventual-send';
import '@agoric/wallet-connection/agoric-wallet-connection.js';
import { makeUI, setupTabs, onWalletState } from './src/ui.js';
import { main } from './src/main.js';
const ui = makeUI(document);
setupTabs(ui);
// Set up event handlers.
const awc = document.querySelector('agoric-wallet-connection');
awc.addEventListener('state', onWalletState);
const walletBridge = E(awc.walletConnection).getScopedBridge('Gov Demo');
main(ui, walletBridge);
</script>
</body>