CLASSROOMIO-T-49

merge

CLASSROOMIO-T-49: Quiz CRUD

CLASSROOMIO-T-49: Validate quiz question

CLASSROOMIO-T-49: Begin work on quiz preview

CLASSROOMIO-T-49: Complete quiz page

CLASSROOMIO-T-49: Init quiz work

CLASSROOMIO-T-49: Quiz CRUD

CLASSROOMIO-T-49: Validate quiz question

CLASSROOMIO-T-49: Begin work on quiz preview

CLASSROOMIO-T-49: Complete quiz page

CLASSROOMIO-T-49: Init quiz work


Co-authored-by: Rotimi Best <rotimiibitoyeemma@gmail.com>

Merge-request: CLASSROOMIO-MR-14
Merged-by: Best Admin <digdippa@gmail.com>
This commit is contained in:
Rotimi Best
2023-06-17 19:11:29 +00:00
committed by Space Cloud
co-authored by Rotimi Best
parent b532ea6d29
commit 1e71a91a54
70 changed files with 10601 additions and 497 deletions
+1 -1
View File
@@ -71,7 +71,7 @@
{discussion.title}
</a>
</h4>
<span class="text-gray-600 dark:text-gray-100">
<span class="text-gray-600 dark:text-white">
{discussion.author} asked {discussion.createdAt}
</span>
</div>
@@ -0,0 +1,69 @@
<script>
import PrimaryButton from '../../PrimaryButton/index.svelte';
import { VARIANTS } from '../../PrimaryButton/constants';
import Modal from '../../Modal/index.svelte';
import { deleteModal, quizesStore } from '../../../utils/store/org';
import { supabase } from '../../../utils/functions/supabase';
export let onDelete = () => {};
function closeModal() {
deleteModal.update((m) => ({
...m,
open: false,
id: null,
isQuestion: false,
}));
}
async function deleteQuiz() {
const { data, error } = await supabase
.from('quiz')
.delete()
.match({ id: $deleteModal.id });
console.log('data', data);
console.log('error', error);
if (error) {
return;
}
$quizesStore = $quizesStore.filter((q) => q.id !== $deleteModal.id);
closeModal();
}
</script>
<Modal
onClose={closeModal}
bind:open={$deleteModal.open}
width="w-2/5"
modalHeading={$deleteModal.isQuestion ? 'Delete Question' : 'Delete Quiz'}
size="sm"
>
<div class="w-full flex flex-col items-center my-10">
<h1 class="dark:text-white text-lg text-center">
{#if $deleteModal.isQuestion}
Are you sure you want to delete this question?
{:else}
Are you sure you want to delete this quiz?
{/if}
You will lose your content and this action can’t be undone.
</h1>
<div class="mt-5">
<PrimaryButton
className="px-6 py-3"
variant={VARIANTS.CONTAINED_DANGER}
label="Delete"
onClick={() => {
if ($deleteModal.isQuestion) {
onDelete();
$deleteModal.open = false;
} else {
deleteQuiz();
}
}}
/>
</div>
</div>
</Modal>
+21
View File
@@ -0,0 +1,21 @@
<script lang="ts">
import { SkeletonPlaceholder, SkeletonText } from 'carbon-components-svelte';
</script>
<div
class="root w-full border border-gray-100 dark:bg-gray-700 mr-4 mb-4 rounded-md transition ease-in-out relative flex p-3"
>
<SkeletonPlaceholder style="width: 20%; height: 100%;" />
<div class="w-full mx-5 flex justify-evenly flex-col">
<!-- Title -->
<SkeletonText style="width: 50%;" />
<!-- Description -->
<SkeletonText style="width: 50%; height: 4rem;" />
</div>
</div>
<style>
.root {
height: 180px;
}
</style>
+141
View File
@@ -0,0 +1,141 @@
<script>
import { goto } from '@sapper/app';
import PrimaryButton from '../../PrimaryButton/index.svelte';
import Modal from '../../Modal/index.svelte';
import TextField from '../../Form/TextField.svelte';
import { snackbarStore } from '../../Snackbar/store';
import { SNACKBAR_SEVERITY } from '../../Snackbar/constants';
import { supabase } from '../../../utils/functions/supabase';
import {
currentOrg,
createQuizModal,
currentOrgPath,
quizesStore,
} from '../../../utils/store/org';
import { createQuizValidation } from '../../../utils/functions/validator';
let open = false;
let errors = {
title: '',
};
let isLoading = false;
function handleClose() {
$createQuizModal.id = null;
$createQuizModal.title = '';
$createQuizModal.open = false;
$createQuizModal.openEdit = false;
}
function errorNotification() {
$snackbarStore.message = "Something's not right - Please try later";
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
}
async function createQuiz() {
errors = createQuizValidation($createQuizModal);
console.log('createQuiz|updateQuiz errors', errors);
if (Object.keys(errors).length) {
return;
}
isLoading = true;
if ($createQuizModal.openEdit) {
const { error } = await supabase
.from('quiz')
.update(
{ title: $createQuizModal.title, updated_at: new Date() },
{
returning: 'minimal',
}
)
.match({ id: $createQuizModal.id });
isLoading = false;
if (error) {
return errorNotification();
} else {
$quizesStore = $quizesStore.map((s) => {
if (s.id === $createQuizModal.id) {
s.title = $createQuizModal.title;
}
return s;
});
handleClose();
}
} else {
const { data, error } = await supabase.from('quiz').insert({
title: $createQuizModal.title,
organization_id: $currentOrg.id,
questions: [
{
id: 1,
label: '',
type: 'multichoice',
options: [
{
id: 'circle',
label: '',
isCorrect: false,
},
{
id: 'triangle',
label: '',
isCorrect: false,
},
],
},
],
});
isLoading = false;
if (error) {
return errorNotification();
} else {
$quizesStore = [...$quizesStore, data[0]];
handleClose();
goto(`${$currentOrgPath}/quiz/${data[0].id}`);
}
}
}
$: open = $createQuizModal.openEdit || $createQuizModal.open;
</script>
<svelte:head>
<title>Quizzes - ClassroomIO</title>
</svelte:head>
<Modal
onClose={handleClose}
bind:open
width="w-2/5"
modalHeading="{$createQuizModal.openEdit ? 'Update' : 'Create'} a Quiz"
>
<form on:submit|preventDefault={createQuiz}>
<TextField
label="Quiz Title"
bind:value={$createQuizModal.title}
autofocus={true}
placeholder="Your quiz title"
className="mb-4"
isRequired={true}
errorMessage={errors.title}
autoComplete={false}
/>
<div class="mt-5 flex items-center justify-end">
<PrimaryButton
className="px-6 py-3"
label={$createQuizModal.openEdit ? 'Save Changes' : 'Continue'}
type="submit"
isDisabled={isLoading}
{isLoading}
/>
</div>
</form>
</Modal>
@@ -0,0 +1,61 @@
<script>
import { onMount } from 'svelte';
import { SyncLoader } from 'svelte-loading-spinners';
import PlayContainer from './Container.svelte';
import PlayHeader from './Header/index.svelte';
import { quizStore, playQuizStore } from '../../../../utils/store/org';
import { STEPS } from '../../../../utils/constants/quiz';
import { genQuizPin } from '../../../../utils/functions/org';
import PrimaryButton from '../../../PrimaryButton/index.svelte';
import { VARIANTS } from '../../../PrimaryButton/constants';
let isGettingPin = true;
function getPin() {
setTimeout(() => {
$quizStore.pin = genQuizPin();
isGettingPin = false;
}, 3000);
}
function goToPlayersStep() {
$playQuizStore.step = STEPS.WAIT_FOR_PLAYERS;
}
onMount(() => {
getPin();
});
</script>
<PlayContainer>
<div slot="header">
<PlayHeader startCount={true} showCountDown={true} />
</div>
<div
slot="body"
class="w-full rounded-md bg-white dark:bg-gray-700 py-7 px-5"
>
<div class="mb-3">
<p>1. Visit</p>
<h3>play.classroomio.com</h3>
</div>
<div class="">
<p>2. Enter Pin</p>
{#if isGettingPin}
<SyncLoader size="50" color="#1d4ed8" unit="px" duration="1s" />
{:else}
<h3>{$quizStore.pin}</h3>
{/if}
</div>
</div>
<div slot="footer" class="flex justify-center items-center">
<p class="font-bold mr-3">Let's go</p>
<PrimaryButton
label="View Players"
variant={VARIANTS.OUTLINED}
onClick={goToPlayersStep}
/>
</div>
</PlayContainer>
@@ -0,0 +1,43 @@
<div class="root flex flex-col justify-between h-full m-auto">
{#if $$slots.header}
<!-- HEADER -->
<div class="header">
<slot name="header" />
</div>
{/if}
{#if $$slots.body}
<!-- BODY -->
<div class="body mb-3">
<slot name="body" />
</div>
{/if}
{#if $$slots.footer}
<!-- FOOTER -->
<div class="footer bg-white dark:bg-gray-700 py-6 px-2 m-auto">
<slot name="footer" />
</div>
{/if}
</div>
<style>
.root {
max-width: 680px;
width: 80%;
height: 95vh;
}
.header {
height: 15%;
}
.body {
min-height: 60%;
height: fit-content;
}
.footer {
max-width: 400px;
}
</style>
@@ -0,0 +1,7 @@
<script>
import CircleContent from './CircleContent.svelte';
export let answers = 0;
</script>
<CircleContent value={answers} label="Answer(s)" />
@@ -0,0 +1,45 @@
<script>
import { slide } from 'svelte/transition';
export let value = false;
export let label = '';
export let className = '';
function fadeSlide(node, options) {
const slideTrans = slide(node, options);
return {
duration: options.duration,
css: (t) => `
${slideTrans.css(t)}
opacity: ${t};
`,
};
}
</script>
<div class="circle flex items-center flex-col justify-center {className}">
{#key value}
<h3 class="text-blue-600" transition:fadeSlide={{ duration: 500 }}>
{value}
</h3>
{/key}
<p class="text-blue-600 text-md">{label}</p>
</div>
<style>
.circle {
width: 100px;
height: 100px;
line-height: 100px;
border-radius: 50%;
font-size: 50px;
text-align: center;
background: #fff;
}
.circle h3 {
font-size: 40px;
margin: 0;
padding: 0;
line-height: 1;
}
</style>
@@ -0,0 +1,39 @@
<script>
import { onMount } from 'svelte';
import CircleContent from './CircleContent.svelte';
export let startCount = false;
export let timelimit = '';
let countDownNo = 0;
let started = false;
function triggerCountDown(start) {
if (!start || started) return;
const getNum = (k) => parseInt(timelimit.replace(k, ''));
if (timelimit.includes('s')) {
countDownNo = getNum('s');
} else if (timelimit.includes('m')) {
countDownNo = getNum('m') * 60;
}
window.refreshIntervalId = setInterval(() => {
if (--countDownNo <= 0) {
clearInterval(window.refreshIntervalId);
}
}, 1000);
started = true;
}
onMount(() => {
if (startCount) {
triggerCountDown(startCount);
}
});
$: triggerCountDown(startCount);
</script>
<CircleContent value={countDownNo} label="Second(s)" className="mr-3" />
@@ -0,0 +1,18 @@
<script>
import { quizStore } from '../../../../../utils/store/org';
import Answer from './Answer.svelte';
import Timer from './Timer.svelte';
export let startCount = false;
export let showCountDown = false;
</script>
<div class="flex justify-between items-center w-full">
<h3 class="text-white">{$quizStore.title}</h3>
{#if showCountDown}
<div class="flex">
<Timer {startCount} timelimit={$quizStore.timelimit} />
<Answer />
</div>
{/if}
</div>
@@ -0,0 +1 @@
players
@@ -0,0 +1 @@
Podium
+102
View File
@@ -0,0 +1,102 @@
<script>
import { fly } from 'svelte/transition';
import ChevronLeft16 from 'carbon-icons-svelte/lib/ChevronLeft16';
import ChevronRight16 from 'carbon-icons-svelte/lib/ChevronRight16';
import { onMount } from 'svelte';
import QuizQuestion from '../QuizQuestion.svelte';
import PlayContainer from './Container.svelte';
import PlayHeader from './Header/index.svelte';
import { quizStore } from '../../../../utils/store/org';
import { themeImages } from '../../../../utils/constants/quiz';
import PrimaryButton from '../../../PrimaryButton/index.svelte';
import { VARIANTS } from '../../../PrimaryButton/constants';
import IconButton from '../../../IconButton/index.svelte';
export let exitPreview = () => {};
let bgImg;
let totalQ = $quizStore.questions.length;
let curQId = 0;
let currentQuestion = $quizStore.questions[0] || {};
function handlePrev() {
const prevQId = curQId - 1;
console.log('prevQId', prevQId);
const prev = $quizStore.questions[prevQId];
console.log('prev', prev);
if (prev) {
currentQuestion = prev;
curQId = prevQId;
}
}
function handleNext() {
const nextQId = curQId + 1;
console.log('nextqid', nextQId);
const next = $quizStore.questions[nextQId];
console.log('next', next);
if (next) {
currentQuestion = next;
curQId = nextQId;
}
}
onMount(() => {
bgImg = themeImages[$quizStore.theme].play;
});
</script>
{#if bgImg}
<div
class="absolute inset-0 z-50 bg-white h-screen w-screen"
in:fly={{ y: 500, duration: 500 }}
out:fly={{ y: 500, duration: 500 }}
>
<div
class="p-5 h-full w-full"
style="background: url({bgImg}) no-repeat center center fixed; -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;min-height: 100vh;height: fit-content;"
>
<PlayContainer>
<div slot="header">
<PlayHeader startCount={true} showCountDown={true} />
</div>
<div slot="body" class="quiz-body">
{#if currentQuestion}
<QuizQuestion {currentQuestion} isPreview={true} />
{:else}
<h2>No question added</h2>
{/if}
</div>
<div slot="footer" class="flex justify-center flex-col">
{#if currentQuestion}
<PrimaryButton
label="Exit Preview"
variant={VARIANTS.TEXT}
onClick={exitPreview}
className="w-fit"
/>
<div class="flex justify-center items-center">
<IconButton onClick={handlePrev} size="small">
<ChevronLeft16 class="carbon-icon" />
</IconButton>
<p class="mx-3">{curQId + 1} / {totalQ}</p>
<IconButton onClick={handleNext} size="small">
<ChevronRight16 class="carbon-icon" />
</IconButton>
</div>
{/if}
</div>
</PlayContainer>
</div>
</div>
{/if}
<style>
.quiz-body {
width: 500px;
margin: auto;
}
</style>
@@ -0,0 +1 @@
Question
@@ -0,0 +1 @@
Scoreboard
+47
View File
@@ -0,0 +1,47 @@
<script>
import { onMount } from 'svelte';
import { fly } from 'svelte/transition';
import { SyncLoader } from 'svelte-loading-spinners';
import { themeImages, STEPS } from '../../../../utils/constants/quiz';
import { quizStore, playQuizStore } from '../../../../utils/store/org';
import ConnectToPlay from './ConnectToPlay.svelte';
import Players from './Players.svelte';
import Question from './Question.svelte';
import Scoreboard from './Scoreboard.svelte';
import Podium from './Podium.svelte';
let bgImg;
onMount(() => {
bgImg = themeImages[$quizStore.theme].play;
});
</script>
{#if bgImg}
<div
class="absolute inset-0 z-50 bg-white h-screen w-screen"
in:fly={{ y: 500, duration: 500 }}
out:fly={{ y: 500, duration: 500 }}
>
<div
class="p-5 h-full w-full"
style="background: url({bgImg}) no-repeat center center fixed; -webkit-background-size: cover;-moz-background-size: cover;-o-background-size: cover;background-size: cover;min-height: 100vh;height: fit-content;"
>
{#if $playQuizStore.step === STEPS.CONNECT_TO_PLAY}
<ConnectToPlay />
{:else if $playQuizStore.step === STEPS.WAIT_FOR_PLAYERS}
<Players />
{:else if $playQuizStore.step === STEPS.SHOW_NEXT_QUESTION}
<Question />
{:else if $playQuizStore.step === STEPS.SCOREBOARD}
<Scoreboard />
{:else if $playQuizStore.step === STEPS.PODIUM}
<Podium />
{:else}
<div class="w-full m-auto">
<SyncLoader size="20" color="#1d4ed8" unit="px" duration="1s" />
</div>
{/if}
</div>
</div>
{/if}
+110
View File
@@ -0,0 +1,110 @@
<script>
import { goto } from '@sapper/app';
import pluralize from 'pluralize';
import OverflowMenuHorizontal20 from 'carbon-icons-svelte/lib/OverflowMenuHorizontal20';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { currentOrgPath, quizStore } from '../../../utils/store/org';
import Dropdown from '../../Dropdown/index.svelte';
import PrimaryButton from '../../PrimaryButton/index.svelte';
import { VARIANTS } from '../../PrimaryButton/constants';
import {
onRename,
onMakeCopy,
onDelete,
} from '../../../utils/services/org/quiz';
import { themeImages } from '../../../utils/constants/quiz';
dayjs.extend(relativeTime);
export let quiz;
export let totalQuestions;
function getOptions() {
return [
// {
// label: 'Edit',
// onClick: onEdit(quiz),
// },
// {
// label: 'Share',
// onClick: onShare(quiz),
// },
// {
// label: 'Report',
// onClick: onReport(quiz),
// },
{
label: 'Rename',
onClick() {
onRename(quiz);
},
},
// {
// label: 'Make a copy',
// onClick() {
// onMakeCopy(quiz);
// },
// },
{
label: 'Delete',
onClick() {
onDelete(quiz);
},
},
];
}
function startQuiz() {}
</script>
{#if quiz}
<div
class="root w-full border hover:shadow-2xl transition ease-in-out rounded-lg bg-gray-100 dark:bg-gray-700 mr-4 mb-5 relative flex p-3"
>
<img
src={themeImages[quiz.theme]?.card || themeImages.standard.card}
alt="quiz-card"
class=""
style="max-width: 300px;"
/>
<div class="p-5 flex flex-col justify-between w-full">
<div class="flex justify-between">
<h4 class="dark:text-white title text-md font-bold">
<a href="{$currentOrgPath}/quiz/{quiz.id}">{quiz.title}</a>
</h4>
<Dropdown
options={getOptions()}
classNames="absolute top-4 right-4"
isIcon={true}
>
<div class="p-1 rounded-full bg-gray-200 dark:bg-gray-600">
<OverflowMenuHorizontal20 class="carbon-icon active" />
</div>
</Dropdown>
</div>
<div class="flex justify-between">
<div>
<p class="mb-2">{pluralize('question', totalQuestions, true)}</p>
<p>Updated {dayjs(quiz.updated_at).fromNow(true)} ago</p>
</div>
<PrimaryButton
className="px-6 py-3"
variant={VARIANTS.OUTLINED}
label="Start Quiz"
onClick={startQuiz}
/>
</div>
</div>
</div>
{/if}
<style>
.root {
height: 180px;
}
</style>
@@ -0,0 +1,63 @@
<script>
import CheckmarkFilled24 from 'carbon-icons-svelte/lib/CheckmarkFilled24';
import CheckmarkOutline24 from 'carbon-icons-svelte/lib/CheckmarkOutline24';
import { optionImage } from '../../../utils/constants/quiz';
import TextField from '../../Form/TextField.svelte';
import IconButton from '../../IconButton/index.svelte';
export let currentQuestion = {
label: '',
};
export let currentError = {};
export let optionHasError = () => false;
export let isPreview = false;
</script>
{#if isPreview}
<h1 class="text-white mb-5 font-bold">{currentQuestion.label}</h1>
{:else}
<TextField
placeholder="Start typing your question"
bind:value={currentQuestion.label}
className="w-full my-4"
errorMessage={currentError.isLabelEmpty && 'This field is required'}
isRequired={true}
bgColor="bg-white"
/>
{/if}
<!-- Options -->
<div class="flex justify-between w-full flex-wrap">
{#each currentQuestion.options || [] as option}
<div class="w-2/5 bg-white dark:bg-gray-700 rounded p-5 mb-5 relative">
<img src={optionImage[option.id]} alt={option.id} />
{#if isPreview}
<p class="mt-5">{option.label}</p>
{:else}
<TextField
bind:value={option.label}
placeholder="Type answer"
bgColor="bg-white"
className="mt-3"
isDisabled={currentQuestion.type === 'boolean'}
errorMessage={optionHasError(option.id, currentError.options) &&
'Please enter a label'}
/>
<div class="flex justify-end absolute top-2 right-2">
<IconButton
value={option.id}
onClick={() => (option.isCorrect = !option.isCorrect)}
buttonClassName={option.isCorrect && 'success'}
>
{#if option.isCorrect}
<CheckmarkFilled24 class="carbon-icon" />
{:else}
<CheckmarkOutline24 class="carbon-icon" />
{/if}
</IconButton>
</div>
{/if}
</div>
{/each}
</div>
+58
View File
@@ -0,0 +1,58 @@
<script>
import { onMount } from 'svelte';
import Box from '../../Box/index.svelte';
import QuizLoader from './Loader.svelte';
import QuizCard from './QuizCard.svelte';
import CoursesEmptyIcon from '../../Icons/CoursesEmptyIcon.svelte';
import { snackbarStore } from '../../Snackbar/store';
import { SNACKBAR_SEVERITY } from '../../Snackbar/constants';
import { supabase } from '../../../utils/functions/supabase';
import { currentOrg, quizesStore } from '../../../utils/store/org';
let isLoading = false;
async function fetchQuizes(id) {
if (!id) return;
isLoading = true;
const { data, error } = await supabase
.from('quiz')
.select(`*`)
.eq('organization_id', id)
.order('updated_at', { ascending: false });
if (error) {
$snackbarStore.message = "Something's not right - Please try later";
$snackbarStore.severity = SNACKBAR_SEVERITY.ERROR;
$snackbarStore.open = true;
return;
}
console.log('data', data);
quizesStore.set(data);
isLoading = false;
}
$: fetchQuizes($currentOrg.id);
</script>
<div
class="flex items-center justify-center lg:justify-start flex-wrap my-4 m-auto"
>
{#if isLoading}
<QuizLoader />
<QuizLoader />
<QuizLoader />
{:else}
{#each $quizesStore as quiz}
<QuizCard {quiz} totalQuestions={quiz.questions?.length || 0} />
{:else}
<Box>
<CoursesEmptyIcon />
<h3 class="dark:text-white text-2xl my-5">No Quiz Created</h3>
<p class="dark:text-white w-1/3 text-center">
Create interactive quizzes with scoreboard for your students.
</p>
</Box>
{/each}
{/if}
</div>
+1 -1
View File
@@ -71,7 +71,7 @@
><SectionTitle>Add</SectionTitle></Column
>
<Column sm={2} md={6} lg={8}>
<p class="text-md text-gray-500 dark:text-gray-200 mb-5">
<p class="text-md text-gray-500 dark:text-white mb-5">
Add your team mates or collaborators to your organization. Start working
together
</p>
@@ -116,7 +116,7 @@
>
<Column sm={2} md={6} lg={8}>
<h4 class="dark:text-white">Customise your Domain</h4>
<p class="text-sm text-gray-500 dark:text-gray-200">
<p class="text-sm text-gray-500 dark:text-white">
Create a custom URL so your audience can get to your organization easily
</p>
<PrimaryButton
@@ -131,7 +131,7 @@
<Column sm={2} md={2} lg={4}><SectionTitle>Team</SectionTitle></Column>
<Column sm={2} md={6} lg={8}>
<h4 class="dark:text-white">Set up your website</h4>
<p class="text-sm text-gray-500 dark:text-gray-200">
<p class="text-sm text-gray-500 dark:text-white">
Add team mates to your organization so you can both collaborate on
projects.
</p>
@@ -133,7 +133,7 @@
><SectionTitle>Add</SectionTitle></Column
>
<Column sm={2} md={6} lg={8}>
<p class="text-md text-gray-500 dark:text-gray-200 mb-5">
<p class="text-md text-gray-500 dark:text-white mb-5">
Add your team mates or collaborators to your organization. Start working
together
</p>
@@ -173,7 +173,7 @@
{#each $orgTeam as teamMember}
<div class="flex justify-between items-center mb-5">
<div class="flex">
<p class="text-sm text-gray-500 dark:text-gray-200 mr-3">
<p class="text-sm text-gray-500 dark:text-white mr-3">
{teamMember.email}
</p>
<TextChip
+19 -9
View File
@@ -1,12 +1,13 @@
<script>
import { stores } from '@sapper/app';
import Help from 'carbon-icons-svelte/lib/Help20';
import UserMultipleIcon from 'carbon-icons-svelte/lib/UserMultiple20';
import ForumIcon from 'carbon-icons-svelte/lib/Forum20';
import TextChip from '../../components/Chip/Text.svelte';
import OrgSelector from '../../components/OrgSelector/OrgSelector.svelte';
import HomeIcon from '../../components/Icons/HomeIcon.svelte';
import CourseIcon from '../../components/Icons/CourseIcon.svelte';
import QuizIcon from '../../components/Icons/QuizIcon.svelte';
import SiteSettingsIcon from '../../components/Icons/SiteSettingsIcon.svelte';
import AudienceIcon from '../../components/Icons/AudienceIcon.svelte';
import Avatar from '../../components/Avatar/index.svelte';
@@ -21,6 +22,10 @@
path: '',
label: 'Home',
},
{
path: '/quiz',
label: 'Quizzes',
},
{
path: '/courses',
label: 'Courses',
@@ -29,10 +34,10 @@
path: '/community',
label: 'Community',
},
{
path: '/site',
label: 'Site settings',
},
// {
// path: '/site',
// label: 'Site settings',
// },
{
path: '/audience',
label: 'Audience',
@@ -73,7 +78,10 @@
<ul class="my-5">
{#each menuItems as menuItem}
<a href="{$currentOrgPath}{menuItem.path}" class="text-black">
<a
href="{$currentOrgPath}{menuItem.path}"
class="text-black no-underline"
>
<li
class="flex items-center py-3 px-4 mb-2 rounded hover:bg-gray-200 dark:hover:bg-gray-500 {isActive(
$page.path,
@@ -87,7 +95,9 @@
{:else if menuItem.path === '/site'}
<SiteSettingsIcon />
{:else if menuItem.path === '/community'}
<UserMultipleIcon class="carbon-icon" />
<ForumIcon class="carbon-icon" />
{:else if menuItem.path === '/quiz'}
<QuizIcon />
{:else if menuItem.path === '/audience'}
<AudienceIcon />
{/if}
@@ -99,7 +109,7 @@
</div>
<span class="flex-grow" />
<ul class="my-5 pb-5 px-4">
<a href={$currentOrgPath} class="text-black">
<a href={$currentOrgPath} class="text-black no-underline">
<li
class="flex items-center py-3 px-4 mb-2 rounded hover:bg-gray-200 dark:hover:bg-gray-500"
>
@@ -107,7 +117,7 @@
<p class="dark:text-white ml-2">Help</p>
</li>
</a>
<a href="{$currentOrgPath}/settings" class="text-black">
<a href="{$currentOrgPath}/settings" class="text-black no-underline">
<li
class="flex items-center py-3 px-4 mb-2 rounded hover:bg-gray-200 dark:hover:bg-gray-500 {isActive(
$page.path,