Update requirement files with new feature templates and fix backend API error message, along with mobile project config updates and documentation improvements

This commit is contained in:
louiscklaw
2025-06-13 12:11:47 +08:00
parent f23a6b7d9c
commit 346992d4ec
3102 changed files with 220182 additions and 2896 deletions

View File

@@ -1,11 +1,15 @@
import { IonButton, IonCol, IonRow } from '@ionic/react';
import styles from './Quiz.module.scss';
export const Answer = ({ answer, handleAnswerClick, question }) => (
export const Answer: React.FC<{
answer: any;
handleAnswerClick: any;
question: any;
}> = ({ answer, handleAnswerClick, question }) => (
<IonRow>
<IonCol size="12">
<IonButton
onClick={(e) => handleAnswerClick(e, answer, question)}
onClick={(e: any) => handleAnswerClick(e, answer, question)}
expand="block"
color="light"
className={`ion-text-wrap ${styles.answerButton}`}

View File

@@ -14,10 +14,14 @@ import {
import styles from './Quiz.module.scss';
import { updateChosenCategory, updateChosenDifficulty } from '../store/SettingsStore';
export const CompletedCard = ({ completionContainerRef, score, questionsLength }) => {
export const CompletedCard: React.FC<{
completionContainerRef: any;
score: number;
questionsLength: number;
}> = ({ completionContainerRef, score, questionsLength }) => {
const router = useIonRouter();
const playAgain = () => {
const playAgain = (): void => {
updateChosenCategory(false);
updateChosenDifficulty(false);
router.push('/');

View File

@@ -1,25 +0,0 @@
import { IonCard, IonCardContent, IonCardSubtitle, IonCol, IonItem, IonLabel, IonNote, IonRow } from "@ionic/react";
export const QuizStats = ({ chosenCategory, chosenDifficulty, currentQuestion, questionsLength, score }) => (
<IonRow>
<IonCol size="12">
<IonCard>
<IonCardContent className="ion-text-center">
<IonCardSubtitle>{ chosenCategory } | { chosenDifficulty }</IonCardSubtitle>
<IonItem lines="none">
<IonLabel className="ion-text-center">
<IonCardSubtitle>Question</IonCardSubtitle>
<IonNote>{ currentQuestion } / { questionsLength }</IonNote>
</IonLabel>
<IonLabel className="ion-text-center">
<IonCardSubtitle>Score</IonCardSubtitle>
<IonNote>{ score }</IonNote>
</IonLabel>
</IonItem>
</IonCardContent>
</IonCard>
</IonCol>
</IonRow>
);

View File

@@ -0,0 +1,43 @@
import {
IonCard,
IonCardContent,
IonCardSubtitle,
IonCol,
IonItem,
IonLabel,
IonNote,
IonRow,
} from '@ionic/react';
export const QuizStats: React.FC<{
chosenCategory: string;
chosenDifficulty: string;
currentQuestion: number;
questionsLength: number;
score: number;
}> = ({ chosenCategory, chosenDifficulty, currentQuestion, questionsLength, score }) => (
<IonRow>
<IonCol size="12">
<IonCard>
<IonCardContent className="ion-text-center">
<IonCardSubtitle>
{chosenCategory} | {chosenDifficulty}
</IonCardSubtitle>
<IonItem lines="none">
<IonLabel className="ion-text-center">
<IonCardSubtitle>Question</IonCardSubtitle>
<IonNote>
{currentQuestion} / {questionsLength}
</IonNote>
</IonLabel>
<IonLabel className="ion-text-center">
<IonCardSubtitle>Score</IonCardSubtitle>
<IonNote>{score}</IonNote>
</IonLabel>
</IonItem>
</IonCardContent>
</IonCard>
</IonCol>
</IonRow>
);

View File

@@ -1,17 +0,0 @@
import { IonCol } from "@ionic/react";
import { updateChosenCategory, updateChosenDifficulty } from "../store/SettingsStore";
import styles from "./Settings.module.scss";
export const Category = ({ label, value, set, chosen }) => (
<IonCol id={ `categoryButton_${ value }` } size="6" className={ `${styles.category} ${chosen && styles.chosen} animate__animated` } onClick={ () => updateChosenCategory(value) }>
<p>{ label }</p>
</IonCol>
);
export const Difficulty = ({ label, value, set, chosen }) => (
<IonCol id={ `difficultyButton_${ value }` } size="4" className={ `${ styles.category } ${ chosen && styles.chosen } animate__animated` } onClick={ () => updateChosenDifficulty(value) }>
<p>{ label }</p>
</IonCol>
);

View File

@@ -0,0 +1,35 @@
import { IonCol } from '@ionic/react';
import { updateChosenCategory, updateChosenDifficulty } from '../store/SettingsStore';
import styles from './Settings.module.scss';
export const Category: React.FC<{ label: string; value: any; set: any; chosen: any }> = ({
label,
value,
set,
chosen,
}) => (
<IonCol
id={`categoryButton_${value}`}
size="6"
className={`${styles.category} ${chosen && styles.chosen} animate__animated`}
onClick={() => updateChosenCategory(value)}
>
<p>{label}</p>
</IonCol>
);
export const Difficulty: React.FC<{ label: string; value: any; set: any; chosen: any }> = ({
label,
value,
set,
chosen,
}) => (
<IonCol
id={`difficultyButton_${value}`}
size="4"
className={`${styles.category} ${chosen && styles.chosen} animate__animated`}
onClick={() => updateChosenDifficulty(value)}
>
<p>{label}</p>
</IonCol>
);