2021-07-12 05:55:57 +03:00
|
|
|
<script context="module">
|
|
|
|
|
export async function preload({ params }) {
|
2021-07-13 16:27:02 +00:00
|
|
|
let [courseId] = params.id;
|
2021-07-12 05:55:57 +03:00
|
|
|
|
2021-07-13 16:27:02 +00:00
|
|
|
const res = await this.fetch(`api/course?id=${courseId}`);
|
|
|
|
|
const data = await res.json();
|
|
|
|
|
|
|
|
|
|
if (res.status === 200) {
|
|
|
|
|
return { courseId, courseData: data };
|
|
|
|
|
} else {
|
|
|
|
|
this.error(res.status, data.message);
|
|
|
|
|
}
|
2021-07-12 05:55:57 +03:00
|
|
|
}
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-07-13 16:27:02 +00:00
|
|
|
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";
|
|
|
|
|
|
|
|
|
|
export let courseData = {};
|
2021-07-12 05:55:57 +03:00
|
|
|
|
|
|
|
|
const { page } = stores();
|
|
|
|
|
|
2021-07-13 16:27:02 +00:00
|
|
|
const teachers = courseData.people;
|
2021-07-12 05:55:57 +03:00
|
|
|
const students = [...teachers, ...teachers, ...teachers];
|
|
|
|
|
</script>
|
|
|
|
|
|
2021-07-13 16:27:02 +00:00
|
|
|
<CourseContainer {courseData}>
|
2021-07-12 05:55:57 +03:00
|
|
|
<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>
|