feat: add icon to create a new lesson from side nav (#145)

* feat: classroomio-issue-143

* issue 143: remove bg-color from the add icon

* fix: hide the + icon for student

---------

Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
Adeyemi Adetunji
2024-02-01 20:18:03 +01:00
committed by GitHub
co-authored by Rotimi Best
parent 67db904dae
commit cadfa81913
28 changed files with 123 additions and 100 deletions
@@ -18,7 +18,6 @@
import Select from '$lib/components/Form/Select.svelte';
import { updateLesson } from '$lib/utils/services/courses';
import CourseContainer from '$lib/components/CourseContainer/index.svelte';
import { profile } from '$lib/utils/store/user';
import type { Lesson } from '$lib/utils/types';
import {
lessons,
@@ -32,13 +31,13 @@
import AddLessonModal from '$lib/components/Course/components/Lesson/AddLessonModal.svelte';
import DateField from '$lib/components/Form/Date.svelte';
import DeleteLessonConfirmation from '$lib/components/Course/components/Lesson/DeleteLessonConfirmation.svelte';
import { handleAddLessonWidget } from '$lib/components/Course/components/Navigation/store.js';
export let data;
let lessonEditing: string | undefined;
let lessonToDelete: Lesson | undefined;
let isStudent = true;
let openModal = false;
let openDeleteModal = false;
const flipDurationMs = 300;
@@ -55,7 +54,7 @@
}
function addLesson() {
openModal = true;
$handleAddLessonWidget.open = true;
}
function handleDndConsider(e: any) {
@@ -88,17 +87,11 @@
return index + 1;
}
}
$: {
const user = $group.people.find((person) => person.profile_id === $profile.id);
if (user) {
isStudent = user.role_id === 3;
}
}
</script>
<AddLessonModal {isStudent} bind:openModal />
{#if $handleAddLessonWidget}
<AddLessonModal {isStudent} />
{/if}
<DeleteLessonConfirmation
bind:openDeleteModal
@@ -106,6 +99,7 @@
deleteLesson={() => handleDelete(lessonToDelete?.id)}
/>
<!-- TODO: Refactor usage of two way binding isStudent, rather use $globalStore.isStudent -->
<CourseContainer bind:isStudent bind:courseId={data.courseId}>
<PageNav title="Lessons">
<div slot="widget">