refactor: MONOREPO
This commit is contained in:
5
frontend/src/models/learner.ts
Normal file
5
frontend/src/models/learner.ts
Normal file
@@ -0,0 +1,5 @@
|
||||
export interface ILearner {
|
||||
username: string;
|
||||
level: number;
|
||||
score: number;
|
||||
}
|
||||
7
frontend/src/models/level.ts
Normal file
7
frontend/src/models/level.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
export interface ILevel {
|
||||
name: string;
|
||||
desc: string;
|
||||
level: number;
|
||||
|
||||
done: boolean;
|
||||
}
|
||||
11
frontend/src/models/review.ts
Normal file
11
frontend/src/models/review.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface IReviewMetadata {
|
||||
// Number of correct answers
|
||||
correct: number;
|
||||
// Number of wrong answers
|
||||
wrong: number;
|
||||
};
|
||||
|
||||
export enum ReviewType {
|
||||
LEVEL,
|
||||
QUEUE
|
||||
};
|
||||
8
frontend/src/models/user.ts
Normal file
8
frontend/src/models/user.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
export interface IUser {
|
||||
username: string;
|
||||
uid: string;
|
||||
showWelcome: boolean;
|
||||
score: number;
|
||||
|
||||
sessionToken: string;
|
||||
};
|
||||
130
frontend/src/models/vocab.ts
Normal file
130
frontend/src/models/vocab.ts
Normal file
@@ -0,0 +1,130 @@
|
||||
export enum ReviewMode {
|
||||
GER_TO_LAT,
|
||||
LAT_TO_GER,
|
||||
};
|
||||
|
||||
export enum VocabType {
|
||||
NOMEN,
|
||||
VERB,
|
||||
ADJEKTIV,
|
||||
ADVERB
|
||||
};
|
||||
|
||||
export interface INomenData {
|
||||
grundform: string;
|
||||
genitiv: string;
|
||||
genus: string;
|
||||
};
|
||||
|
||||
export interface IVerbData {
|
||||
grundform: string;
|
||||
// 1. Person
|
||||
praesens: string;
|
||||
perfekt: string;
|
||||
ppp: string;
|
||||
};
|
||||
|
||||
export interface IAdjektivData {
|
||||
grundform: string;
|
||||
nominativ_a: string;
|
||||
nominativ_b: string;
|
||||
};
|
||||
|
||||
export interface IVocab {
|
||||
// If a word has multiple meanings
|
||||
german: string[];
|
||||
hint?: string;
|
||||
mnemonic?: string;
|
||||
|
||||
type: VocabType;
|
||||
latin: INomenData | IVerbData | IAdjektivData;
|
||||
|
||||
// This number is unique across all vocabulary items
|
||||
id: number;
|
||||
};
|
||||
|
||||
// What kind of question should be answered
|
||||
export enum ReviewQType {
|
||||
GERMAN,
|
||||
|
||||
NOMEN_GENITIV,
|
||||
NOMEN_GENUS,
|
||||
|
||||
ADJ_NOM_A,
|
||||
ADJ_NOM_B,
|
||||
|
||||
VERB_PRAESENS,
|
||||
VERB_PERFEKT,
|
||||
VERB_PPP
|
||||
};
|
||||
|
||||
export interface IReviewCard {
|
||||
question: string;
|
||||
// If a question can have multiple answers
|
||||
answers: string[];
|
||||
|
||||
qtype: ReviewQType;
|
||||
|
||||
// Identical to its corresponding IVocab item
|
||||
id: number;
|
||||
};
|
||||
|
||||
export function reviewQTypeToStr(type: ReviewQType): string {
|
||||
switch (type) {
|
||||
case ReviewQType.GERMAN:
|
||||
return "Übersetzung";
|
||||
case ReviewQType.NOMEN_GENITIV:
|
||||
return "Genitiv";
|
||||
case ReviewQType.NOMEN_GENUS:
|
||||
return "Genus";
|
||||
case ReviewQType.ADJ_NOM_A:
|
||||
// TODO
|
||||
return "Nominativ A";
|
||||
case ReviewQType.ADJ_NOM_B:
|
||||
// TODO
|
||||
return "Nominativ B";
|
||||
case ReviewQType.VERB_PRAESENS:
|
||||
return "1. Person Präsens";
|
||||
case ReviewQType.VERB_PERFEKT:
|
||||
return "1. Person Perfekt";
|
||||
case ReviewQType.VERB_PPP:
|
||||
// TODO
|
||||
return "PPP";
|
||||
}
|
||||
}
|
||||
|
||||
// Turn a vocabulaty item into a series of questions about the item
|
||||
export function vocabToReviewCard(vocab: IVocab): IReviewCard[] {
|
||||
switch (vocab.type) {
|
||||
case VocabType.NOMEN:
|
||||
const latin = vocab.latin as INomenData;
|
||||
return [{
|
||||
// Latin -> German
|
||||
question: latin.grundform,
|
||||
answers: vocab.german,
|
||||
qtype: ReviewQType.GERMAN,
|
||||
id: vocab.id,
|
||||
}, {
|
||||
// Latin -> Genitiv
|
||||
question: latin.grundform,
|
||||
answers: [latin.genitiv],
|
||||
qtype: ReviewQType.NOMEN_GENITIV,
|
||||
id: vocab.id,
|
||||
}, {
|
||||
// Latin -> Genus
|
||||
question: latin.grundform,
|
||||
answers: [latin.genus],
|
||||
qtype: ReviewQType.NOMEN_GENUS,
|
||||
id: vocab.id,
|
||||
}];
|
||||
default:
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
export function typeToPoints(type: VocabType) {
|
||||
switch (type) {
|
||||
// Nomen: 2P + 1 (Wenn richtig)
|
||||
//
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user