Skip to content

Commit

Permalink
Fixed Stages, fixed icons, moved to Bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
RJMurg committed Sep 11, 2023
1 parent 84b2510 commit 7c3a139
Show file tree
Hide file tree
Showing 21 changed files with 11,594 additions and 115 deletions.
3 changes: 2 additions & 1 deletion src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
<meta name="viewport" content="width=device-width" />
<link href="http://fonts.googleapis.com/css?family=IBM+Plex+Sans" />
<link href="http://fonts.googleapis.com/css?family=IBM+Plex+Mono" />
<link href="/style.css" rel="stylesheet" />
<link href="%sveltekit.assets%/bootstrap.min.css" rel="stylesheet" />
<link href="%sveltekit.assets%/style.css" rel="stylesheet" />

%sveltekit.head%
</head>
Expand Down
96 changes: 56 additions & 40 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -44,49 +44,65 @@

<Toasts />

<Thumb />
<div class="container">
<Thumb />

<h1 class="title verylarge nogap">BitHunt</h1>
<h1 class="title verylarge nogap">BitHunt</h1>

{#if data.status == 200}
<h2 class="subtitle medium nogap"><strong>Today's Event:</strong> {data.event.name}</h2>
{#if data.status == 200}
<div class="row justify-content-center">
<div class="col">
<h2 class="subtitle medium nogap"><strong>Today's Event:</strong> {data.event.name}</h2>

<h2 class="subtitle medium nogap">
<strong>Today's Prize:</strong> One of {data.event.prizecount}
{prize}!
</h2>

{#if data.validCookie == false}
<div class="buttons">
<button class="cspp" on:click={() => register()}>
<UserPlus color="var(--green)" />
Register
</button>

<button class="cspp" on:click={() => login()}>
<LogIn color="var(--green)" />
Login
</button>
<h2 class="subtitle medium nogap">
<strong>Today's Prize:</strong> One of {data.event.prizecount}
{prize}!
</h2>
</div>
</div>
{:else}
<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/stage')}>
<DoorOpen color="var(--green)" />
Enter Event
</button>

<button class="cspp" on:click={() => (window.location.href = '/leaderboard')}>
<Crown color="var(--green)" />
Leaderboard
</button>

<button class="cspp" on:click={() => (window.location.href = '/logout')}>
<LogOut color="var(--green)" />
Logout
</button>
</div>
{#if data.validCookie == false}
<div class="row justify-content-center">
<div class="container">
<div class="row justify-content-center">
<div class="col-md-6">
<button class="cspp" on:click={() => register()}>
<UserPlus color="var(--green)" size="32"/>
Register
</button>
</div>
<div class="col-md-6">
<button class="cspp" on:click={() => login()}>
<LogIn color="var(--green)" size="32"/>
Login
</button>
</div>
</div>
</div>
</div>
{:else}
<div class="row justify-content-center">
<div class="container-fluid">
<div class="row justify-content-center">
<div class="col-lg-6">
<button class="cspp" on:click={() => (window.location.href = '/stage')}>
<DoorOpen color="var(--green)" size="32"/>
Enter Event
</button>
</div>

<div class="col-lg-6">
<button class="cspp" on:click={() => (window.location.href = '/logout')}>
<LogOut color="var(--green)" size="32"/>
Logout
</button>
</div>
</div>
</div>
</div>
{/if}
{:else}
<h2 class="subtitle large nogap"><strong>No Event Today</strong></h2>
<p class="subtitle medium nogap">Please check back later.</p>
{/if}
{:else}
<h2 class="subtitle large nogap"><strong>No Event Today</strong></h2>
<p class="subtitle medium nogap">Please check back later.</p>
{/if}
</div>
4 changes: 0 additions & 4 deletions src/routes/admin/+page.server.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { redirect } from '@sveltejs/kit';
import { databaseIntegrity } from '$lib/server/database';
import type { PageServerLoad, Actions } from './$types';

Expand Down Expand Up @@ -64,13 +63,10 @@ export const actions = {
}
},
logout: async ({ cookies }) => {
console.log('logging out');
// Set cookie to false, with age of -1 (expires immediately)
cookies.set('admin', 'false', {
maxAge: -1,
path: '/'
});

throw redirect(307, '/admin');
}
} satisfies Actions;
70 changes: 41 additions & 29 deletions src/routes/admin/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -66,47 +66,59 @@
<form method="POST" action="?/login">
<input type="password" name="password" class="form-medium" placeholder="Password" />
<button class="cspp form-element" type="submit">
<LogIn color="var(--green)" />
<LogIn color="var(--green)" size="32" />
Log in
</button>
<button class="cspp" type="button" on:click={() => (window.location.href = '/')}>
<Home color="var(--green)" />
<Home color="var(--green)" size="32" />
Go Home
</button>
</form>
{:else}
<h2 class="subtitle medium">Chose an option:</h2>

<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/admin/events')}>
<Calendar color="var(--green)" />
Events
</button>

<button class="cspp" on:click={() => (window.location.href = '/admin/stages')}>
<Split color="var(--green)" />
Stages
</button>

<button class="cspp" on:click={() => (window.location.href = '/admin/puzzles')}>
<Puzzle color="var(--green)" />
Puzzles
</button>

<button class="cspp" on:click={() => (window.location.href = '/admin/leaderboard')}>
<Crown color="var(--green)" />
Leaderboard
</button>

<button class="cspp" on:click={() => (window.location.href = '/admin/leaderboard')}>
<BookMarked color="var(--green)" />
Overall
</button>
<div class="container">
<div class="row">
<div class="col-lg-4">
<button class="cspp" on:click={() => (window.location.href = '/admin/events')}>
<Calendar color="var(--green)" size="32" />
Events
</button>
</div>

<div class="col-lg-4">
<button class="cspp" on:click={() => (window.location.href = '/admin/stages')}>
<Split color="var(--green)" size="32" />
Stages
</button>
</div>

<div class="col-lg-4">
<button class="cspp" on:click={() => alert('Puzzles are not complete.')}>
<Puzzle color="var(--green)" size="32" />
Puzzles (WIP)
</button>
</div>

<div class="col-lg-6">
<button class="cspp" on:click={() => alert('Leaderboards are not complete.')}>
<Crown color="var(--green)" size="32" />
Leaderboard (WIP)
</button>
</div>

<div class="col-lg-6">
<button class="cspp" on:click={() => (window.location.href = '/admin/overall')}>
<BookMarked color="var(--green)" size="32" />
Overall
</button>
</div>
</div>
</div>

<form method="post" class="nocss" action="?/logout">
<button class="cspp" formaction="?/logout">
<LogOut color="var(--green)" />
<button class="cspp">
<LogOut color="var(--green)" size="32" />
Log Out
</button>
</form>
Expand Down
8 changes: 4 additions & 4 deletions src/routes/admin/events/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,11 @@

<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/admin')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Go Back
</button>
<button class="cspp" on:click={() => (window.location.href = '/admin/events/create')}>
<PlusCircle color="var(--green)" />
<PlusCircle color="var(--green)" size="32" />
Add New
</button>
</div>
Expand Down Expand Up @@ -88,10 +88,10 @@
<td>
<div class="actions">
<button class="action" on:click={() => eventView(event.id)}>
<Eye color="var(--green)" />
<Eye color="var(--green)" size="32" />
</button>
<button class="action" on:click={() => eventRemove(event.id)}>
<Trash2 color="var(--green)" />
<Trash2 color="var(--green)" size="32" />
</button>
</div>
</td>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/admin/events/create/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<h1 class="title large">Create an Event</h1>

<button class="cspp form-element" on:click={() => (window.location.href = '/admin/events')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Back
</button>

Expand Down Expand Up @@ -81,7 +81,7 @@
</select>

<button type="submit" class="cspp form-element primary">
<PlusCircle color="var(--green)" />
<PlusCircle color="var(--green)" size="32" />
Create Event
</button>
</form>
6 changes: 3 additions & 3 deletions src/routes/admin/events/view/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@

<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/admin/events')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Back
</button>

<button class="cspp" on:click={() => toggleEdit()}>
<Pencil color="var(--green)" />
<Pencil color="var(--green)" size="32" />
Edit {data.event.name}
</button>
</div>
Expand Down Expand Up @@ -102,7 +102,7 @@
</select>

<button class="cspp" {disabled}>
<Save color="var(--green)" />
<Save color="var(--green)" size="32" />
Save
</button>
</form>
5 changes: 5 additions & 0 deletions src/routes/admin/overall/+page.server.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import type { PageServerLoad } from './$types';

export const load = (async () => {
return {};
}) satisfies PageServerLoad;
5 changes: 5 additions & 0 deletions src/routes/admin/overall/+page.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<script lang="ts">
import type { PageData } from './$types';
export let data: PageData;
</script>
10 changes: 5 additions & 5 deletions src/routes/admin/stages/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@

<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/admin')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Go Back
</button>
<button class="cspp" on:click={() => (window.location.href = '/admin/stages/create')}>
<PlusCircle color="var(--green)" />
<PlusCircle color="var(--green)" size="32" />
Add New
</button>
</div>
Expand All @@ -63,13 +63,13 @@
<td>
<div class="actions">
<button class="action" on:click={() => stageView(stage.id)}>
<Eye color="var(--green)" />
<Eye color="var(--green)" size="32" />
</button>
<button class="action" on:click={() => stageRemove(stage.id)}>
<Trash2 color="var(--green)" />
<Trash2 color="var(--green)" size="32" />
</button>
<button class="action" on:click={() => stageQR(stage.id)}>
<QrCode color="var(--green)" />
<QrCode color="var(--green)" size="32" />
</button>
</div>
</td>
Expand Down
4 changes: 2 additions & 2 deletions src/routes/admin/stages/create/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<h1 class="title large">Create a Stage</h1>

<button class="cspp form-element" on:click={() => (window.location.href = '/admin/stages')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Back
</button>

Expand Down Expand Up @@ -59,7 +59,7 @@
</select>

<button type="submit" class="cspp form-element primary">
<PlusCircle color="var(--green)" />
<PlusCircle color="var(--green)" size="32" />
Create Event
</button>
</form>
2 changes: 1 addition & 1 deletion src/routes/admin/stages/qr/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</head>

<button class="cspp" on:click={() => (window.location.href = '/admin/stages')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Go Back
</button>

Expand Down
6 changes: 3 additions & 3 deletions src/routes/admin/stages/view/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@

<div class="buttons">
<button class="cspp" on:click={() => (window.location.href = '/admin/stages')}>
<ChevronLeft color="var(--green)" />
<ChevronLeft color="var(--green)" size="32" />
Back
</button>

<button class="cspp" on:click={() => toggleEdit()}>
<Pencil color="var(--green)" />
<Pencil color="var(--green)" size="32" />
Edit {data.stage.name}
</button>
</div>
Expand Down Expand Up @@ -61,7 +61,7 @@
</select>

<button class="cspp" {disabled}>
<Save color="var(--green)" />
<Save color="var(--green)" size="32" />
Save
</button>
</form>
Loading

0 comments on commit 7c3a139

Please sign in to comment.