Merge branch 'CLASSROOMIO-T-11' of https://gitlab.com/thenextgreat/classroomio into CLASSROOMIO-T-11

This commit is contained in:
emmanuel
2023-07-27 16:56:49 +01:00
7 changed files with 60 additions and 47 deletions
@@ -12,34 +12,38 @@
import { course } from '../../store'; import { course } from '../../store';
import { currentOrg } from '../../../../utils/store/org'; import { currentOrg } from '../../../../utils/store/org';
const professional = './professional.svg'; const studentNamePlaceholder = 'Name of student';
const plain = './plain.svg';
const student = 'Name of student';
const themes = [ const themes = ['professional', 'plain'];
{ label: 'professional', src: professional },
{ label: 'plain', src: plain },
];
let Selectedtheme = themes[0];
let isSaving = false; let isSaving = false;
const saveCertificate = () => { const saveCertificate = () => {
// set isSaving to true // set isSaving to true
// Validation - make sure description isn't empty // Validation - make sure description isn't empty
/** /**
* Update course description and is_certificate_downloadable (like in src/components/Course/components/Settings/index.svelte) * Update course description, is_certificate_downloadable and certificate_theme (like in src/components/Course/components/Settings/index.svelte)
* *
* await updateCourse($course.id, undefined, { * await updateCourse($course.id, undefined, {
description: $course.description, description: $course.description,
is_certificate_downloadable: $course.is_certificate_downloadable is_certificate_downloadable: $course.is_certificate_downloadable,
certificate_theme: $course.certificate_theme
}); });
* */ * */
// set isSaving to false // set isSaving to false
}; };
</script> </script>
<main class="md:-ml-4 md:-mr-4"> <svelte:head>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Qwitcher+Grypen&family=Roboto:wght@300;400;700&display=swap"
rel="stylesheet"
/>
</svelte:head>
<main class="md:-ml-4 md:-mr-4 px-2">
<div <div
class="flex-1 flex flex-col md:flex-row justify-between gap-3 w-full mb-3 h-4/5" class="flex-1 flex flex-col md:flex-row justify-between gap-3 w-full mb-3 h-4/5"
> >
@@ -48,20 +52,16 @@
>Certificate settings</strong >Certificate settings</strong
> >
<p class="text-xs font-normal my-4">Choose a theme</p> <p class="text-xs font-normal my-4">Choose a theme</p>
<RadioButtonGroup bind:selected={Selectedtheme} class="mb-10"> <RadioButtonGroup bind:selected={$course.certificate_theme} class="mb-10">
{#each themes as value} {#each themes as theme}
<div class="flex mr-3"> <div class="flex mr-3">
<RadioButton {value} size="sm" /> <RadioButton value={theme} size="sm" />
<img src={value.src} alt="themes" /> <img src={`./${theme}.svg`} alt="themes" />
</div> </div>
{/each} {/each}
</RadioButtonGroup> </RadioButtonGroup>
<div> <div>
<p class="text-xs font-normal text-black my-2">Brand Logo</p> <p class="text-xs font-normal text-black my-2">Brand Logo</p>
<p class="text-base font-normal mt-2 mb-4">
We recommend using a PNG file with transparency. Maximum size: 512px x
512px.
</p>
<div> <div>
<p class="text-base mt-1"> <p class="text-base mt-1">
To update your brand image, go to <strong class="font-semibold" To update your brand image, go to <strong class="font-semibold"
@@ -70,7 +70,7 @@
</p> </p>
<PrimaryButton <PrimaryButton
label="Go to Settings" label="Go to Settings"
className="rounded-md mt-1" className="rounded-md mt-3"
onClick={() => goto(`org/${$currentOrg.siteName}/settings`)} onClick={() => goto(`org/${$currentOrg.siteName}/settings`)}
/> />
</div> </div>
@@ -90,19 +90,19 @@
class="my-4" class="my-4"
size="sm" size="sm"
> >
<span slot="labelA" style="color: #161616">Student access</span> <span slot="labelA" style="color: #161616">Locked</span>
<span slot="labelB" style="color: green">Student access</span> <span slot="labelB" style="color: green">Unlocked</span>
</Toggle> </Toggle>
</div> </div>
</section> </section>
<section <section
class="certbg flex justify-center items-center rounded-md w-full md:w-3/5" class="certificate-bg flex justify-center items-center rounded-md w-full md:w-3/5"
> >
<div class="certContainer flex justify-center items-center h-5/6"> <div class="certificate-container flex justify-center items-center h-5/6">
{#if Selectedtheme.label == 'professional'} {#if $course.certificate_theme === 'professional'}
<Professional studentName={student} /> <Professional studentName={studentNamePlaceholder} />
{:else} {:else}
<Plain studentName={student} /> <Plain studentName={studentNamePlaceholder} />
{/if} {/if}
</div> </div>
</section> </section>
@@ -121,11 +121,11 @@
p { p {
color: #262626; color: #262626;
} }
.certContainer { .certificate-container {
width: 95%; width: 95%;
max-width: 95%; max-width: 95%;
} }
.certbg { .certificate-bg {
background-color: #f5f8fe; background-color: #f5f8fe;
} }
</style> </style>
@@ -9,25 +9,25 @@
</script> </script>
<div <div
class="flex flex-col items-center justify-center {borderwidth} {bordercolor}" class="flex flex-col items-center justify-center {borderwidth} {bordercolor} py-3"
> >
<div class="flex items-center gap-1 my-2"> <div class="flex items-center gap-1 my-2">
<img <img
src={$currentOrg.avatar_url ? $currentOrg.avatar_url : logo} src={$currentOrg.avatar_url ? $currentOrg.avatar_url : logo}
alt="logo" alt="logo"
class=" w-14 h-14 rounded-md" class=" w-10 h-10 rounded-md"
/> />
<p class="font-semibold capitalize">{$currentOrg.name}</p> <p class="font-semibold capitalize">{$currentOrg.name}</p>
</div> </div>
<div class="w-full px-5 py-3"> <div class="w-full px-5 py-3">
<p <p
class="text-sm text-center font-normal my-2 uppercase tracking-wider text-gray-500 w-full" class="text-sm text-center font-normal my-2 uppercase tracking-widest text-gray-500 w-full"
> >
Certificate of completion Certificate of completion
</p> </p>
<div class="border-b border-gray-500 mb-4"> <div class="border-b border-gray-500 mb-4">
<p class="text-xs text-black font-medium">This is to certify that</p> <p class="text-xs text-black font-medium">This is to certify that</p>
<p class="text-center">{studentName}</p> <p class="student-name text-center text-5xl">{studentName}</p>
</div> </div>
<div class="mb-2"> <div class="mb-2">
<p class="text-xs text-black font-medium"> <p class="text-xs text-black font-medium">
@@ -46,6 +46,9 @@
</div> </div>
<style> <style>
.student-name {
font-family: 'Qwitcher Grypen', cursive;
}
.desc { .desc {
font-size: 10px; font-size: 10px;
} }
@@ -18,7 +18,7 @@
</p> </p>
<div class="border-b border-gray-500 mb-4"> <div class="border-b border-gray-500 mb-4">
<p class="text-xs text-black font-medium">This is to certify that</p> <p class="text-xs text-black font-medium">This is to certify that</p>
<p class="text-center">{studentName}</p> <p class="student-name text-center text-5xl">{studentName}</p>
</div> </div>
<div class="mb-2"> <div class="mb-2">
<p class="text-xs text-black font-medium"> <p class="text-xs text-black font-medium">
@@ -26,18 +26,18 @@
</p> </p>
<div> <div>
<p <p
class="clamp bg-transparent text-base font-semibold text-blue-800 text-center uppercase" class="clamp bg-transparent text-base font-semibold text-blue-800 text-center uppercase my-2"
> >
{$course.title} {$course.title}
</p> </p>
</div> </div>
</div> </div>
<p class="desc mb-2 text-justify">{$course.description}</p> <p class="desc mb-4 text-justify">{$course.description}</p>
<div class="flex items-center gap-1 my-2"> <div class="flex items-center gap-1 my-2">
<img <img
src={$currentOrg.avatar_url ? $currentOrg.avatar_url : logo} src={$currentOrg.avatar_url ? $currentOrg.avatar_url : logo}
alt="logo" alt="logo"
class="w-14 h-14 rounded-md" class="w-10 h-10 rounded-md"
/> />
<p class="font-semibold capitalize">{$currentOrg.name}</p> <p class="font-semibold capitalize">{$currentOrg.name}</p>
</div> </div>
@@ -46,6 +46,9 @@
</div> </div>
<style> <style>
.student-name {
font-family: 'Qwitcher Grypen', cursive;
}
.desc { .desc {
font-size: 10px; font-size: 10px;
} }
+5
View File
@@ -11,6 +11,7 @@ export const course: Writable<Course> = writable({
cost: 0, cost: 0,
currency: '', currency: '',
is_certificate_downloadable: false, is_certificate_downloadable: false,
certificate_theme: 'professional',
metadata: { metadata: {
requirements: '', requirements: '',
description: '', description: '',
@@ -129,5 +130,9 @@ export async function setCourse(data: Course, setLesson = true) {
}, },
}; };
} }
if (!data.certificate_theme) {
data.certificate_theme = 'professional';
}
course.set(data); course.set(data);
} }
+1 -1
View File
@@ -1,7 +1,7 @@
<script> <script>
// import // import
// border border-gray-300 rounded-md p-3 bg-blue-200 bg-opacity-25 // border border-gray-300 rounded-md p-3 bg-blue-200 bg-opacity-25
export let width = 'max-w-3xl w-full lg:w-11/12'; export let width = 'max-w-4xl w-full lg:w-11/12';
export let padding = 'pb-5 px-4'; export let padding = 'pb-5 px-4';
export let className = ''; export let className = '';
</script> </script>
+10 -9
View File
@@ -18,8 +18,8 @@
import Design from '../../../components/Course/components/Ceritficate/Design.svelte'; import Design from '../../../components/Course/components/Ceritficate/Design.svelte';
// import Reports from '../../../components/Course/components/Ceritficate/Reports.svelte'; // import Reports from '../../../components/Course/components/Ceritficate/Reports.svelte';
// import { issueCertificateModal } from '../../../components/Course/components/Ceritficate/store'; // import { issueCertificateModal } from '../../../components/Course/components/Ceritficate/store';
import { Tabs, Tab } from 'carbon-components-svelte'; // import { Tabs, Tab } from 'carbon-components-svelte';
import TabContent from 'carbon-components-svelte/src/Tabs/TabContent.svelte'; // import TabContent from 'carbon-components-svelte/src/Tabs/TabContent.svelte';
export let courseId: string = ''; export let courseId: string = '';
let isStudent = false; let isStudent = false;
@@ -47,20 +47,21 @@
</slot:fragment> </slot:fragment>
</PageNav> </PageNav>
<PageBody className="w-full mx-0" padding="px-0"> <PageBody className="w-full mx-0" padding="px-3">
<Tabs autoWidth class="border-b border-gray-200"> <Design />
<!-- <Tabs autoWidth class="border-b border-gray-200">
<Tab label="Design" /> <Tab label="Design" />
<!-- <Tab label="Reports" /> --> <Tab label="Reports" />
<svelte:fragment slot="content"> <svelte:fragment slot="content">
<TabContent> <TabContent>
<Design /> <Design />
</TabContent> </TabContent>
<!-- Temp disable Reports tab for V2 --> Temp disable Reports tab for V2
<!-- <TabContent> <TabContent>
<Reports /> <Reports />
</TabContent> --> </TabContent>
</svelte:fragment> </svelte:fragment>
</Tabs> </Tabs> -->
</PageBody> </PageBody>
</CourseContainer> </CourseContainer>
+1
View File
@@ -97,6 +97,7 @@ export interface Course {
group?: Group; group?: Group;
organization?: Organization; organization?: Organization;
is_certificate_downloadable?: boolean; is_certificate_downloadable?: boolean;
certificate_theme?: string;
} }
export interface Groupmember { export interface Groupmember {