react-native-elearn-ui 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/lib/module/components/Icon.js +97 -0
  2. package/lib/module/components/Icon.js.map +1 -1
  3. package/lib/module/screens/HomeScreen.js +22 -9
  4. package/lib/module/screens/HomeScreen.js.map +1 -1
  5. package/lib/module/screens/QbankScreen.js +255 -101
  6. package/lib/module/screens/QbankScreen.js.map +1 -1
  7. package/lib/module/screens/QuestionScreen.js +222 -181
  8. package/lib/module/screens/QuestionScreen.js.map +1 -1
  9. package/lib/module/screens/QuizStartScreen.js +137 -133
  10. package/lib/module/screens/QuizStartScreen.js.map +1 -1
  11. package/lib/module/screens/ResultScreen.js +3 -2
  12. package/lib/module/screens/ResultScreen.js.map +1 -1
  13. package/lib/module/screens/TopicListScreen.js +287 -137
  14. package/lib/module/screens/TopicListScreen.js.map +1 -1
  15. package/lib/typescript/src/components/Icon.d.ts +1 -1
  16. package/lib/typescript/src/components/Icon.d.ts.map +1 -1
  17. package/lib/typescript/src/screens/HomeScreen.d.ts +1 -0
  18. package/lib/typescript/src/screens/HomeScreen.d.ts.map +1 -1
  19. package/lib/typescript/src/screens/QbankScreen.d.ts +5 -1
  20. package/lib/typescript/src/screens/QbankScreen.d.ts.map +1 -1
  21. package/lib/typescript/src/screens/QuestionScreen.d.ts +1 -0
  22. package/lib/typescript/src/screens/QuestionScreen.d.ts.map +1 -1
  23. package/lib/typescript/src/screens/QuizStartScreen.d.ts +1 -0
  24. package/lib/typescript/src/screens/QuizStartScreen.d.ts.map +1 -1
  25. package/lib/typescript/src/screens/ResultScreen.d.ts +1 -0
  26. package/lib/typescript/src/screens/ResultScreen.d.ts.map +1 -1
  27. package/lib/typescript/src/screens/TopicListScreen.d.ts +1 -0
  28. package/lib/typescript/src/screens/TopicListScreen.d.ts.map +1 -1
  29. package/lib/typescript/src/types/index.d.ts +22 -0
  30. package/lib/typescript/src/types/index.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/components/Icon.tsx +125 -1
  33. package/src/screens/HomeScreen.tsx +77 -51
  34. package/src/screens/QbankScreen.tsx +209 -79
  35. package/src/screens/QuestionScreen.tsx +185 -178
  36. package/src/screens/QuizStartScreen.tsx +127 -117
  37. package/src/screens/ResultScreen.tsx +13 -9
  38. package/src/screens/TopicListScreen.tsx +271 -116
  39. package/src/types/index.ts +10 -0
@@ -6,13 +6,19 @@ import {
6
6
  TouchableOpacity,
7
7
  SafeAreaView,
8
8
  StatusBar,
9
+ Image,
9
10
  } from 'react-native';
10
11
  import { useElearnConfig } from '../context/ElearnConfigContext';
11
12
  import { useTheme } from '../context/ThemeContext';
12
13
  import { Typography, Card, ProgressBar, Icon } from '../components';
14
+ import type { IconName } from '../components';
13
15
 
