2024-02-28 03:00:31 +01:00
|
|
|
<script lang="ts">
|
2025-01-04 05:55:14 +01:00
|
|
|
import { goto } from '$app/navigation';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { NewsFeedPage } from '$features/course/pages';
|
2025-11-01 15:49:29 +01:00
|
|
|
import { CourseContainer } from '$lib/components/CourseContainer';
|
2025-12-22 02:36:48 +01:00
|
|
|
import { Button } from '@cio/ui/base/button';
|
|
|
|
|
import * as Page from '@cio/ui/base/page';
|
|
|
|
|
import { RoleBasedSecurity } from '$features/ui';
|
2024-05-19 18:55:28 +01:00
|
|
|
import { currentOrg } from '$lib/utils/store/org';
|
2025-01-04 05:55:14 +01:00
|
|
|
import { profile } from '$lib/utils/store/user';
|
2025-12-22 02:36:48 +01:00
|
|
|
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
|
|
|
|
2025-12-02 09:54:38 +01:00
|
|
|
function getPageRoles(org: AccountOrg) {
|
2024-05-21 00:14:47 +01:00
|
|
|
const roles: number[] = [1, 2];
|
2024-05-19 18:55:28 +01:00
|
|
|
|
|
|
|
|
if (org.customization.course.newsfeed) {
|
2024-05-25 05:50:14 +01:00
|
|
|
roles.push(3);
|
2024-05-19 18:55:28 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return roles;
|
|
|
|
|
}
|
2023-08-02 19:35:27 +01:00
|
|
|
</script>
|
|
|
|
|
|
2025-12-22 02:36:48 +01:00
|
|
|
<svelte:head>
|
|
|
|
|
<title>News Feed - ClassroomIO</title>
|
|
|
|
|
</svelte:head>
|
|
|
|
|
|
2025-11-01 15:49:29 +01:00
|
|
|
<CourseContainer courseId={data.courseId}>
|
2024-05-19 18:55:28 +01:00
|
|
|
<RoleBasedSecurity
|
|
|
|
|
allowedRoles={getPageRoles($currentOrg)}
|
|
|
|
|
onDenied={() => {
|
|
|
|
|
goto(`/courses/${data.courseId}/lessons?next=true`);
|
|
|
|
|
}}
|
|
|
|
|
>
|
2025-12-22 02:36:48 +01:00
|
|
|
<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}
|
2025-12-22 02:36:48 +01:00
|
|
|
</Page.Body>
|
2024-05-18 21:40:24 +01:00
|
|
|
</RoleBasedSecurity>
|
|
|
|
|
</CourseContainer>
|