diff --git a/frontend/src/index.sass b/frontend/src/index.sass
index 50acb6b..442c5f8 100644
--- a/frontend/src/index.sass
+++ b/frontend/src/index.sass
@@ -139,6 +139,7 @@ h2
.page-pad
padding: 2em 1em
height: 100%
+ @extend .non-center
.navbar
position: fixed
diff --git a/frontend/src/logic/CourseData.ts b/frontend/src/logic/CourseData.ts
index 736369e..d0015e9 100644
--- a/frontend/src/logic/CourseData.ts
+++ b/frontend/src/logic/CourseData.ts
@@ -1,27 +1,57 @@
-
-
export interface Chapter
{
- name: string;
- steps: Step[];
+ name: string
+ steps: Step[]
}
export interface Step
{
- questions: Question[];
+ questions: Question[]
}
-export interface Question
+export interface _Question
{
- question: string;
- wordBank?: string[];
- expected?: string;
- type: string;
- pronunciation?: string;
- description?: string;
- example?: string;
- translation?: string;
- clipUrl?: string;
+ question: string
+ type: string
+}
+export type Question = WrittenQuestion | VocabularyQuestion | VerbalQuestion | VerbalPronunciation | VideoQuestion
+
+export interface WrittenQuestion extends _Question
+{
+ wordBank: string[]
+ expected: string
+ type: 'written-question'
+}
+
+export interface VocabularyQuestion extends _Question
+{
+ pronunciation: string
+ description: string
+ example: string
+ type: 'written-vocabulary'
+}
+
+export interface VerbalQuestion extends _Question
+{
+ wordBank: string[]
+ expected: string
+ translation: string
+ url: string
+ type: 'verbal-question'
+}
+
+export interface VerbalPronunciation extends _Question
+{
+ translation: string
+ type: 'verbal-pronunciation'
+}
+
+export interface VideoQuestion extends _Question
+{
+ clipUrl: string
+ description: string
+ expected: string
+ type: 'video'
}
export const chapters_jp: Chapter[] = [
@@ -29,6 +59,14 @@ export const chapters_jp: Chapter[] = [
name: 'Order food',
steps: [{
questions: [
+
+ {
+ question: 'What did Yui come to the club meeting for?',
+ clipUrl: window.location.origin + "/video/cake.mp4",
+ description: "This is a clip from the anime 'K-On'. Yui is a member of the light music club. She came to the club meeting to eat cake.",
+ expected: 'ケーキ or cake',
+ type: 'video',
+ },
{
question: 'Translate this sentence: すしをください',
wordBank: ['I', 'sushi', 'cookies', 'want', 'please', 'give', 'rice', 'some', 'yesterday'],
@@ -43,60 +81,59 @@ export const chapters_jp: Chapter[] = [
type: 'written-vocabulary',
},
{
- question: 'Transcribe this sentence',
+ question: 'What do you hear?',
wordBank: ['刺身', 'ケーキ', 'の', 'は', 'おいしい', 'おもい', 'すし', '中', 'です'],
expected: 'ケーキはおいしいです',
translation: 'Cake is delicious',
+ url: window.location.origin + '/audio/jp_1_1_3.mp3',
type: 'verbal-question',
},
{
- question: 'すしおたくさんあります',
+ question: 'Please say: すしをたくさんあります',
translation: 'There is a lot of sushi',
type: 'verbal-pronunciation',
},
- {
- question: 'What food does Yui like?',
- clipUrl: "https://fdjsakfjs.com",
- expected: 'ケーキ',
- type: 'video',
- }
]
},
- {
- questions: [
- {
- question: 'Translate this sentence: 水をください',
- wordBank: ['I', 'sushi', 'water', 'want', 'please', 'give', 'rice', 'some', 'yesterday'],
- expected: 'Water please / I want water',
- type: "written-question"
- },
- {
- question: '団子',
- pronunciation: 'だんご (dango)',
- description: 'Dango is a kind of mochi, Japanese dumpling and sweet made from mochiko (rice flour).',
- example: '大きいな団子です。(It is a big dango)',
- type: 'written-vocabulary',
- },
- {
- question: 'Transcribe this sentence',
- wordBank: ['刺身', '水', 'は', 'おいしい', 'おもい', 'すし', '中', 'です'],
- expected: '水です',
- translation: 'It is water',
- type: 'verbal-question',
- },
- {
- question: '刺身おください',
- translation: 'Please give me sashimi',
- type: 'verbal-pronunciation',
- },
- {
- question: 'What is the following song about?',
- clipUrl: "https://www.youtube.com/watch?v=qfgyKPQO9g8",
- description: "This is the song 'Dango Daikazoku' from the anime 'Clannad'. It is about a family of dango.",
- expected: '団子',
- type: 'video',
- }
- ]
- }]
+ {
+ questions: [
+ {
+ // question: "Translate this sentence: Water please",
+ // wordBank: ['水', 'を', 'ください', 'おいしい', 'おもい', 'すし', '中', 'です'],
+ question: 'Translate this sentence: 水をください',
+ wordBank: ['I', 'sushi', 'cookies', 'want', 'please', 'give', 'rice', 'some', 'yesterday'],
+ // expected: '水をください',
+ expected: 'Water please',
+ type: "written-question"
+ },
+ {
+ question: '団子',
+ pronunciation: 'だんご (dango)',
+ description: 'Dango is a kind of mochi, Japanese dumpling and sweet made from mochiko (rice flour).',
+ example: '大きいな団子です。(It is a big dango)',
+ type: 'written-vocabulary',
+ },
+ {
+ question: 'What do you hear?',
+ wordBank: ['刺身', '水', 'は', 'おいしい', 'おもい', 'すし', '中', 'です'],
+ expected: '水です',
+ translation: 'It is water',
+ url: window.location.origin + '/audio/jp_1_2_3.mp3',
+ type: 'verbal-question',
+ },
+ {
+ question: 'Please say: 刺身おください',
+ translation: 'Please give me sashimi',
+ type: 'verbal-pronunciation',
+ },
+ {
+ question: 'What is the following song about?',
+ clipUrl: window.location.origin + "/video/dango.mp4",
+ description: "This is the song 'Dango Daikazoku' from the anime 'Clannad'. It is about a family of dango.",
+ expected: '団子 or dango',
+ type: 'video',
+ }
+ ]
+ }]
}
]
diff --git a/frontend/src/pages/Course.tsx b/frontend/src/pages/Course.tsx
index 85f4d5c..5a71a8c 100644
--- a/frontend/src/pages/Course.tsx
+++ b/frontend/src/pages/Course.tsx
@@ -3,6 +3,8 @@ import {Icon} from "@iconify/react";
import {getLanguage, isLoggedIn, isStepCompleted} from "../logic/sdk";
import React from "react";
import "./Course.sass"
+import {Step} from "../logic/CourseData";
+import {useLocation, useNavigate} from "react-router-dom";
function CourseButton(props: {state: 'active' | 'locked' | 'completed', index: number})
{
@@ -17,16 +19,17 @@ function CourseButton(props: {state: 'active' | 'locked' | 'completed', index: n
// Calculate the horizontal translation
const translateXValue = amplitude * Math.sin(props.index * frequency);
- return (
-
-
-
- )
+ return
+
+
}
export default function Course()
{
+ const location = useLocation();
+ const navigate = useNavigate();
+
if (!isLoggedIn())
{
window.location.href = '/login';
@@ -36,6 +39,11 @@ export default function Course()
// Get language
const lang = getLanguage();
+ function click(step: Step)
+ {
+ navigate('/lesson', {state: {questions: step.questions, home: location.pathname}})
+ }
+
return (
@@ -46,20 +54,21 @@ export default function Course()
- {lang.data.map((chapter, i) => <>
-
+ {lang.data.map((chapter, i) =>
+
Chapter 1, Section 1
{chapter.name}
- {chapter.steps.map((step, i) =>
+ {chapter.steps.map((step, i) =>
click(step)}>
)}
+ index={i}/>
)}
+ {[...Array(5)].map((_, i) =>
)}
- >)}
+
)}
)
diff --git a/frontend/src/pages/Lesson.tsx b/frontend/src/pages/Lesson.tsx
index 7f32fb5..78fe5f3 100644
--- a/frontend/src/pages/Lesson.tsx
+++ b/frontend/src/pages/Lesson.tsx
@@ -1,91 +1,63 @@
-import { useLocation, useNavigate } from 'react-router-dom';
-import { useState } from 'react';
+import {useLocation, useNavigate} from 'react-router-dom';
+import React, {useState} from 'react';
import WrittenQuestionExercise from "../components/WrittenQuestionExercise"
import WrittenVocabularyExercise from "../components/WrittenVocabularyExercise"
import VerbalQuestionsExercise from "../components/VerbalQuestionsExercise"
import Progress from '../components/Progress';
import VerbalPronunciationExercise from '../components/VerbalPronunciationExercise';
+import {_Question, chapters_jp, Question} from "../logic/CourseData";
+import VideoExercise from "../components/VideoExercise";
-export default function Lesson() {
- const location = useLocation();
- const navigate = useNavigate();
- const { questions, home } = location.state;
- const [currQuestion, setCurrQuestion] = useState
(0);
+export default function Lesson()
+{
+ const location = useLocation();
+ const navigate = useNavigate();
+ const {questions, home} = location.state;
+ const [currQuestion, setCurrQuestion] = useState(0);
- const handleNavigateBack = () => {
- navigate(-1);
- };
+ console.log(questions)
- const handleQuestionSubmit = () => {
- if (currQuestion < questions.length - 1) {
- setCurrQuestion(currQuestion + 1);
- } else {
- navigate(home);
- }
+ const handleNavigateBack = () =>
+ {
+ navigate(-1);
+ };
+
+ const onSubmit = () =>
+ {
+ if (currQuestion < questions.length - 1)
+ setCurrQuestion(currQuestion + 1);
+ else navigate(home);
}
- const renderQuestion = (currIndex: number) => {
- const question = questions[currQuestion];
- switch (question.type) {
- case 'written':
- switch (question.exercise) {
- case 'questions':
- return ;
- case 'vocabulary':
- return ;
- default:
- return null;
- }
- case 'verbal':
- switch (question.exercise) {
- case 'questions':
- return ;
- case 'pronunciation':
- return ;
- default:
- return null;
- }
- default:
- return null;
- }
- };
-
- return (
-
-