feat: course types - self paced and live class (#309)
* working on the course type * trying to mark it persist * almost done here * fixed sendig emtpy options bug * created migration file * created migration file * made updates based on PR review * merge * update course type card * add redirect logic with classroomio.com/new * make new course modal only open/close with url * feat: page active state (#315) * finished the active link state * updated the active link state based on review * simplify code --------- Co-authored-by: Rotimi Best <best@classroomio.com> * add type to course card --------- Co-authored-by: Rotimi Best <best@classroomio.com>
This commit is contained in:
@@ -6,24 +6,18 @@
|
||||
import { fetchCourses } from '$lib/components/Courses/api';
|
||||
import { profile } from '$lib/utils/store/user';
|
||||
import { currentOrg } from '$lib/utils/store/org';
|
||||
import { courses, courseMetaDeta, coursesComplete } from '$lib/components/Courses/store';
|
||||
import {
|
||||
courses,
|
||||
courseMetaDeta,
|
||||
coursesComplete,
|
||||
coursesInProgress
|
||||
} from '$lib/components/Courses/store';
|
||||
import { browser } from '$app/environment';
|
||||
import { t } from '$lib/utils/functions/translations';
|
||||
|
||||
const tabs = [
|
||||
{
|
||||
label: $t('my_learning.progress'),
|
||||
value: 1
|
||||
},
|
||||
{
|
||||
label: $t('my_learning.complete'),
|
||||
value: 2
|
||||
}
|
||||
];
|
||||
let currentTab = tabs[0].value;
|
||||
let hasFetched = false;
|
||||
|
||||
function onChange(tab: 0) {
|
||||
function onChange(tab) {
|
||||
return () => (currentTab = tab);
|
||||
}
|
||||
|
||||
@@ -51,6 +45,18 @@
|
||||
$: if (browser && $profile.id && $currentOrg.id) {
|
||||
getCourses($profile.id, $currentOrg.id);
|
||||
}
|
||||
|
||||
$: tabs = [
|
||||
{
|
||||
label: `${$t('my_learning.progress')} (${$coursesInProgress.length})`,
|
||||
value: '1'
|
||||
},
|
||||
{
|
||||
label: `${$t('my_learning.complete')} (${$coursesComplete.length})`,
|
||||
value: '2'
|
||||
}
|
||||
];
|
||||
$: currentTab = tabs[0].value;
|
||||
</script>
|
||||
|
||||
<section class="max-w-6xl mx-auto">
|
||||
@@ -63,7 +69,7 @@
|
||||
<slot:fragment slot="content">
|
||||
<TabContent value={tabs[0].value} index={currentTab}>
|
||||
<Courses
|
||||
courses={$courses}
|
||||
courses={$coursesInProgress}
|
||||
emptyTitle={$t('my_learning.not_in_progress')}
|
||||
emptyDescription={$t('my_learning.any_progress')}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user