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

60 lines
1.7 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';
2025-11-01 15:49:29 +01:00
import { CourseContainer } from '$lib/components/CourseContainer';
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 { profile } from '$lib/utils/store/user';
import { t } from '$lib/utils/functions/translations';
import { getGreeting } from '$lib/utils/functions/date.js';
import type { AccountOrg } from '$features/app/types';
import { isNewFeedModal } from '$lib/components/Course/components/NewsFeed/store';
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>
<svelte:head>
<title>News Feed - ClassroomIO</title>
</svelte:head>
2025-11-01 15:49:29 +01:00
<CourseContainer courseId={data.courseId}>
<RoleBasedSecurity
allowedRoles={getPageRoles($currentOrg)}
onDenied={() => {
goto(`/courses/${data.courseId}/lessons?next=true`);
}}
>
<Page.Header>
<Page.HeaderContent>
<Page.Title>
{$t(getGreeting())}
{$profile.fullname}!
</Page.Title>
</Page.HeaderContent>
<Page.Action>
<Button class="mr-2" onclick={() => ($isNewFeedModal.open = true)}>
{$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>
2024-05-18 21:40:24 +01:00
</RoleBasedSecurity>
</CourseContainer>