feat: organisation home page with analytics (#532)

This commit is contained in:
Rotimi Best
2024-12-31 17:04:07 +01:00
committed by GitHub
parent 445c21dbcb
commit c68bfb62b5
17 changed files with 554 additions and 440 deletions
@@ -0,0 +1,103 @@
import { getServerSupabase } from '$lib/utils/functions/supabase.server';
import { OrganisationAnalytics } from '$lib/utils/types/analytics';
import { json } from '@sveltejs/kit';
const supabase = getServerSupabase();
const CACHE_DURATION = 60 * 5; // 5 minutes
export async function POST({ setHeaders, request }) {
const { orgId } = await request.json();
const accessToken = request.headers.get('Authorization');
if (!orgId || !accessToken) {
return json({ success: false, message: 'Request is missing required fields' }, { status: 400 });
}
let user;
try {
const { data } = await supabase.auth.getUser(accessToken);
user = data.user;
} catch (error) {
console.error(error);
}
if (!user) {
return json({ success: false, message: 'Unauthenticated user' }, { status: 401 });
}
setHeaders({
'cache-control': `max-age=${CACHE_DURATION}`,
'content-type': 'application/json'
});
try {
const analytics = await getOrganisationAnalytics(orgId);
return json(analytics, { status: 200 });
} catch (error) {
return json({ error: 'Something went wrong' }, { status: 500 });
}
}
async function getOrganisationAnalytics(orgId: string): Promise<OrganisationAnalytics> {
const analytics: OrganisationAnalytics = {
revenue: 0,
numberOfCourses: 0,
totalStudents: 0,
topCourses: [],
enrollments: []
};
// Run all queries in parallel
const [statsResult, topCoursesResult, enrollmentsResult] = await Promise.all([
supabase.from('dash_org_stats').select('*').eq('org_id', orgId).single(),
supabase
.rpc('get_dash_org_top_courses', {
org_id_arg: orgId
})
.order('completion_percentage', { ascending: false }),
supabase.rpc('get_dash_org_recent_enrollments', {
org_id_arg: orgId
})
]);
// Check for errors
if (statsResult.error) {
console.error(statsResult.error);
throw new Error('Failed to fetch organisation analytics');
}
if (topCoursesResult.error) {
console.error(topCoursesResult.error);
throw new Error('Failed to fetch top courses');
}
if (enrollmentsResult.error) {
console.error(enrollmentsResult.error);
throw new Error('Failed to fetch enrollments');
}
// Set analytics data
analytics.revenue = 0; // Hardcode until we implement payment
analytics.numberOfCourses = statsResult.data.no_of_courses;
analytics.totalStudents = statsResult.data.enrolled_students;
analytics.topCourses = topCoursesResult.data.map((course) => ({
id: course.course_id,
title: course.course_title,
enrollments: course.total_students,
completion: course.completion_percentage
}));
analytics.enrollments = enrollmentsResult.data.map((enrollment) => ({
id: enrollment.profile_id,
avatarUrl: enrollment.avatar_url,
name: enrollment.fullname,
courseId: enrollment.course_id,
course: enrollment.course_title,
date: enrollment.enrolled_at
}));
return analytics;
}
+24 -24
View File
@@ -1,16 +1,16 @@
<script lang="ts">
import Learning from '$lib/components/LMS/components/Learning.svelte';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import { goto } from '$app/navigation';
import { profile } from '$lib/utils/store/user';
import { currentOrg } from '$lib/utils/store/org';
import { fetchCourses } from '$lib/utils/services/courses';
import { courses, courseMetaDeta } from '$lib/components/Courses/store';
import type { Course } from '$lib/utils/types';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
import { courseMetaDeta, courses } from '$lib/components/Courses/store';
import Learning from '$lib/components/LMS/components/Learning.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import { getGreeting } from '$lib/utils/functions/date';
import { t } from '$lib/utils/functions/translations';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
import { fetchCourses } from '$lib/utils/services/courses';
import { currentOrg } from '$lib/utils/store/org';
import { profile } from '$lib/utils/store/user';
import type { Course } from '$lib/utils/types';
let hasFetched = false;
let progressPercentage = 0;
@@ -51,10 +51,10 @@
<title>Student Dashboard - ClassroomIO</title>
</svelte:head>
<section class="max-w-6xl gap-5 mx-auto">
<section class="mx-auto max-w-6xl gap-5">
<div class="m-5">
<div class="flex items-center justify-between mb-10">
<h1 class="dark:text-white text-2xl md:text-3xl font-bold">
<div class="mb-10 flex items-center justify-between">
<h1 class="text-2xl font-bold dark:text-white md:text-3xl">
{$t(getGreeting())}
{$profile.fullname}!
</h1>
@@ -63,10 +63,10 @@
</div>
<div
class="w-full h-fit lg:h-[265px] flex md:items-center justify-between flex-col-reverse md:flex-row p-5 lg:p-10 rounded-md bg-primary-900 my-2"
class="bg-primary-900 my-2 flex h-fit w-full flex-col-reverse justify-between rounded-md p-5 md:flex-row md:items-center lg:h-[265px] lg:p-10"
>
<div class="w-full md:w-[75%] lg:w-[80%]">
<p class=" text-white text-xs lg:text-xl font-normal mb-5">
<p class=" mb-5 text-xs font-normal text-white lg:text-xl">
{$currentOrg.customization.dashboard.bannerText
? $currentOrg.customization.dashboard.bannerText
: $t('dashboard.lms_dashboard_hero')}
@@ -82,28 +82,28 @@
? $currentOrg.customization.dashboard.bannerImage
: '/images/student-learning.svg'}
alt="student Learning Pictogram"
class="w-28 md:block md:w-1/3 lg:w-[275px] lg:h-[205px] mb-3 md:mb-0"
class="mb-3 w-28 md:mb-0 md:block md:w-1/3 lg:h-[205px] lg:w-[275px]"
/>
</div>
<section class="flex w-full flex-col lg:flex-row md:gap-5">
<div class="w-full lg:w-[50%] mt-10 xl:mt-2">
<section class="flex w-full flex-col md:gap-5 lg:flex-row">
<div class="mt-10 w-full lg:w-[50%] xl:mt-2">
<Learning />
</div>
<div class="mt-10 xl:mt-2 w-full lg:w-[50%]">
<p class="text-base font-semibold text-[#040F2D] pb-3 dark:text-white">
<div class="mt-10 w-full lg:w-[50%] xl:mt-2">
<p class="pb-3 text-base font-semibold text-[#040F2D] dark:text-white">
{$t('dashboard.your_progress')}
</p>
<div
class="flex items-center justify-center border border-[#EAEAEA] dark:bg-neutral-800 gap-2 rounded h-fit lg:h-[40vh] lg:overflow-y-auto p-3"
class="flex h-fit items-center justify-center gap-2 rounded border border-[#EAEAEA] p-3 dark:bg-neutral-800 lg:h-[40vh] lg:overflow-y-auto"
>
<div
class="w-full h-full flex flex-col sm:flex-row xl:flex-col items-center justify-between lg:items-center xl:items-start gap-5 lg:justify-around"
class="flex h-full w-full flex-col items-center justify-between gap-5 sm:flex-row lg:items-center lg:justify-around xl:flex-col xl:items-start"
>
<div>
<img src="/images/target.svg" alt="student Learning score" />
</div>
<span class="text-center xl:text-start">
<p class="text-base font-semibold py-2 text-[#040F2D] dark:text-white">
<p class="py-2 text-base font-semibold text-[#040F2D] dark:text-white">
{$t('dashboard.your_progress')}
</p>
{#if totalLessons > 0}
@@ -113,12 +113,12 @@
</p>
{:else}
<p class="text-xs font-normal text-[#656565] dark:text-white">
{$t('dashboard.No_courses_started')}
{$t('dashboard.no_courses_started')}
</p>
{/if}
</span>
<h1
class="text-5xl lg:text-6xl font-bold text-[#262626] dark:text-white my-0 whitespace-nowrap"
class="my-0 whitespace-nowrap text-5xl font-bold text-[#262626] dark:text-white lg:text-6xl"
>
{progressPercentage} %
</h1>
+183 -320
View File
@@ -1,182 +1,96 @@
<script lang="ts">
import { goto } from '$app/navigation';
import { ActivityCard } from '$lib/components/Analytics';
import CourseIcon from '$lib/components/Icons/CourseIcon.svelte';
import Progress from '$lib/components/Progress/index.svelte';
import UserProfile from 'carbon-icons-svelte/lib/UserProfile.svelte';
import { snackbar } from '$lib/components/Snackbar/store';
import { calDateDiff } from '$lib/utils/functions/date';
import { getAccessToken } from '$lib/utils/functions/supabase';
import { currentOrg } from '$lib/utils/store/org';
import { profile } from '$lib/utils/store/user';
import { Add } from 'carbon-icons-svelte';
import LockedIcon from 'carbon-icons-svelte/lib/Locked.svelte';
import UnlockedIcon from 'carbon-icons-svelte/lib/Unlocked.svelte';
import { onMount } from 'svelte';
import { Datepicker, InlineCalendar } from 'svelte-calendar';
// import { supabase } from '$lib/utils/functions/supabase';
// import Avatar from '$lib/components/Avatar/index.svelte';
import type { OrganisationAnalytics } from '$lib/utils/types/analytics';
import Add from 'carbon-icons-svelte/lib/Add.svelte';
import Book from 'carbon-icons-svelte/lib/Book.svelte';
import CurrencyDollar from 'carbon-icons-svelte/lib/CurrencyDollar.svelte';
import UserMultiple from 'carbon-icons-svelte/lib/UserMultiple.svelte';
import Avatar from '$lib/components/Avatar/index.svelte';
import VisitOrgSiteButton from '$lib/components/Buttons/VisitOrgSite.svelte';
import { VARIANTS } from '$lib/components/PrimaryButton/constants';
import PrimaryButton from '$lib/components/PrimaryButton/index.svelte';
import WelcomeModal from '$lib/components/WelcomeModal/WelcomeModal.svelte';
import { getGreeting } from '$lib/utils/functions/date';
import { formatDate, formatUserUpcomingData } from '$lib/utils/functions/routes/dashboard';
import { t } from '$lib/utils/functions/translations';
import { fetchUserUpcomingData } from '$lib/utils/services/dashboard';
import { globalStore } from '$lib/utils/store/app';
import { currentOrg, currentOrgPath, isOrgAdmin, userUpcomingData } from '$lib/utils/store/org';
import { isOrgAdmin } from '$lib/utils/store/org';
import { isMobile } from '$lib/utils/store/useMobile';
import { user } from '$lib/utils/store/user';
import type { LessonsByMonthIndexType, UserLessonDataType } from '$lib/utils/types';
import { Grid, Link, SkeletonPlaceholder } from 'carbon-components-svelte';
export let data;
const { orgName } = data;
let theme = {};
let store;
let calendar: HTMLElement | null = null;
let lessonsByMonth: LessonsByMonthIndexType = {};
let prevSelectedDate: string = new Date().toUTCString();
let selectedDateLessonData: UserLessonDataType[] | [] = [];
const boxes = [
{
label: 'Revenue (NGN)',
value: '0.00'
},
{
label: 'Number of sales',
value: 0
},
{
label: 'Number of courses',
value: 0
},
{
label: 'Total students',
value: 0
}
];
let dashAnalytics: OrganisationAnalytics;
function createCourse() {
goto(`/org/${orgName}/courses?create=true`);
}
function publishCourse() {
goto(`/org/${orgName}/courses`);
}
const addDotsToCalendar = (currentMonthIndexInRenderedMonth: number) =>
setTimeout(() => {
if (!calendar) calendar = document.getElementById('calendar');
// console.log(
// `currentMonthIndexInRenderedMonth`,
// currentMonthIndexInRenderedMonth
// );
async function fetchDashAnalytics(orgId: string) {
if (!orgId) return;
const renderedMonths =
calendar?.querySelectorAll('.contents .container .stage .grid .grid') || [];
// console.log(`renderedMonths`, renderedMonths);
const currentMonthIndex = new Date($store?.selected).getMonth();
const currentMonth = renderedMonths[currentMonthIndexInRenderedMonth];
// console.log(`currentMonth`, currentMonth);
// All elements for each day in the month - with prev or next month
const currentMonthElements =
currentMonth?.querySelectorAll<HTMLElement>('a:not(.outsider)') || [];
// console.log(`currentMonthElements`, currentMonthElements, '\n\n');
const currentMonthData = lessonsByMonth[currentMonthIndex];
if (!currentMonthData) return;
const accessToken = await getAccessToken();
for (let i in currentMonthElements) {
if (!currentMonthElements.hasOwnProperty(i)) {
continue;
}
try {
const response = await fetch('/api/analytics/dash', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: accessToken
},
body: JSON.stringify({ orgId })
});
const dayElement = currentMonthElements[i];
dayElement.style.position = 'relative';
// The date is inside the element like <a>2</a>
const dateIndex = Number(dayElement.innerHTML);
if (!!currentMonthData[dateIndex]) {
// console.log(`dateIndex`, dateIndex);
// console.log(`lesson data`, currentMonthData[dateIndex]);
dayElement.insertAdjacentHTML('beforeend', '<span class="active-day">•</span>');
}
if (!response.ok) {
console.error(response);
throw new Error('Failed to fetch analytics data');
}
}, 500);
async function runFirstThings(currentSession: { id: string } | null, orgId: string) {
if (!currentSession || !currentSession.id || !orgId) return;
if (!$userUpcomingData.length) {
$userUpcomingData = await fetchUserUpcomingData(currentSession.id, orgId);
}
lessonsByMonth = formatUserUpcomingData($userUpcomingData);
// Only for desktop. Only run on mobile when the user clicks on the date
if (!$isMobile) {
addDotsToCalendar(1);
dashAnalytics = (await response.json()) as OrganisationAnalytics;
} catch (error) {
snackbar.error('Failed to fetch analytics data');
}
}
function getDataOfSelectedDate(_selectedDate: string, orgId: string): UserLessonDataType[] | [] {
if (!_selectedDate) return [];
$: fetchDashAnalytics($currentOrg.id);
const selectedDate = new Date(_selectedDate).toUTCString();
const monthIndex = new Date(selectedDate).getMonth();
const dateIndex = new Date(selectedDate).getDate();
// If we changed the month, update the calendar dots
const prevMonthIndex = new Date(prevSelectedDate).getMonth();
if (prevMonthIndex !== monthIndex) {
const currentMonthIndexInRenderedMonth = monthIndex < prevMonthIndex ? 1 : 2;
addDotsToCalendar(currentMonthIndexInRenderedMonth);
$: cards = [
{
icon: CurrencyDollar,
title: `${$t('dashboard.revenue')} ($)`,
percentage: dashAnalytics?.revenue ?? 0,
description: $t('dashboard.revenue_description'),
hidePercentage: true
},
{
icon: Book,
title: $t('dashboard.no_of_courses'),
percentage: dashAnalytics?.numberOfCourses ?? 0,
description: $t('dashboard.no_courses_description'),
hidePercentage: true
},
{
icon: UserMultiple,
title: $t('dashboard.total_students'),
percentage: dashAnalytics?.totalStudents ?? 0,
description: $t('dashboard.total_students_description'),
hidePercentage: true
}
prevSelectedDate = selectedDate;
const monthLessonData = lessonsByMonth[monthIndex];
if (!monthLessonData) {
return [];
}
const dateLessonData = monthLessonData[dateIndex];
if (!dateLessonData) {
return [];
}
return dateLessonData;
}
onMount(() => {
// Remove default shouldEnlargeDay=true when <DatePicker /> on mobile
if ($store && $store.shouldEnlargeDay) {
$store.shouldEnlargeDay = false;
}
});
// This is here not called onMount because we want to call it as soon as we have the user's `currentSession` value
$: runFirstThings($user.currentSession, $currentOrg.id);
// Every time the date changes
$: selectedDateLessonData = getDataOfSelectedDate($store?.selected, $currentOrg.id);
$: theme = {
calendar: {
width: '250px',
height: '283px',
shadow: '0px 0px 5px rgba(0, 0, 0, 0.25)',
legend: {
height: '30px'
},
colors: {
text: {
primary: $globalStore.isDark ? '#eee' : '#333',
highlight: '#fff'
},
background: {
primary: $globalStore.isDark ? '#333' : '#fff',
highlight: $globalStore.isDark ? '#5829d6' : '#eb7400',
hover: $globalStore.isDark ? '#222' : '#eee'
},
border: $globalStore.isDark ? '#222' : '#eee'
}
}
};
];
</script>
<svelte:head>
@@ -186,7 +100,7 @@
<WelcomeModal />
<div class="w-full max-w-5xl px-5 py-10 md:mx-auto">
<div class="mb-10 flex items-center justify-between">
<div class="mb-5 flex items-center justify-between">
<h1 class="mb-3 text-2xl font-bold dark:text-white md:text-3xl">
{$t(getGreeting())}
{$profile.fullname}!
@@ -209,194 +123,143 @@
</div>
</div>
<div
class="bg-primary-900 my-2 flex h-fit w-full flex-col-reverse justify-between rounded-md p-5 md:flex-row md:items-center lg:h-[265px] lg:p-10"
>
<span>
<p class="mb-5 w-full text-xs font-normal text-white md:w-[75%] lg:w-[80%] lg:text-xl">
{$t('dashboard.hero_content')}
</p>
<PrimaryButton
label={$t('dashboard.hero_button')}
variant={VARIANTS.CONTAINED_WHITE}
onClick={() => goto(`${$currentOrgPath}/courses`)}
/>
</span>
<img
src="/images/student-learning.svg"
alt="student Learning Pictogram"
class="mb-3 w-28 md:mb-0 md:block md:w-1/3 lg:max-h-[205px] lg:w-[200px]"
/>
<div class="mb-10 flex flex-wrap items-start">
<Grid class="px-0" fullWidth>
<div class="mt-8 grid grid-cols-1 gap-6 md:grid-cols-2 lg:grid-cols-3">
{#each cards as card}
{#if !dashAnalytics}
<SkeletonPlaceholder
style="width: 100%; min-width: 300px; height: 10rem;"
class="rounded-md"
/>
{:else}
<ActivityCard activity={card} />
{/if}
{/each}
</div>
</Grid>
</div>
<!-- <div class="flex items-start flex-wrap">
{#each boxes as box}
<div
class="w-full md:w-[246px] h-[165px] flex flex-col rounded border border-gray-200 dark:border-neutral-600 justify-center px-5 md:mr-5 mb-5"
>
<p class="dark:text-white mb-2 text-sm">{box.label}</p>
<p class="dark:text-white text-xl font-bold">{box.value}</p>
</div>
{/each}
</div> -->
<div class="grid grid-cols-1 gap-4 lg:grid-cols-2">
<div
class="flex min-h-[45vh] w-full flex-col rounded-md border p-3 dark:border-neutral-600 md:p-5"
>
<h3 class="mt-0 text-2xl font-bold">
{$t('dashboard.top_courses')}
</h3>
<div class="w-full">
<!-- Your Schedule -->
<div class="container w-full xl:w-auto">
<p class="mb-4 mt-7 font-bold dark:text-white">{$t('dashboard.your_schedule')}</p>
<div
class="flex w-full flex-col items-start gap-3 rounded border border-gray-200 px-2 py-5 dark:border-neutral-600 md:flex-row md:px-5"
>
{#if !$isMobile}
<div id="calendar" class="mt-5 flex w-2/5 min-w-[250px] justify-center">
<InlineCalendar bind:store {theme} />
</div>
<div class="h-full space-y-6">
{#if !dashAnalytics}
{#each Array(5) as _}
<SkeletonPlaceholder style="width: 100%; height: 40px;" class="rounded-md" />
{/each}
{:else}
<div class="header flex w-full items-center">
<Datepicker bind:store let:key let:send let:receive>
<button
class="text-primary-700 rounded-md p-3 text-lg font-bold hover:bg-gray-300"
in:receive|local={{ key }}
out:send|local={{ key }}
on:click={() => {
addDotsToCalendar(1);
}}
>
{formatDate($store?.selected)}
</button>
</Datepicker>
</div>
{/if}
<div class="max-h-[400px] w-full overflow-y-scroll">
{#if !$isMobile}
<p class="m-5 font-bold dark:text-white">
{formatDate($store?.selected)}
</p>
{/if}
{#each selectedDateLessonData as lessonData}
<div class="lesson-data flex items-center justify-between p-5">
<div class="w-full">
<a
class="text-black-700 flex items-center text-lg font-bold"
href={`/courses/${lessonData.course_id}/lessons/${
lessonData.is_unlocked ? lessonData.lesson_id : ''
}`}
>
{lessonData.lesson_title}
{#if lessonData.is_unlocked}
<span class="success ml-2">
<LockedIcon class="carbon-icon dark:text-white" />
</span>
{:else}
<UnlockedIcon class="carbon-icon dark:text-white" />
{/if}
</a>
<p class="text-grey flex items-center text-sm dark:text-white">
<a class="text-primary-700 my-2 underline" href="/courses/{lessonData.course_id}">
{` ${lessonData.course_title}`}
</a>
{#each dashAnalytics.topCourses as course}
<div class="flex items-center">
<div class="space-y-1">
<Link href={`/courses/${course.id}`}>
<p class="text-sm font-medium leading-none">{course.title}</p>
</Link>
<p class="text-muted-foreground text-sm">
{course.enrollments}
{$t('dashboard.students')}
</p>
</div>
{#if lessonData.is_unlocked}
<a
class="join-call bg-primary-600 rounded-3xl py-3 font-bold text-white shadow-lg {!lessonData.call_url &&
'pointer-events-none cursor-not-allowed opacity-50'}"
href={!!lessonData.call_url ? lessonData.call_url : undefined}
target="_blank"
title={!!lessonData.call_url
? $t('dashboard.click_to_join')
: $t('dashboard.no_call_link')}
>
{$t('dashboard.join_call')}
</a>
{/if}
<div class="ml-auto w-2/6">
<Progress value={course.completion} />
<div class="text-sm font-medium">
{course.completion}%
{$t('dashboard.completion')}
</div>
</div>
</div>
{:else}
<p class="dark:text-white flex items-center justify-center w-full no-data">
{$t('dashboard.no_schedule')}
</p>
<div class="flex flex-col h-full items-center justify-center p-3">
<div class="bg-primary-200 w-fit rounded-full p-4 text-black">
<CourseIcon width="30" height="30" />
</div>
<div class="my-4 text-center">
<p class=" text-xl font-semibold">
{$t('dashboard.create_first_course')}
</p>
<p class="text-sm text-gray-500 dark:text-gray-300">
{$t('dashboard.create_first_course_description')}
</p>
</div>
<PrimaryButton
variant={VARIANTS.OUTLINED}
onClick={createCourse}
label={$t('dashboard.create_course')}
/>
</div>
{/each}
</div>
{/if}
</div>
</div>
<!-- Your Activities -->
<div
class="flex min-h-[45vh] w-full flex-col rounded-md border p-3 dark:border-neutral-600 md:p-5"
>
<h3 class="mt-0 text-2xl font-bold">
{$t('dashboard.recent_enrollments')}
</h3>
<!-- <div class="w-full">
<p class="dark:text-white font-bold mb-7">Your Activities</p>
<div
class="rounded border border-gray-200 dark:border-neutral-600 md:min-w-[450px] activities-box py-4 px-2 md:px-5 w-full"
>
{#each activities as activity}
<div class="flex mb-3 pb-3 border-b border-gray-200 dark:border-neutral-600">
<Avatar src={activity.avatar} name="avatar" />
<div class="ml-2 flex flex-col xl:flex-row">
<div class="mr-2">
<p class="dark:text-white">{activity.name}</p>
<p class="dark:text-white mb-2 mt-1 line-clamp-1">
{activity.description}
</p>
<a href={activity.link}>View</a>
<div class="h-full space-y-6">
{#if !dashAnalytics}
{#each Array(5) as _}
<SkeletonPlaceholder style="width: 100%; height: 40px;" class="rounded-md" />
{/each}
{:else}
{#each dashAnalytics.enrollments as enrollment}
<div class="flex items-center justify-between gap-2">
<div class="flex items-center gap-2">
<Avatar
src={enrollment.avatarUrl}
name={enrollment.name}
width="w-6"
height="h-6"
/>
<div class="min-h-[45px] space-y-1">
<p class="text-md font-medium leading-none">{enrollment.name}</p>
<p class="text-muted-foreground text-sm">
<span class="italic">
{calDateDiff(enrollment.date)}
</span>
</p>
</div>
</div>
<div>
<p class="dark:text-white">{activity.time}</p>
<Link href={`/courses/${enrollment.courseId}`}>
<p class="text-sm font-medium leading-none">
{enrollment.course}
</p>
</Link>
</div>
</div>
</div>
{/each}
{:else}
<div class="flex flex-col h-full items-center justify-center p-3">
<div class="bg-primary-200 w-fit rounded-full p-4 text-black">
<UserProfile size={24} />
</div>
<div class="my-4 text-center">
<p class=" text-xl font-semibold">
{$t('dashboard.publish_first_course')}
</p>
<p class="text-sm text-gray-500 dark:text-gray-300">
{$t('dashboard.publish_first_course_description')}
</p>
</div>
<PrimaryButton
variant={VARIANTS.OUTLINED}
onClick={publishCourse}
label={$t('dashboard.publish_course')}
/>
</div>
{/each}
{/if}
</div>
</div> -->
</div>
</div>
</div>
<style>
.root {
min-height: 93vh;
}
.box {
width: 246px;
height: 165px;
}
.header {
border-bottom: 1px solid var(--border-color);
min-height: 61px;
}
.lesson-data {
border-bottom: 1px solid var(--border-color);
}
.no-data {
height: 100px;
}
.join-call {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
max-height: 48px;
width: 110px;
text-align: center;
}
:global(span.active-day) {
position: absolute;
bottom: -8px;
left: 40%;
color: var(--main-primary-color);
}
:global(#calendar .controls .button.label) {
font-size: 1rem;
}
@media (max-width: 640px) {
:global(span.active-day) {
font-size: 30px;
}
}
</style>