Files
classroomio/apps/dashboard/src/routes/courses/[id]/+page.svelte
T

52 lines
1.4 KiB
Svelte
Raw Normal View History

2024-02-28 03:00:31 +01:00
<script lang="ts">
import { goto } from '$app/navigation';
import { NewsFeedPage } from '$features/course/pages';
import { Button } from '@cio/ui/base/button';
import * as Page from '@cio/ui/base/page';
import { RoleBasedSecurity } from '$features/ui';
import { currentOrg } from '$lib/utils/store/org';
import { t } from '$lib/utils/functions/translations';
import type { AccountOrg } from '$features/app/types';
2026-03-09 11:18:22 +01:00
import { newsfeedApi } from '$features/course/api';
2024-04-19 05:45:48 +01:00
2025-11-01 15:49:29 +01:00
let { data = $bindable() } = $props();
2024-02-28 03:00:31 +01:00
function getPageRoles(org: AccountOrg) {
const roles: number[] = [1, 2];
if (org.customization.course.newsfeed) {
roles.push(3);
}
return roles;
}
</script>
2026-03-09 11:18:22 +01:00
<RoleBasedSecurity
allowedRoles={getPageRoles($currentOrg)}
onDenied={() => {
goto(`/courses/${data.courseId}/lessons?next=true`);
}}
>
<Page.Root class="mx-auto flex w-[90%] px-4 md:max-w-2xl lg:max-w-3xl">
<Page.Header>
<Page.HeaderContent>
<Page.Title>
2026-03-09 11:18:22 +01:00
{$t('course.navItem.news_feed.heading')}
</Page.Title>
</Page.HeaderContent>
<Page.Action>
2026-03-09 11:18:22 +01:00
<Button class="mr-2" onclick={() => newsfeedApi.openNewFeedModal()}>
{$t('course.navItem.news_feed.heading_button.title')}
</Button>
</Page.Action>
</Page.Header>
<Page.Body>
{#snippet child()}
<NewsFeedPage courseId={data.courseId} />
2025-11-01 15:49:29 +01:00
{/snippet}
</Page.Body>
2026-03-09 11:18:22 +01:00
</Page.Root>
</RoleBasedSecurity>