-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.ts
More file actions
136 lines (122 loc) · 2.64 KB
/
types.ts
File metadata and controls
136 lines (122 loc) · 2.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/**
* Maps logical fingers to Tailwind CSS color classes.
*/
export enum Finger {
LeftPinky = 'pink-500',
LeftRing = 'blue-500',
LeftMiddle = 'green-500',
LeftIndex = 'yellow-500',
RightIndex = 'orange-500',
RightMiddle = 'purple-500',
RightRing = 'teal-500',
RightPinky = 'red-500',
Thumb = 'gray-400'
}
export type Theme = 'rose' | 'blue' | 'amber';
export type KeyboardLayout = 'qwerty' | 'azerty';
export interface KeyConfig {
char: string;
finger: Finger;
row: number;
width?: number;
label?: string;
subLabel?: string;
tertLabel?: string;
}
export interface Level {
id: number;
title: string;
description: string;
newKeys: string[];
allKeys: string[];
textSamples: string[];
difficulty: 'easy' | 'medium' | 'hard';
minWpm: number;
minAccuracy: number;
}
export interface CustomLesson {
id: string;
title: string;
description: string;
content: string;
createdAt: string;
}
export enum GameMode {
Campaign = 'CAMPAIGN',
Timed = 'TIMED',
ErrorDrill = 'ERROR_DRILL',
Story = 'STORY',
Custom = 'CUSTOM',
Dictation = 'DICTATION',
Library = 'LIBRARY'
}
export interface ErrorStats {
[targetChar: string]: number;
}
export interface Achievement {
id: string;
title: string;
description: string;
icon: string;
color: string;
}
export interface DailyChallenge {
date: string;
description: string;
targetType: 'stars' | 'wpm' | 'accuracy' | 'matches';
targetValue: number;
currentValue: number;
completed: boolean;
rewardXp: number;
}
export interface GhostRecord {
wpm: number;
accuracy: number;
timestamp: string;
events: number[];
}
export interface SessionResult {
levelId: number;
mode: GameMode;
wpm: number;
accuracy: number;
consistency?: number;
date: string;
stars: 1 | 2 | 3;
duration?: number;
correctStats?: ErrorStats;
}
export interface UserProfile {
id: string;
name: string;
currentLevelId: number;
unlockedLevels: number[];
history: SessionResult[];
errorStats: ErrorStats;
achievements: string[];
xp: number;
playerLevel: number;
currentTitle: string;
currentAvatar: string;
dailyChallenge: DailyChallenge | null;
theme: Theme;
soundEnabled: boolean;
layout: KeyboardLayout;
kioskMode?: boolean;
ghosts?: Record<string, GhostRecord>;
}
export interface AppState {
users: Record<string, UserProfile>;
activeUserId: string | null;
customLessons: CustomLesson[];
}
export enum AppScreen {
UserSelect = 'USER_SELECT',
ParentDashboard = 'PARENT_DASHBOARD',
Dashboard = 'DASHBOARD',
Exercise = 'EXERCISE',
Result = 'RESULT',
Stats = 'STATS',
Achievements = 'ACHIEVEMENTS',
Library = 'LIBRARY'
}