@@ -3,13 +3,15 @@ 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 { ListViewCardProps , ListViewCards } from "../elements/list-groups/ListView" ;
6
+ import { above , HUMAN_SUBJECTS , isDefined , LEARNING_STAGE , LearningStage , PHY_NAV_SUBJECTS , SEARCH_RESULT_TYPE , subject , Subject , SUBJECTS , useDeviceSize } from "../../services" ;
7
+ import { PageContextState , ShortcutResponse } from "../../../IsaacAppTypes" ;
8
+ import { ListView , ListViewCardProps , ListViewCards , QuestionDeckListViewItem } from "../elements/list-groups/ListView" ;
9
9
import { LandingPageFooter } from "./SubjectLandingPage" ;
10
10
import { DifficultyIcon } from "../elements/svg/DifficultyIcons" ;
11
11
12
12
const SubjectCards = ( { context} : { context : PageContextState } ) => {
13
+ const deviceSize = useDeviceSize ( ) ;
14
+
13
15
if ( ! isDefined ( context ?. subject ) ) return null ;
14
16
15
17
const humanSubject = context ?. subject && HUMAN_SUBJECTS [ context . subject ] ;
@@ -77,14 +79,41 @@ const SubjectCards = ({context}: { context: PageContextState }) => {
77
79
icon : `/assets/phy/icons/redesign/subject-${ context . subject } .svg` ,
78
80
}
79
81
} ) ;
80
- } //hrm
82
+ }
81
83
82
- return < ListViewCards showBlanks cards = { cards
84
+ return < ListViewCards showBlanks = { above [ "lg" ] ( deviceSize ) } cards = { cards
83
85
. sort ( ( a , b ) => a ? ( b ? 0 : - 1 ) : 1 ) // put nulls at the end
84
86
. filter ( ( x , i , a ) => x || ( i % 2 === 0 ? a [ i + 1 ] : a [ i - 1 ] ) ) // remove pairs of nulls
85
87
} /> ;
86
88
} ;
87
89
90
+ const ExampleQuestions = ( { subject } : { subject : Subject } ) => {
91
+ const items : { [ key in Subject ] : ShortcutResponse [ ] } = {
92
+ maths : [ {
93
+ title : "Sample Maths Questions" ,
94
+ type : SEARCH_RESULT_TYPE . QUESTION_DECK ,
95
+ id : "sample_maths_questions" ,
96
+ } ] ,
97
+ physics : [ /*{
98
+ title: "Sample Physics Questions",
99
+ type: SEARCH_RESULT_TYPE.QUESTION_DECK,
100
+ id: "sample_phy_questions",
101
+ }*/ ] , // Uncomment when physics questions are available
102
+ chemistry : [ {
103
+ title : "Sample Chemistry Questions" ,
104
+ type : SEARCH_RESULT_TYPE . QUESTION_DECK ,
105
+ id : "sample_chem_questions" ,
106
+ } ] ,
107
+ biology : [ {
108
+ title : "Sample Biology Questions" ,
109
+ type : SEARCH_RESULT_TYPE . QUESTION_DECK ,
110
+ id : "sample_bio_questions" ,
111
+ } ] ,
112
+ } ;
113
+
114
+ return items [ subject ] . length > 0 ? < ListView items = { items [ subject ] } /> : null ;
115
+ } ;
116
+
88
117
export const SubjectOverviewPage = withRouter ( ( props : RouteComponentProps ) => {
89
118
const pageContext = useUrlPageTheme ( ) ;
90
119
@@ -149,7 +178,7 @@ export const SubjectOverviewPage = withRouter((props: RouteComponentProps) => {
149
178
</ ul >
150
179
</ p >
151
180
152
- { /* <ExampleQuestions/> */ }
181
+ < ExampleQuestions subject = { pageContext . subject } />
153
182
154
183
< LandingPageFooter context = { pageContext } />
155
184
</ div > }
0 commit comments