Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 4076776d7d | |||
| 2da4bb213e | |||
| 966c6a271b |
@@ -17,6 +17,7 @@ export default function VerbalPronunciationExercise({q, chapter, onSubmit}: Verb
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [correct, setCorrect] = useState("");
|
||||
const [reason, setReason] = useState("");
|
||||
const [userAnswer, setUserAnswer] = useState("");
|
||||
|
||||
const handleSubmit = () => {
|
||||
if (answered) {
|
||||
@@ -46,7 +47,8 @@ export default function VerbalPronunciationExercise({q, chapter, onSubmit}: Verb
|
||||
const audioFile = new File([blob], "audio.wav", { type: 'audio/wav' });
|
||||
|
||||
const text = await speechToText(audioFile);
|
||||
const aiMark = await getAIMarking(q.question, text.toLowerCase(), "", chapter, language);
|
||||
setUserAnswer(text);
|
||||
const aiMark = await getAIMarking(`Please pronounce the following: ${q.question}`, text.toLowerCase(), "", chapter, language);
|
||||
setAnswered(true);
|
||||
setCorrect(aiMark.correct);
|
||||
setReason(aiMark.reason);
|
||||
@@ -88,24 +90,25 @@ export default function VerbalPronunciationExercise({q, chapter, onSubmit}: Verb
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div className=' flex-row flex-wrap w-full'>
|
||||
<h3>{correct}</h3>
|
||||
<p>{reason}</p>
|
||||
<button className='record-btn w-full bottom-0 relative' onClick={(e) => handleSubmit()}>Continue</button>
|
||||
<div className='flex flex-wrap w-full gap-5'>
|
||||
<div className="font-bold">{correct ? "Correct!" : "Incorrect"}</div>
|
||||
<div>{reason}</div>
|
||||
<button className='green w-full' onClick={() => handleSubmit()}>{!answered ? "Submit" : "Continue"}</button>
|
||||
{answered && !correct && <button className='red w-full' onClick={() => handleSubmit()}>I was right</button>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="v-layout page-pad flex justify-center">
|
||||
<h1 className="text-center">Say the following</h1>
|
||||
<div className='round box h-min no-shadow relative min-h-[60px] flex items-center justify-center'>
|
||||
return <div className="v-layout flex justify-center h-full">
|
||||
<div className="font-bold">Say the following</div>
|
||||
<div className='box'>
|
||||
{q.question}
|
||||
</div>
|
||||
{userAnswer && <div className='flex items-center gap-3'>
|
||||
<Icon icon="mdi:microphone"/> {userAnswer}
|
||||
</div>}
|
||||
<div className="flex-1"></div>
|
||||
{ResponseSection(correct, reason)}
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -55,18 +55,18 @@ export default function VerbalQuestionsExercise({q, chapter, onSubmit}: VerbalQu
|
||||
const ResponseSection = (correct: string | null, reason: string | null) => {
|
||||
if (!answered) {
|
||||
return (
|
||||
<div className='w-full h-32'>
|
||||
<div className='w-full h-36'>
|
||||
<div className=' flex-row flex-wrap w-full h-full'>
|
||||
{remainingWords.map((word, index) => (
|
||||
<span
|
||||
key={index}
|
||||
className="border-gray-300 border-2 m-1 p-1 px-3 rounded-xl inline-block cursor-pointer"
|
||||
onClick={(event) => handleWordBankClick(word)}>
|
||||
onClick={() => handleWordBankClick(word)}>
|
||||
{word}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
<button className='green' onClick={(e) => handleSubmit()}>
|
||||
<button className='green' onClick={() => handleSubmit()}>
|
||||
{loading ? <ClipLoader
|
||||
color="white"
|
||||
loading={loading}
|
||||
@@ -78,13 +78,12 @@ export default function VerbalQuestionsExercise({q, chapter, onSubmit}: VerbalQu
|
||||
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div className=' flex-row flex-wrap border-b-4 w-full h-36'>
|
||||
<h3>{correct}</h3>
|
||||
<p>{reason}</p>
|
||||
<button className='green w-full' onClick={(e) => handleSubmit()}>{!answered ? "Submit" : "Continue"}</button>
|
||||
return <div className='flex flex-wrap w-full gap-5'>
|
||||
<div className="font-bold">{correct ? "Correct!" : "Incorrect"}</div>
|
||||
<div>{reason}</div>
|
||||
<button className='green w-full' onClick={() => handleSubmit()}>{!answered ? "Submit" : "Continue"}</button>
|
||||
{answered && !correct && <button className='red w-full' onClick={() => handleSubmit()}>I was right</button>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,11 +43,12 @@ export default function VideoExercise({q, chapter, onSubmit}: VideoQuestionProps
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='v-layout space-y-8 items-center w-full'>
|
||||
<div className='v-layout w-full h-full non-center'>
|
||||
<div className="box">
|
||||
{q.question}
|
||||
</div>
|
||||
<video src={q.clipUrl} controls className='video-player'></video>
|
||||
<div className="flex-1"></div>
|
||||
<div className='flex-col w-full'>
|
||||
{!answered ?
|
||||
<div className="v-layout">
|
||||
@@ -57,10 +58,11 @@ export default function VideoExercise({q, chapter, onSubmit}: VideoQuestionProps
|
||||
{loading ? <ClipLoader color="white" loading={loading} /> : "Submit"}
|
||||
</button>
|
||||
</div> :
|
||||
<div className='flex-col w-full'>
|
||||
<h3>{correct}</h3>
|
||||
<p>{reason}</p>
|
||||
<button className='green w-full' onClick={() => handleSubmit()}>Continue</button>
|
||||
<div className='flex flex-wrap w-full gap-5'>
|
||||
<div className="font-bold">{correct ? "Correct!" : "Incorrect"}</div>
|
||||
<div>{reason}</div>
|
||||
<button className='green w-full' onClick={() => handleSubmit()}>{!answered ? "Submit" : "Continue"}</button>
|
||||
{answered && !correct && <button className='red w-full' onClick={() => handleSubmit()}>I was right</button>}
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@@ -80,13 +80,12 @@ export default function WrittenQuestionExercise({q, chapter, onSubmit}: WrittenQ
|
||||
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<div className=' flex-row flex-wrap border-b-4 w-full h-36'>
|
||||
<h3>{correct}</h3>
|
||||
<p>{reason}</p>
|
||||
return <div className='flex flex-wrap w-full gap-5'>
|
||||
<div className="font-bold">{correct ? "Correct!" : "Incorrect"}</div>
|
||||
<div>{reason}</div>
|
||||
<button className='green w-full' onClick={() => handleSubmit()}>{!answered ? "Submit" : "Continue"}</button>
|
||||
{answered && !correct && <button className='red w-full' onClick={() => handleSubmit()}>I was right</button>}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useState } from 'react';
|
||||
import {VocabularyQuestion} from "../logic/CourseData";
|
||||
import {Icon} from "@iconify/react";
|
||||
|
||||
interface WrittenVocabularyProps {
|
||||
q: VocabularyQuestion
|
||||
@@ -19,24 +20,30 @@ export default function WrittenQuestionExercise({q, onSubmit}: WrittenVocabulary
|
||||
}
|
||||
|
||||
return (
|
||||
<div className='v-layout space-y-8 items-center w-full'>
|
||||
<h1>Vocabulary: Do you know this word?</h1>
|
||||
<div className='round box h-min no-shadow relative min-h-[60px] flex items-center justify-center mx-5'>
|
||||
<div className='v-layout gap-5 h-full'>
|
||||
<div className="font-bold">Recall the following word</div>
|
||||
<div className='box text-center'>
|
||||
{q.question}
|
||||
</div>
|
||||
<div className=' flex-col flex-wrap w-full'>
|
||||
<div className="flex-1 flex justify-center items-center w-full">
|
||||
{answered &&
|
||||
<div className='flex flex-col gap-3 w-full'>
|
||||
<div className="font-bold">{q.pronunciation}</div>
|
||||
<div>{q.description}</div>
|
||||
<div className="text-yellow-600 flex items-center gap-3"><Icon icon="fa:star"/>{q.example}</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div className="mb-5">
|
||||
{answered ?
|
||||
<div className='flex-col w-full'>
|
||||
<h3>{q.pronunciation}</h3>
|
||||
<p>{q.description}</p>
|
||||
<p>{q.example}</p>
|
||||
<div className='flex-row'>
|
||||
<>
|
||||
<button className='green my-4' onClick={(e) => handleSubmit()}>I got it!</button>
|
||||
<button className='red' onClick={(e) => handleSubmit()}>I forgot</button>
|
||||
</div>
|
||||
</div>
|
||||
:
|
||||
</> :
|
||||
<>
|
||||
<div className="text-gray-400 text-sm mb-5">Please click "show meaning" after you have tried to recall the meaning of the word</div>
|
||||
<button className='white' onClick={(e) => handleSubmit()}>Show Meaning</button>
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -59,14 +59,6 @@ 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'],
|
||||
@@ -89,10 +81,17 @@ export const chapters_jp: Chapter[] = [
|
||||
type: 'verbal-question',
|
||||
},
|
||||
{
|
||||
question: 'Please say: すしをたくさんあります',
|
||||
question: 'すしをたくさんあります',
|
||||
translation: 'There is a lot of sushi',
|
||||
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',
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
@@ -122,17 +121,17 @@ export const chapters_jp: Chapter[] = [
|
||||
type: 'verbal-question',
|
||||
},
|
||||
{
|
||||
question: 'Please say: 刺身おください',
|
||||
question: '刺身おください',
|
||||
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',
|
||||
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',
|
||||
}
|
||||
},
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ import NavBar from "../components/NavBar"
|
||||
import React, { useState } from 'react';
|
||||
import { generateFakeUsers } from '../logic/fakeUsers';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import {getLanguage} from "../logic/sdk";
|
||||
|
||||
export default function CollabLearning() {
|
||||
|
||||
@@ -45,7 +46,7 @@ export default function CollabLearning() {
|
||||
<div className="v-layout p-6">
|
||||
<div className="flex flex-col flex-1">
|
||||
<h1>Chat</h1>
|
||||
<p className="subtext">Find people fluent in your taget language to Chat!</p>
|
||||
<p className="subtext">Find people fluent in {getLanguage().name} to Chat!</p>
|
||||
<p className="subtext">Help them learn a language you know!</p>
|
||||
<p className="font-bold pt-10">Interests</p>
|
||||
<div className="tags">
|
||||
|
||||
@@ -55,11 +55,9 @@ export default function Lesson()
|
||||
return (
|
||||
<div className="v-layout page-pad non-center">
|
||||
<Progress percent={currQuestion / questions.length * 100} back={handleNavigateBack}/>
|
||||
<div className="p-5">
|
||||
<div className="flex flex-col flex-1 mb-8 items-center">
|
||||
<div className="p-5 h-full">
|
||||
{renderQuestion(currQuestion)}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ export default function Review() {
|
||||
|
||||
return (
|
||||
<div className="layout-v page-pad">
|
||||
<h1>Review Page</h1>
|
||||
<h1>Daily Review</h1>
|
||||
<h2>Written</h2>
|
||||
<div className="flex flex-col flex-1 mb-8 gap-3">
|
||||
{writtenReview.map(lesson => (
|
||||
|
||||
Reference in New Issue
Block a user