@@ -3,17 +3,21 @@ import { RouteComponentProps, withRouter } from "react-router";
3
3
import { Container } from "reactstrap" ;
4
4
import { TitleAndBreadcrumb } from "../elements/TitleAndBreadcrumb" ;
5
5
import { useUrlPageTheme } from "../../services/pageContext" ;
6
- import { HUMAN_SUBJECTS , isDefined , LEARNING_STAGE , LearningStage , PHY_NAV_SUBJECTS , Subject } from "../../services" ;
7
- import { PageContextState } from "../../../IsaacAppTypes" ;
8
- import { ListViewCards } from "../elements/list-groups/ListView" ;
6
+ import { above , HUMAN_SUBJECTS , isDefined , LEARNING_STAGE , LearningStage , PHY_NAV_SUBJECTS , SEARCH_RESULT_TYPE , Subject , useDeviceSize } from "../../services" ;
7
+ import { PageContextState , ShortcutResponse } from "../../../IsaacAppTypes" ;
8
+ import { ListView , ListViewCardProps , ListViewCards } from "../elements/list-groups/ListView" ;
9
9
import { LandingPageFooter } from "./SubjectLandingPage" ;
10
+ import { DifficultyIcon } from "../elements/svg/DifficultyIcons" ;
11
+ import { AbstractListViewItemState } from "../elements/list-groups/AbstractListViewItem" ;
10
12
11
13
const SubjectCards = ( { context} : { context : PageContextState } ) => {
14
+ const deviceSize = useDeviceSize ( ) ;
15
+
12
16
if ( ! isDefined ( context ?. subject ) ) return null ;
13
17
14
18
const humanSubject = context ?. subject && HUMAN_SUBJECTS [ context . subject ] ;
15
19
16
- return < ListViewCards showBlanks cards = { [
20
+ const cards : ( ListViewCardProps | null ) [ ] = [
17
21
{
18
22
item : {
19
23
title : "11-14" ,
@@ -25,6 +29,7 @@ const SubjectCards = ({context}: { context: PageContextState }) => {
25
29
} ,
26
30
url : `/${ context . subject } /11_14` ,
27
31
stage : LEARNING_STAGE [ "11_TO_14" ] ,
32
+ subject : context . subject ,
28
33
} ,
29
34
{
30
35
item : {
@@ -37,6 +42,8 @@ const SubjectCards = ({context}: { context: PageContextState }) => {
37
42
} ,
38
43
url : `/${ context . subject } /gcse` ,
39
44
stage : LEARNING_STAGE . GCSE ,
45
+ subject : context . subject ,
46
+ state : context . subject === "biology" ? AbstractListViewItemState . COMING_SOON : undefined ,
40
47
} ,
41
48
{
42
49
item : {
@@ -49,6 +56,7 @@ const SubjectCards = ({context}: { context: PageContextState }) => {
49
56
} ,
50
57
url : `/${ context . subject } /a_level` ,
51
58
stage : LEARNING_STAGE . A_LEVEL ,
59
+ subject : context . subject ,
52
60
} ,
53
61
{
54
62
item : {
@@ -61,14 +69,43 @@ const SubjectCards = ({context}: { context: PageContextState }) => {
61
69
} ,
62
70
url : `/${ context . subject } /university` ,
63
71
stage : LEARNING_STAGE . UNIVERSITY ,
64
- }
65
- ]
66
- . map ( ( { stage, ...card } ) => ( PHY_NAV_SUBJECTS [ context . subject as Subject ] as readonly LearningStage [ ] ) ?. includes ( stage ) ? card : null )
67
- . filter ( ( x , i , a ) => x || ( i % 2 === 0 ? a [ i + 1 ] : a [ i - 1 ] ) ) // remove pairs of nulls
72
+ subject : context . subject ,
73
+ } ,
74
+ ] . map ( ( { stage, ...card } ) => ( PHY_NAV_SUBJECTS [ context . subject as Subject ] as readonly LearningStage [ ] ) ?. includes ( stage ) || card . state === AbstractListViewItemState . COMING_SOON ? card : null ) ;
75
+
76
+ return < ListViewCards showBlanks = { above [ "lg" ] ( deviceSize ) } cards = { cards
68
77
. sort ( ( a , b ) => a ? ( b ? 0 : - 1 ) : 1 ) // put nulls at the end
78
+ . filter ( ( x , i , a ) => x || ( i % 2 === 0 ? a [ i + 1 ] : a [ i - 1 ] ) ) // remove pairs of nulls
69
79
} /> ;
70
80
} ;
71
81
82
+ const ExampleQuestions = ( { subject, className } : { subject : Subject , className : string } ) => {
83
+ const items : { [ key in Subject ] : ShortcutResponse [ ] } = {
84
+ maths : [ {
85
+ title : "Sample Maths Questions" ,
86
+ type : SEARCH_RESULT_TYPE . GAMEBOARD ,
87
+ id : "sample_maths_questions" ,
88
+ } ] ,
89
+ physics : [ /*{
90
+ title: "Sample Physics Questions",
91
+ type: SEARCH_RESULT_TYPE.GAMEBOARD,
92
+ id: "sample_phy_questions",
93
+ }*/ ] , // Uncomment when physics questions are available
94
+ chemistry : [ {
95
+ title : "Sample Chemistry Questions" ,
96
+ type : SEARCH_RESULT_TYPE . GAMEBOARD ,
97
+ id : "sample_chem_questions" ,
98
+ } ] ,
99
+ biology : [ {
100
+ title : "Sample Biology Questions" ,
101
+ type : SEARCH_RESULT_TYPE . GAMEBOARD ,
102
+ id : "sample_bio_questions" ,
103
+ } ] ,
104
+ } ;
105
+
106
+ return items [ subject ] . length > 0 ? < ListView className = { className } items = { items [ subject ] } /> : null ;
107
+ } ;
108
+
72
109
export const SubjectOverviewPage = withRouter ( ( props : RouteComponentProps ) => {
73
110
const pageContext = useUrlPageTheme ( ) ;
74
111
@@ -112,15 +149,30 @@ export const SubjectOverviewPage = withRouter((props: RouteComponentProps) => {
112
149
113
150
< p className = "mt-3" >
114
151
All Isaac Science questions are classed as either "Practice" or "Challenge" – indicated by the symbols below.
152
+ </ p >
153
+
154
+ < div className = "d-flex flex-row w-100 justify-content-center" >
155
+ < div className = "d-flex flex-column me-3 align-items-center" >
156
+ < DifficultyIcon difficultyCategory = "P" />
157
+ < span > Practice</ span >
158
+ </ div >
159
+ < div className = "d-flex flex-column align-items-center" >
160
+ < DifficultyIcon difficultyCategory = "C" />
161
+ < span > Challenge</ span >
162
+ </ div >
163
+ </ div >
115
164
165
+ < p className = "mt-3" >
116
166
In Isaac { humanSubject } ,
117
167
< ul >
118
168
< li > Practice questions are those that require one concept or equation to solve.</ li >
119
169
< li > Challenge questions are those that require one or more concepts, or require more creativity to solve the problem, helping to develop important problem solving skills. </ li >
120
170
</ ul >
121
171
</ p >
122
172
123
- { /* <ExampleQuestions/> */ }
173
+ < div className = "d-flex justify-content-center mt-4" >
174
+ < ExampleQuestions className = "w-100 w-md-75" subject = { pageContext . subject } />
175
+ </ div >
124
176
125
177
< LandingPageFooter context = { pageContext } />
126
178
</ div > }
0 commit comments