-
- {@render children?.()}
-
+
+ {@render children?.()}
{/if}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 6468ff7..2c43d90 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -3,15 +3,17 @@
import { Heading, P, Hr } from 'flowbite-svelte';
-
Vote The Bowl
+
+
Vote The Bowl
-
- Make your cook off voting easy! Create an event and invite others to vote. You don't need an
- account just start by creating an event below and sharing the registration link or QR-code. You
- can choose the voting system that best suits your needs (more on the way).
-
+
+ Make your cook off voting easy! Create an event and invite others to vote. You don't need an
+ account just start by creating an event below and sharing the registration link or QR-code. You
+ can choose the voting system that best suits your needs (more on the way).
+
-
+
-
Create an Event
-
+
Create an Event
+
+
diff --git a/src/routes/event/[id=eventID]/+page.svelte b/src/routes/event/[id=eventID]/+page.svelte
new file mode 100644
index 0000000..a9c433a
--- /dev/null
+++ b/src/routes/event/[id=eventID]/+page.svelte
@@ -0,0 +1,50 @@
+
+
+
+ {#if event?.status == 'RE'}
+
+ {:else if event?.status == 'VO'}
+
+ {:else if event?.status == 'CL'}
+
+ {:else}
+ Loading...
+ {/if}
+
diff --git a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+layout.svelte b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+layout.svelte
deleted file mode 100644
index 8adfa00..0000000
--- a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+layout.svelte
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-{@render children()}
diff --git a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+page.svelte b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+page.svelte
new file mode 100644
index 0000000..2b0c036
--- /dev/null
+++ b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/+page.svelte
@@ -0,0 +1,58 @@
+
+
+
+ {#if ballot && event?.status == 'RE'}
+
{event.name}
+
+ Thanks for registering for {event.name} . Sit tight and wait for the event to start.
+
+ {:else if ballot && event?.status == 'VO'}
+
+ {:else if ballot && event?.status == 'CL'}
+
+ {:else}
+ Loading...
+ {/if}
+
diff --git a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/results.svelte b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/results.svelte
new file mode 100644
index 0000000..a4173bf
--- /dev/null
+++ b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/results.svelte
@@ -0,0 +1,25 @@
+
+
+
{event.name}
+
Results
+
+ This event has concluded. Thank you for participating {ballot.voter_name} !
+
+{#if event.show_results}
+
+{/if}
diff --git a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/voting.svelte b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/voting.svelte
new file mode 100644
index 0000000..75a034c
--- /dev/null
+++ b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/components/voting.svelte
@@ -0,0 +1,33 @@
+
+
+
{event.name}
+
{ballot.voter_name}'s Ballot
+
+ {#if ballot.submitted !== null}
+
Thank you for submitting your vote!
+ {:else}
+
+ {/if}
+
diff --git a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/vote/+page.svelte b/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/vote/+page.svelte
deleted file mode 100644
index f9d80e2..0000000
--- a/src/routes/event/[id=eventID]/ballot/[ballotID=eventID]/vote/+page.svelte
+++ /dev/null
@@ -1,53 +0,0 @@
-
-
-
Voting - {name}
-
- {#if !eventContext.event}
-
Loading event data...
- {:else if submitted}
- {#if eventContext.event?.show_results === true}
-
- {:else}
-
You have already submitted your vote. Thank you!
- {/if}
- {:else}
-
- {/if}
-
diff --git a/src/routes/event/[id=eventID]/components/registration.svelte b/src/routes/event/[id=eventID]/components/registration.svelte
new file mode 100644
index 0000000..3aeec73
--- /dev/null
+++ b/src/routes/event/[id=eventID]/components/registration.svelte
@@ -0,0 +1,78 @@
+
+
+
+
Registration ({event.name})
+
+
+
+
+ {#if copied}
+
+ {:else}
+
+ {/if}
+ {copied ? 'Invitation copied to clipboard' : 'Copy invitation to clipboard'}
+
+
+
+
Registered Voters ({ballotCount})
+ {#if ballots == null}
+
Loading...
+ {:else if ballots.length == 0}
+
No voters have registered yet.
+ {:else}
+
+ {#each ballots as ballot (ballot.id)}
+ {ballot.voter_name}
+ {/each}
+
+ {/if}
+
+
+
+ Begin Voting
+
diff --git a/src/routes/event/[id=eventID]/components/results.svelte b/src/routes/event/[id=eventID]/components/results.svelte
new file mode 100644
index 0000000..d6e3ce2
--- /dev/null
+++ b/src/routes/event/[id=eventID]/components/results.svelte
@@ -0,0 +1,42 @@
+
+
+
+ Results ({event.name})
+
+
+ Visible to participants
+
+
+ {#if config}
+ {#if ballots}
+
+ {/if}
+ {:else}
+ Config Error!
+ {/if}
+
diff --git a/src/routes/event/[id=eventID]/components/voting.svelte b/src/routes/event/[id=eventID]/components/voting.svelte
new file mode 100644
index 0000000..d57cd22
--- /dev/null
+++ b/src/routes/event/[id=eventID]/components/voting.svelte
@@ -0,0 +1,55 @@
+
+
+
Voting ({event.name})
+
+{#if unsubmittedBallots !== undefined && submittedBallots !== undefined}
+
Active ({unsubmittedBallots.length})
+
+ {#each unsubmittedBallots as ballot (ballot.id)}
+ {ballot.voter_name}
+ {/each}
+
+
Submitted ({submittedBallots.length})
+
+ {#each submittedBallots as ballot (ballot.id)}
+ {ballot.voter_name}
+ {/each}
+
+
+ {#if submittedBallots.length === 0 && unsubmittedBallots.length === 0}
+
No ballots available.
+ {/if}
+{:else}
+
Loading ballots...
+{/if}
+
+
+
+ Close Voting
+
diff --git a/src/routes/event/[id=eventID]/host/+layout.svelte b/src/routes/event/[id=eventID]/host/+layout.svelte
deleted file mode 100644
index 3f3f78e..0000000
--- a/src/routes/event/[id=eventID]/host/+layout.svelte
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
- {@render children?.()}
-
-
-
-
-
-
-
-
-
- {
- confirmationModalOpen = true;
- }}
- >
-
-
-
-
-
-
-
-
- Are you sure you want to close voting to this event?
-
-
-
- Yes, I'm sure
-
-
- No, cancel
-
-
-
-
diff --git a/src/routes/event/[id=eventID]/host/dashboard/+page.svelte b/src/routes/event/[id=eventID]/host/dashboard/+page.svelte
deleted file mode 100644
index 5d33474..0000000
--- a/src/routes/event/[id=eventID]/host/dashboard/+page.svelte
+++ /dev/null
@@ -1,61 +0,0 @@
-
-
-
Dashboard
-
-{#if unsubmittedBallots.length > 0}
-
Unsubmitted Ballots
-
- {#each unsubmittedBallots as ballot (ballot.id)}
- {ballot.voter_name}
- {/each}
-
-{/if}
-
-{#if submittedBallots.length > 0}
-
Submitted Ballots
-
- {#each submittedBallots as ballot (ballot.id)}
- {ballot.voter_name}
- {/each}
-
-{/if}
-
-{#if submittedBallots.length === 0 && unsubmittedBallots.length === 0}
-
No ballots available.
-{/if}
diff --git a/src/routes/event/[id=eventID]/host/invitation/+page.svelte b/src/routes/event/[id=eventID]/host/invitation/+page.svelte
deleted file mode 100644
index 95260f0..0000000
--- a/src/routes/event/[id=eventID]/host/invitation/+page.svelte
+++ /dev/null
@@ -1,87 +0,0 @@
-
-
-
Event Invitation
-
- {#if hostContext.event}
-
- {/if}
-
-
- {#if copied}
-
- {:else}
-
- {/if}
- {copied ? 'Invitation copied to clipboard' : 'Copy invitation to clipboard'}
-
-
-
- Registered Voters
-
-
-
-
- {#if hostContext.ballots.length > 0}
-
- {#each hostContext.ballots as ballot (ballot.id)}
- {ballot.voter_name}
- {/each}
-
- {:else}
-
No voters have registered yet.
- {/if}
-
diff --git a/src/routes/event/[id=eventID]/host/results/+page@[id=eventID].svelte b/src/routes/event/[id=eventID]/host/results/+page@[id=eventID].svelte
deleted file mode 100644
index 515089a..0000000
--- a/src/routes/event/[id=eventID]/host/results/+page@[id=eventID].svelte
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
Results
-
- {#if eventContext.event}
-
-
-
-
- Make results visible to participants
-
-
- Re-open Event
- {/if}
-
diff --git a/src/routes/event/[id=eventID]/host/type.ts b/src/routes/event/[id=eventID]/host/type.ts
deleted file mode 100644
index 16dc9eb..0000000
--- a/src/routes/event/[id=eventID]/host/type.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-import type { BallotResponseData, EventResponseData } from '$lib/api/events';
-
-export type HostContext = { ballots: BallotResponseData[]; event: EventResponseData | null };
diff --git a/src/routes/register/+page.svelte b/src/routes/register/+page.svelte
index c633ab4..a8de8df 100644
--- a/src/routes/register/+page.svelte
+++ b/src/routes/register/+page.svelte
@@ -35,7 +35,7 @@
}
storage.saveBallot(response.ballot_id, data.id, response.ballot_token);
- await goto(resolve(`/event/${data.id}/ballot/${response.ballot_id}/vote`));
+ await goto(resolve(`/event/${data.id}/ballot/${response.ballot_id}/`));
};
onMount(async () => {
@@ -46,7 +46,7 @@
try {
const ballotID = storage.getBallotIDFromEventID(data.id);
- await goto(resolve(`/event/${data.id}/ballot/${ballotID}/vote/`));
+ await goto(resolve(`/event/${data.id}/ballot/${ballotID}/`));
} catch (e) {
if (!(e instanceof ErrorBallotWithEventIDNotFound)) {
throw e;
@@ -58,33 +58,36 @@
});
-{#if loading === false}
-
Register for {data.name}
-