Skip to content

Commit 2ee6053

Browse files
feat(tutor): shows all syllabus
1 parent a089043 commit 2ee6053

File tree

6 files changed

+40
-18
lines changed

6 files changed

+40
-18
lines changed

src/components/ModalWrapper.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
<script setup lang="ts">
2-
import { computed, watch } from 'vue';
2+
import { computed } from 'vue';
33
const props = defineProps<{
44
isOpen: boolean;
55
onClose?: () => void;
66
}>();
77
88
const computedState = computed(() => props.isOpen);
99
10-
watch(props.isOpen, (val) => {
11-
computedState.value = val;
12-
});
13-
1410
const handleModalClose = () => {
1511
props.onClose();
1612
computedState.value = false;

src/components/tutor/ThirdStep.vue

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,37 @@
22
import { marked } from 'marked';
33
defineProps<{
44
visible?: boolean;
5-
syllabus?: string;
5+
syllabus?: { content: string; source: string }[];
66
}>();
77
</script>
88
<template>
99
<div class="wrapper" :class="{ visible: visible && syllabus.length }">
1010
<h1 class="title is-4">{{ $t('tutor.thirdStep.title') }}</h1>
1111
<p class="subtitle is-6">{{ $t('tutor.thirdStep.description') }}</p>
1212
<!-- syllabus -->
13-
<p
14-
contenteditable="true"
15-
id="syllabus"
16-
class="syllabus content"
17-
v-if="syllabus.length"
18-
v-html="marked.parse(syllabus)"
19-
/>
13+
<details
14+
:key="item.source"
15+
v-for="item in syllabus"
16+
class="details"
17+
:open="item.source === 'PedagogicalEngineerAgent'"
18+
>
19+
<summary class="title is-6 mb-2">
20+
{{ $t(`tutor.agents.${item.source}`) }}
21+
</summary>
22+
<p
23+
contenteditable="true"
24+
id="syllabus"
25+
class="syllabus content"
26+
v-if="item.content.length"
27+
v-html="marked.parse(item.content)"
28+
/>
29+
</details>
2030
</div>
2131
</template>
2232

2333
<style scoped>
2434
.wrapper {
25-
overflow: hidden;
35+
overflow: scroll;
2636
height: 100%;
2737
display: flex;
2838
flex-direction: column;
@@ -35,14 +45,18 @@ defineProps<{
3545
flex-grow: 3;
3646
}
3747
48+
details:not([open]) {
49+
opacity: 0.5;
50+
}
51+
3852
.syllabus {
3953
padding: 2rem;
4054
border: 1px solid var(--neutral-20);
4155
border-radius: 0.5rem;
4256
min-height: 10rem;
4357
max-width: 80rem;
4458
overflow-y: auto;
45-
overflow-x: auto;
59+
overflow-x: scroll;
4660
background-color: var(--neutral-10);
4761
cursor: text;
4862
}

src/localisation/en.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ export const en = {
194194
},
195195
textLengthFeedback: 'Please provide a longer text for the search',
196196
tutor: {
197+
agents: {
198+
UniversityTeacherAgent: 'Professor',
199+
SDGExpertAgent: 'SDG Expert',
200+
PedagogicalEngineerAgent: 'Pedagogical Engineer'
201+
},
197202
fileSizeExceeded: 'File size exceeds 5MB',
198203
loading: {
199204
wait: 'Please wait:',

src/localisation/fr.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ export const fr = {
198198
},
199199
textLengthFeedback: 'Veuillez fournir un texte plus long pour la recherche',
200200
tutor: {
201+
agents: {
202+
UniversityTeacherAgent: 'Professeur',
203+
SDGExpertAgent: 'Expert ODD',
204+
PedagogicalEngineerAgent: 'Ingénieur pédagogique'
205+
},
201206
fileSizeExceeded: 'Le fichier dépasse les 5MB',
202207
loading: {
203208
wait: 'Veuillez patienter :',

src/views/TutorPage.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const store = useTutorStore();
1212
1313
const files: Ref<File[]> = ref([]);
1414
const response: Ref<TutorSearch | null> = ref(null);
15-
const syllabus = ref<string>('');
15+
const syllabus = ref<[]>([]);
1616
const step = ref(1);
1717
const isLoading = ref(false);
1818
@@ -51,6 +51,7 @@ const handleCreateSyllabus = async () => {
5151
const newSylalbus = await store.retrieveSyllabus();
5252
isLoading.value = false;
5353
syllabus.value = newSylalbus.syllabus;
54+
5455
step.value = step.value + 1;
5556
};
5657
@@ -66,7 +67,7 @@ const loaderI18nPathText = {
6667
};
6768
6869
const handleDownload = async () => {
69-
const blob = await convertMarkdownToDocx(syllabus.value);
70+
const blob = await convertMarkdownToDocx(syllabus.value[2].content);
7071
downloadDocx(blob, 'syllabus.docx');
7172
};
7273

src/views/__tests__/__snapshots__/TutorPage.test.ts.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,8 @@ exports[`TutorPage > renders properly 1`] = `
199199
tutor.thirdStep.description
200200
</p>
201201
<!-- syllabus -->
202-
<!--v-if-->
202+
203+
203204
</div>
204205
</div>
205206
<div

0 commit comments

Comments
 (0)