-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement initial admin dashboard (#21)
- Loading branch information
Showing
8 changed files
with
361 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<script> | ||
import { format } from 'date-fns'; | ||
// eslint-disable-next-line init-declarations | ||
export let data; | ||
$: ({ draft } = data); | ||
</script> | ||
|
||
{#if draft !== null} | ||
{@const { draft_id, curr_round, max_rounds, active_period_start } = draft} | ||
{@const startDate = format(active_period_start, 'PPP')} | ||
{@const startTime = format(active_period_start, 'pp')} | ||
<div class="card prose dark:prose-invert max-w-none p-4"> | ||
<p> | ||
{#if curr_round === null} | ||
<strong>Draft #{draft_id}</strong> (which opened last <strong>{startDate}</strong> at | ||
<strong>{startTime}</strong>) has recently finished the main drafting process. It is currently in the | ||
lottery rounds. | ||
{:else} | ||
<strong>Draft #{draft_id}</strong> is currently on Round <strong>{curr_round}</strong> | ||
of <strong>{max_rounds}</strong>. It opened last <strong>{startDate}</strong> at | ||
<strong>{startTime}</strong>. | ||
{/if} | ||
</p> | ||
</div> | ||
{/if} | ||
<slot /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<script lang="ts" context="module"> | ||
const enum TabType { | ||
Students, | ||
Labs, | ||
Logs, | ||
} | ||
</script> | ||
|
||
<script lang="ts"> | ||
import { AcademicCap, Beaker, CheckCircle, PaperClip, QuestionMarkCircle } from '@steeze-ui/heroicons'; | ||
import { Accordion, AccordionItem, Tab, TabGroup } from '@skeletonlabs/skeleton'; | ||
import ErrorAlert from '$lib/alerts/Error.svelte'; | ||
import { Icon } from '@steeze-ui/svelte-icon'; | ||
import LabAccordionItem from './LabAccordionItem.svelte'; | ||
import Student from '$lib/users/Student.svelte'; | ||
import SystemLogsTab from './SystemLogsTab.svelte'; | ||
import type { ChoiceRecords, TaggedStudentsWithLabs } from 'drap-database'; | ||
import type { Lab } from 'drap-model/lab'; | ||
// eslint-disable-next-line init-declarations | ||
export let round: number; | ||
// eslint-disable-next-line init-declarations | ||
export let labs: Lab[]; | ||
// eslint-disable-next-line init-declarations | ||
export let records: ChoiceRecords; | ||
// eslint-disable-next-line init-declarations | ||
export let available: TaggedStudentsWithLabs; | ||
// eslint-disable-next-line init-declarations | ||
export let selected: TaggedStudentsWithLabs; | ||
$: total = available.length + selected.length; | ||
let group = TabType.Students; | ||
</script> | ||
|
||
<TabGroup> | ||
<Tab bind:group name="students" value={TabType.Students}> | ||
<Icon src={AcademicCap} slot="lead" class="h-8" /> | ||
<span>Registered Students</span> | ||
</Tab> | ||
<Tab bind:group name="labs" value={TabType.Labs}> | ||
<Icon src={Beaker} slot="lead" class="h-8" /> | ||
<span>Laboratories</span> | ||
</Tab> | ||
<Tab bind:group name="logs" value={TabType.Logs}> | ||
<Icon src={PaperClip} slot="lead" class="h-8" /> | ||
<span>System Logs</span> | ||
</Tab> | ||
<svelte:fragment slot="panel"> | ||
{#if group === TabType.Students} | ||
<Accordion> | ||
<AccordionItem open> | ||
<Icon src={CheckCircle} slot="lead" class="h-8" /> | ||
<span slot="summary">Pending Selection ({available.length}/{total})</span> | ||
<svelte:fragment slot="content"> | ||
{#each available as student} | ||
<Student user={student} /> | ||
{/each} | ||
</svelte:fragment> | ||
</AccordionItem> | ||
<AccordionItem> | ||
<Icon src={QuestionMarkCircle} slot="lead" class="h-8" /> | ||
<span slot="summary">Already Drafted ({selected.length}/{total})</span> | ||
<svelte:fragment slot="content"> | ||
{#each selected as student} | ||
<Student user={student} /> | ||
{/each} | ||
</svelte:fragment> | ||
</AccordionItem> | ||
</Accordion> | ||
{:else if group === TabType.Labs} | ||
<Accordion> | ||
{#each labs as lab (lab.lab_id)} | ||
<div class="card space-y-4 p-4"> | ||
<LabAccordionItem {lab} {round} {available} {selected} /> | ||
</div> | ||
{/each} | ||
</Accordion> | ||
{:else if group === TabType.Logs} | ||
<SystemLogsTab {records} /> | ||
{:else} | ||
<ErrorAlert>This is an unexpected tab state. Kindly report this bug.</ErrorAlert> | ||
{/if} | ||
</svelte:fragment> | ||
</TabGroup> |
Oops, something went wrong.