Simulate inviting trustees

This commit is contained in:
Henry Wong
2020-08-10 15:24:22 -07:00
committed by David Ernst
parent 3abf236cd8
commit d55ab7d550
3 changed files with 74 additions and 53 deletions

View File

@@ -14,6 +14,7 @@ TODO:
- [x] Admin GUI to add voters by email address
- [x] Admin GUI to add Trustees by email address
- [ ] Trustee page to take part in Distribute Key Gen
- [x] Simulated
- [ ] Backend assigns vote tokens and emails invitation to voters
- [ ] Voter interface to cast vote
- [ ] Encrypt voters vote

View File

@@ -1,10 +1,26 @@
export const AddPeople = ({ disabled, type }: { disabled?: boolean; type: string }) => (
import { Dispatch, SetStateAction } from 'react'
export const AddPeople = ({
disabled,
setPubKey,
type,
}: {
disabled?: boolean
setPubKey?: Dispatch<SetStateAction<boolean>>
type: string
}) => (
<>
<p>Add {type} by email address, 1 per line:</p>
<textarea />
<textarea disabled={disabled && type !== 'voters'} />
<div>
<input disabled={disabled} type="submit" value="Send Invitation" />
{disabled && <p>Waiting on Trustees to generate public key first</p>}
<input disabled={disabled} onClick={() => setPubKey && setPubKey(true)} type="submit" value="Send Invitation" />
{disabled && (
<p>
{type === 'voters'
? `Waiting on Trustees to generate public key first`
: `Trustees generated public key 23509282789382352`}
</p>
)}
</div>
<style jsx>{`
textarea {

View File

@@ -1,61 +1,65 @@
import Head from 'next/head'
import { useState } from 'react'
import { AddPeople } from './AddPeople'
export const AdminPage = (): JSX.Element => (
<>
<Head>
<title>SIV:Admin</title>
<link href="/favicon.png" rel="icon" />
<meta content="minimum-scale=1, initial-scale=1, width=device-width" name="viewport" />
<meta content="/preview.png" property="og:image" />
</Head>
export const AdminPage = (): JSX.Element => {
const [pubKey, setPubKey] = useState(false)
return (
<>
<Head>
<title>SIV:Admin</title>
<link href="/favicon.png" rel="icon" />
<meta content="minimum-scale=1, initial-scale=1, width=device-width" name="viewport" />
<meta content="/preview.png" property="og:image" />
</Head>
<main>
<h1>SIV Admin</h1>
<AddPeople type="trustees" />
<AddPeople disabled type="voters" />
</main>
<main>
<h1>SIV Admin</h1>
<AddPeople disabled={pubKey} setPubKey={setPubKey} type="trustees" />
<AddPeople disabled={!pubKey} type="voters" />
</main>
<style jsx>{`
main {
max-width: 750px;
width: 100%;
margin: 2rem auto;
padding: 1rem;
}
<style jsx>{`
main {
max-width: 750px;
width: 100%;
margin: 2rem auto;
padding: 1rem;
}
div {
margin-bottom: 3rem;
}
div {
margin-bottom: 3rem;
}
p {
white-space: pre-wrap;
}
`}</style>
p {
white-space: pre-wrap;
}
`}</style>
<style global jsx>{`
body {
color: #222;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;
font-size: 0.875rem;
letter-spacing: 0.01071em;
line-height: 1.43;
<style global jsx>{`
body {
color: #222;
font-family: -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans,
Droid Sans, Helvetica Neue, sans-serif;
font-size: 0.875rem;
letter-spacing: 0.01071em;
line-height: 1.43;
max-width: 100%;
}
max-width: 100%;
}
a {
color: #0070f3;
text-decoration: none;
}
a {
color: #0070f3;
text-decoration: none;
}
a:hover,
a:focus,
a:active {
text-decoration: underline;
}
`}</style>
</>
)
a:hover,
a:focus,
a:active {
text-decoration: underline;
}
`}</style>
</>
)
}