14
- export const QbankScreen: React.FC = () => {
15
- const { config, callbacks, getString } = useElearnConfig();
16
+ interface QbankScreenProps {
17
+ hideHeader?: boolean;
18
+ }
19
+
20
+ export const QbankScreen: React.FC<QbankScreenProps> = ({ hideHeader = false }) => {
21
+ const { config, callbacks } = useElearnConfig();
16
22
  const theme = useTheme();
17
23
 
18
24
  const courses = config.courses || [];
@@ -22,27 +28,76 @@ export const QbankScreen: React.FC = () => {
22
28
  <StatusBar barStyle="dark-content" />
23
29
 
24
30
  {/* Header */}
25
- <View style={styles.header}>
26
- <TouchableOpacity
27
- onPress={() => callbacks.onBackToDashboard?.()}
28
- style={[styles.backButton, { borderColor: theme.border }]}
29
- >
30
- <Icon name="arrow-left" size={20} color={theme.textPrimary} />
31
- </TouchableOpacity>
32
- <Typography variant="h2" bold style={styles.headerTitle}>
33
- {getString('qbankTitle')}
34
- </Typography>
35
- <View style={styles.headerRightPlaceholder} />
36
- </View>
31
+ {!hideHeader && (
32
+ <View style={styles.header}>
33
+ <TouchableOpacity
34
+ onPress={() => callbacks.onBackToDashboard?.()}
35
+ style={[styles.backButton, { borderColor: theme.border }]}
36
+ >
37
+ <Icon name="arrow-left" size={20} color={theme.textPrimary} />
38
+ </TouchableOpacity>
39
+ <Typography variant="h2" bold style={styles.headerTitle}>
40
+ QBank
41
+ </Typography>
42
+ <TouchableOpacity style={styles.searchButton}>
43
+ <Icon name="search" size={20} color={theme.textPrimary} />
44
+ </TouchableOpacity>
45
+ </View>
46
+ )}
37
47
 
38
48
  <ScrollView contentContainerStyle={styles.scrollContent} showsVerticalScrollIndicator={false}>
39
- <View style={styles.introSection}>
40
- <Typography variant="h1" bold color={theme.textPrimary}>
41
- {getString('qbankTitle')}
42
- </Typography>
43
- <Typography variant="body" color={theme.textSecondary} style={styles.introDesc}>
44
- {getString('qbankSubtitle')}
45
- </Typography>
49
+
50
+ {/* Promoted Premium Card */}
51
+ <Card style={styles.premiumCard}>
52
+ <View style={styles.premiumTextContainer}>
53
+ <Typography variant="h2" bold color={theme.textPrimary} style={styles.premiumTitle}>
54
+ More than 100+ Courses in premium
55
+ </Typography>
56
+ <Typography variant="caption" color={theme.textSecondary} style={styles.premiumSub}>
57
+ Advance your skills with top-rated, expert-led courses anytime
58
+ </Typography>
59
+ <TouchableOpacity style={[styles.premiumBtn, { backgroundColor: theme.primary }]}>
60
+ <Typography variant="caption" bold color="#FFFFFF">
61
+ Get Premium
62
+ </Typography>
63
+ </TouchableOpacity>
64
+ </View>
65
+ <View style={styles.premiumImageContainer}>
66
+ <Image
67
+ source={{ uri: 'https://images.unsplash.com/photo-1559839734-2b71ea197ec2?q=80&w=200&auto=format&fit=crop' }}
68
+ style={styles.premiumImage}
69
+ />
70
+ </View>
71
+ </Card>
72
+
73
+ {/* Quick Options */}
74
+ <View style={styles.optionsRow}>
75
+ <TouchableOpacity style={styles.optionBtn}>
76
+ <View style={[styles.optionIconContainer, { backgroundColor: 'rgba(59, 130, 246, 0.1)' }]}>
77
+ <Icon name="bookmark" size={18} color="#3B82F6" />
78
+ </View>
79
+ <Typography variant="caption" bold color={theme.textPrimary} style={styles.optionLabel}>
80
+ Bookmark
81
+ </Typography>
82
+ </TouchableOpacity>
83
+
84
+ <TouchableOpacity style={styles.optionBtn}>
85
+ <View style={[styles.optionIconContainer, { backgroundColor: 'rgba(16, 185, 129, 0.1)' }]}>
86
+ <Icon name="clipboard" size={18} color="#10B981" strokeWidth={1.5} />
87
+ </View>
88
+ <Typography variant="caption" bold color={theme.textPrimary} style={styles.optionLabel}>
89
+ Costume module
90
+ </Typography>
91
+ </TouchableOpacity>
92
+
93
+ <TouchableOpacity style={styles.optionBtn}>
94
+ <View style={[styles.optionIconContainer, { backgroundColor: 'rgba(168, 85, 247, 0.1)' }]}>
95
+ <Icon name="activity" size={18} color="#A855F7" />
96
+ </View>
97
+ <Typography variant="caption" bold color={theme.textPrimary} style={styles.optionLabel}>
98
+ Track Qbank
99
+ </Typography>
100
+ </TouchableOpacity>
46
101
  </View>
47
102
 
48
103
  {/* Subjects List */}
@@ -50,6 +105,42 @@ export const QbankScreen: React.FC = () => {
50
105
  {courses.map((course) => {
51
106
  const pct = Math.round(course.progress * 100);
52
107
 
108
+ // Map course icon name or fall back to diamond
109
+ let iconName: IconName = 'diamond';
110
+ let iconBg = 'rgba(249, 115, 22, 0.1)';
111
+ let iconColor = '#F97316';
112
+
113
+ const titleLower = course.title.toLowerCase();
114
+ if (titleLower.includes('anatomy')) {
115
+ iconName = 'diamond';
116
+ iconBg = 'rgba(251, 146, 60, 0.1)';
117
+ iconColor = '#EA580C';
118
+ } else if (titleLower.includes('biochem')) {
119
+ iconName = 'dna';
120
+ iconBg = 'rgba(168, 85, 247, 0.1)';
121
+ iconColor = '#A855F7';
122
+ } else if (titleLower.includes('physio')) {
123
+ iconName = 'user';
124
+ iconBg = 'rgba(239, 68, 68, 0.1)';
125
+ iconColor = '#EF4444';
126
+ } else if (titleLower.includes('ophthalmology')) {
127
+ iconName = 'eye';
128
+ iconBg = 'rgba(59, 130, 246, 0.1)';
129
+ iconColor = '#3B82F6';
130
+ } else if (titleLower.includes('pharmacology')) {
131
+ iconName = 'award';
132
+ iconBg = 'rgba(245, 158, 11, 0.1)';
133
+ iconColor = '#D97706';
134
+ } else if (titleLower.includes('microbiology')) {
135
+ iconName = 'atom';
136
+ iconBg = 'rgba(236, 72, 153, 0.1)';
137
+ iconColor = '#DB2777';
138
+ } else if (titleLower.includes('pathology')) {
139
+ iconName = 'flask';
140
+ iconBg = 'rgba(20, 184, 166, 0.1)';
141
+ iconColor = '#0D9488';
142
+ }
143
+
53
144
  return (
54
145
  <Card
55
146
  key={course.id}
@@ -57,36 +148,29 @@ export const QbankScreen: React.FC = () => {
57
148
  onPress={() => callbacks.onSelectCourse?.(course)}
58
149
  style={styles.subjectCard}
59
150
  >
60
- <View style={styles.cardHeader}>
61
- <View style={styles.cardHeaderLeft}>
62
- <View style={[styles.folderIconContainer, { backgroundColor: theme.secondary }]}>
63
- <Icon name="folder" size={22} color={theme.primary} />
64
- </View>
65
- <View style={styles.subjectInfo}>
66
- <Typography variant="h3" bold color={theme.textPrimary}>
67
- {course.title}
68
- </Typography>
151
+ <View style={styles.subjectRow}>
152
+ {/* Left Icon Container */}
153
+ <View style={[styles.subjectIconBox, { backgroundColor: iconBg }]}>
154
+ <Icon name={iconName} size={22} color={iconColor} />
155
+ </View>
156
+
157
+ {/* Right Content */}
158
+ <View style={styles.subjectInfo}>
159
+ <Typography variant="h3" bold color={theme.textPrimary} style={styles.subjectTitle}>
160
+ {course.title}
161
+ </Typography>
162
+
163
+ <ProgressBar progress={course.progress} height={6} style={styles.subjectProgressBar} />
164
+
165
+ <View style={styles.subjectStatsRow}>
69
166
  <Typography variant="caption" color={theme.textSecondary}>
70
- {course.topics.length} {getString('topicsLabel')}
167
+ {course.completedQuestions} / {course.totalQuestions} Modules
168
+ </Typography>
169
+ <Typography variant="caption" bold color={theme.textPrimary}>
170
+ {pct}%
71
171
  </Typography>
72
172
  </View>
73
173
  </View>
74
- <Typography variant="h3" bold color={theme.primary}>
75
- {pct}%
76
- </Typography>
77
- </View>
78
-
79
- {/* Progress Details */}
80
- <View style={styles.progressSection}>
81
- <ProgressBar progress={course.progress} style={styles.progressBar} />
82
- <View style={styles.progressTextRow}>
83
- <Typography variant="caption" color={theme.textSecondary}>
84
- {getString('questionsCountLabel')}
85
- </Typography>
86
- <Typography variant="caption" bold color={theme.textPrimary}>
87
- {course.completedQuestions}/{course.totalQuestions}
88
- </Typography>
89
- </View>
90
174
  </View>
91
175
  </Card>
92
176
  );
@@ -106,71 +190,117 @@ const styles = StyleSheet.create({
106
190
  flexDirection: 'row',
107
191
  justifyContent: 'space-between',
108
192
  alignItems: 'center',
109
- paddingHorizontal: 20,
193
+ paddingHorizontal: 16,
110
194
  paddingVertical: 12,
111
195
  },
112
196
  backButton: {
113
- width: 40,
114
- height: 40,
115
- borderRadius: 20,
116
- borderWidth: 1,
117
- justifyContent: 'center',
118
- alignItems: 'center',
197
+ padding: 6,
119
198
  },
120
199
  headerTitle: {
121
200
  fontSize: 18,
201
+ fontWeight: '700',
122
202
  },
123
- headerRightPlaceholder: {
124
- width: 40,
203
+ searchButton: {
204
+ padding: 6,
125
205
  },
126
206
  scrollContent: {
127
- paddingHorizontal: 20,
207
+ paddingHorizontal: 16,
128
208
  paddingBottom: 24,
129
209
  },
130
- introSection: {
131
- marginVertical: 16,
210
+ premiumCard: {
211
+ flexDirection: 'row',
212
+ backgroundColor: '#FFFFFF',
213
+ borderRadius: 16,
214
+ padding: 16,
215
+ marginTop: 12,
216
+ borderWidth: 1,
217
+ borderColor: '#E2E8F0',
132
218
  },
133
- introDesc: {
134
- marginTop: 4,
135
- lineHeight: 20,
219
+ premiumTextContainer: {
220
+ flex: 1.3,
221
+ justifyContent: 'center',
136
222
  },
137
- listContainer: {
138
- marginTop: 8,
223
+ premiumTitle: {
224
+ fontSize: 15,
225
+ lineHeight: 19,
226
+ marginBottom: 4,
139
227
  },
140
- subjectCard: {
141
- padding: 16,
142
- marginBottom: 12,
228
+ premiumSub: {
229
+ fontSize: 11,
230
+ lineHeight: 14,
231
+ marginBottom: 10,
143
232
  },
144
- cardHeader: {
145
- flexDirection: 'row',
146
- justifyContent: 'space-between',
233
+ premiumBtn: {
234
+ alignSelf: 'flex-start',
235
+ paddingHorizontal: 12,
236
+ paddingVertical: 6,
237
+ borderRadius: 8,
238
+ },
239
+ premiumImageContainer: {
240
+ flex: 0.7,
241
+ justifyContent: 'center',
147
242
  alignItems: 'center',
148
243
  },
149
- cardHeaderLeft: {
244
+ premiumImage: {
245
+ width: 70,
246
+ height: 70,
247
+ borderRadius: 35,
248
+ backgroundColor: '#E9D5FF', // Light purple
249
+ },
250
+ optionsRow: {
150
251
  flexDirection: 'row',
151
- alignItems: 'center',
252
+ justifyContent: 'space-between',
253
+ marginVertical: 16,
254
+ },
255
+ optionBtn: {
152
256
  flex: 1,
257
+ alignItems: 'center',
153
258
  },
154
- folderIconContainer: {
259
+ optionIconContainer: {
155
260
  width: 44,
156
261
  height: 44,
262
+ borderRadius: 22,
263
+ justifyContent: 'center',
264
+ alignItems: 'center',
265
+ marginBottom: 6,
266
+ },
267
+ optionLabel: {
268
+ fontSize: 12,
269
+ },
270
+ listContainer: {
271
+ marginTop: 4,
272
+ },
273
+ subjectCard: {
274
+ padding: 14,
275
+ marginBottom: 10,
276
+ borderRadius: 16,
277
+ },
278
+ subjectRow: {
279
+ flexDirection: 'row',
280
+ alignItems: 'center',
281
+ },
282
+ subjectIconBox: {
283
+ width: 48,
284
+ height: 48,
157
285
  borderRadius: 12,
158
286
  justifyContent: 'center',
159
287
  alignItems: 'center',
160
- marginRight: 12,
288
+ marginRight: 14,
161
289
  },
162
290
  subjectInfo: {
163
291
  flex: 1,
164
292
  },
165
- progressSection: {
166
- marginTop: 16,
293
+ subjectTitle: {
294
+ fontSize: 15,
295
+ marginBottom: 4,
167
296
  },
168
- progressBar: {
169
- marginBottom: 8,
297
+ subjectProgressBar: {
298
+ marginVertical: 4,
170
299
  },
171
- progressTextRow: {
300
+ subjectStatsRow: {
172
301
  flexDirection: 'row',
173
302
  justifyContent: 'space-between',
174
303
  alignItems: 'center',
304
+ marginTop: 2,
175
305
  },
176
306
  });