Files
classroomio/src/routes/courses/[id]/people.svelte
T

72 lines
1.7 KiB
Svelte
Raw Normal View History

<script context="module">
2021-08-18 19:47:02 +03:00
import { fetchCourse } from '../../../utils/services/courses';
2021-08-18 19:47:02 +03:00
export async function preload({ params }, session) {
if (process.browser) {
return {};
2021-07-13 16:27:02 +00:00
}
2021-08-18 19:47:02 +03:00
const {
data,
// error
} = await fetchCourse(params.id, session);
return { courseData: data };
}
</script>
<script>
2021-08-18 19:47:02 +03:00
import { onMount } from 'svelte';
import { stores } from '@sapper/app';
import CourseContainer from '../../../components/CourseContainer/index.svelte';
import PageNav from '../../../components/PageNav/index.svelte';
import UserCard from '../../../components/UserCard/index.svelte';
import { setCourseData } from '../../../components/Course/store';
2021-07-13 16:27:02 +00:00
export let courseData = {};
const { page } = stores();
2021-08-18 19:47:02 +03:00
const teachers = [];
const students = [...teachers, ...teachers, ...teachers];
2021-08-18 19:47:02 +03:00
onMount(() => {
setCourseData(courseData);
});
</script>
2021-08-18 19:47:02 +03:00
<CourseContainer>
<PageNav title="People" disableSticky={true} />
<div class="m-3">
<h3>
<a id="teachers" name="teachers" href="{$page.path}#teachers">Teachers</a>
</h3>
<div class="flex flex-wrap">
{#each teachers as teacher}
<UserCard
name={teacher.name}
avatarUrl={teacher.avatar}
title={teacher.title}
telegramLink={teacher.telegramLink}
mailLink={teacher.mailLink}
/>
{/each}
</div>
</div>
<div class="m-3">
<h3>
<a id="students" name="students" href="{$page.path}#students">Students</a>
</h3>
<div class="flex flex-wrap">
{#each students as student}
<UserCard
name={student.name}
avatarUrl={student.avatar}
title={student.title}
/>
{/each}
</div>
</div>
</CourseContainer>