diff --git a/src/components/Course/components/Lesson/Exercise/MarkExerciseModal.svelte b/src/components/Course/components/Lesson/Exercise/MarkExerciseModal.svelte index df496d55..49e775c9 100644 --- a/src/components/Course/components/Lesson/Exercise/MarkExerciseModal.svelte +++ b/src/components/Course/components/Lesson/Exercise/MarkExerciseModal.svelte @@ -1,11 +1,17 @@ @@ -49,7 +65,13 @@ />
-
+ {#each options as option} - {/each} + + diff --git a/src/components/PageBody/index.svelte b/src/components/PageBody/index.svelte index d19a0e08..f5a1870e 100644 --- a/src/components/PageBody/index.svelte +++ b/src/components/PageBody/index.svelte @@ -8,7 +8,7 @@
{#if $$slots.header}
diff --git a/src/components/Snackbar/index.svelte b/src/components/Snackbar/index.svelte index 5af5adbb..ff5e5e13 100644 --- a/src/components/Snackbar/index.svelte +++ b/src/components/Snackbar/index.svelte @@ -36,8 +36,8 @@ {#if $snackbarStore.open}
{#if $snackbarStore.severity === SNACKBAR_SEVERITY.SUCCESS} @@ -64,5 +64,6 @@ min-width: 288px; padding: 6px 16px; flex-wrap: wrap; + z-index: 51; } diff --git a/src/routes/_layout.svelte b/src/routes/_layout.svelte index 27a8c3c0..1d9a69c3 100644 --- a/src/routes/_layout.svelte +++ b/src/routes/_layout.svelte @@ -96,7 +96,7 @@ allowUser = true; } else if (!_isMvpUser) { if (!!path) { - goto('/'); + goto('/courses'); } return; @@ -113,7 +113,7 @@ getProfile(); } else { console.log('not logged in, go to login'); - return goto('/'); + return goto('/courses'); } } ); diff --git a/src/routes/api/_db.js b/src/routes/api/_db.js index 1c102e73..a52705a1 100644 --- a/src/routes/api/_db.js +++ b/src/routes/api/_db.js @@ -1,4 +1,3 @@ -import { STATUS } from '../../utils/constants/answers'; import { QUESTION_TYPE } from '../../components/Question/constants'; const ROLE = { @@ -349,7 +348,7 @@ const exercise_answers = [ currentQuestionIndex: 0, isFinished: false, progressValue: 100, - status: STATUS.PENDING, + status: 'STATUS.PENDING', }, ]; diff --git a/src/routes/courses/[id]/people.svelte b/src/routes/courses/[id]/people.svelte index a57504fd..bf200c71 100644 --- a/src/routes/courses/[id]/people.svelte +++ b/src/routes/courses/[id]/people.svelte @@ -2,6 +2,7 @@ import { fetchCourse, deleteGroupMember, + updatedGroupMember, } from '../../../utils/services/courses'; export async function preload({ params }) { @@ -15,6 +16,8 @@ import Delete24 from 'carbon-icons-svelte/lib/Delete24'; import PageNav from '../../../components/PageNav/index.svelte'; import PrimaryButton from '../../../components/PrimaryButton/index.svelte'; + import TextField from '../../../components/Form/TextField.svelte'; + import Select from '../../../components/Form/Select.svelte'; import IconButton from '../../../components/IconButton/index.svelte'; import PageBody from '../../../components/PageBody/index.svelte'; import { @@ -28,8 +31,11 @@ invitationModal, deleteMemberModal, } from '../../../components/Course/components/People/store'; - import type { Person } from '../../../components/Course/components/People/types'; - import { ROLE, ROLE_LABEL } from '../../../utils/constants/roles'; + import type { + Person, + ProfileRole, + } from '../../../components/Course/components/People/types'; + import { ROLE_LABEL, ROLES } from '../../../utils/constants/roles'; import { profile } from '../../../utils/store/user'; export let courseId: string = ''; @@ -37,6 +43,8 @@ let people: Array = []; let borderBottomGrey = 'border-r-0 border-b border-l-0 border-gray-300'; let member: { id?: string; email?: string; profile?: { email: string } } = {}; + let shouldEditMemberId = false; + let filterBy: ProfileRole = ROLES[0]; // function setPeople(people: Array) { // if (!Array.isArray(people)) return; @@ -55,13 +63,32 @@ await deleteGroupMember(member.id); } + async function editMemberId(person: Person) { + console.log(`person`, person); + await updatedGroupMember( + { assigned_student_id: person.assigned_student_id }, + { id: person.id } + ); + shouldEditMemberId = false; + } + + function sortAndFilterPeople(_people: Array, filterBy: ProfileRole) { + people = (_people || []) + .filter((person) => { + if (filterBy.value === 'all') return true; + + return person.role_id === filterBy.value; + }) + .sort((a: Person, b: Person) => a.role_id - b.role_id); + } + onMount(async () => { if ($course.id) return; const { data } = await fetchCourse(courseId); setCourseData(data); }); - $: people = ($group.people || []).sort((a, b) => a.role_id - b.role_id); + $: sortAndFilterPeople($group.people, filterBy); @@ -81,49 +108,74 @@ -
+
+