@@ -5,30 +5,30 @@ import { SourceError } from '../slang/types'
55import { HistoryHelper } from '../utils/history'
66
77export interface IState {
8+ readonly academy : IAcademyState
89 readonly application : IApplicationState
9- readonly game : IGameState
1010 readonly playground : IPlaygroundState
1111 readonly session : ISessionState
1212}
1313
14+ export interface IAcademyState {
15+ readonly gameCanvas ?: HTMLCanvasElement
16+ }
17+
1418export interface IApplicationState {
1519 readonly title : string
1620 readonly environment : ApplicationEnvironment
1721}
1822
19- export const sourceChapters = [ 1 , 2 ]
20- const latestSourceChapter = sourceChapters . slice ( - 1 ) [ 0 ]
21-
22- export interface IGameState {
23- readonly canvas ?: HTMLCanvasElement
23+ export interface IPlaygroundState extends IWorkspaceState {
24+ readonly queryString ?: string
2425}
2526
26- export interface IPlaygroundState {
27+ interface IWorkspaceState {
2728 readonly context : Context
2829 readonly editorValue : string
2930 readonly editorWidth : string
3031 readonly isRunning : boolean
31- readonly queryString ?: string
3232 readonly output : InterpreterOutput [ ]
3333 readonly replValue : string
3434 readonly sourceChapter : number
@@ -37,11 +37,11 @@ export interface IPlaygroundState {
3737}
3838
3939export interface ISessionState {
40+ readonly assessmentOverviews ?: IAssessmentOverview [ ]
41+ readonly assessments : Map < number , IAssessment >
4042 readonly announcements ?: Announcement [ ]
4143 readonly historyHelper : HistoryHelper
4244 readonly token ?: string
43- readonly assessments : Map < number , IAssessment >
44- readonly assessmentOverviews ?: IAssessmentOverview [ ]
4545 readonly username ?: string
4646}
4747
@@ -97,6 +97,9 @@ export enum ApplicationEnvironment {
9797 Test = 'test'
9898}
9999
100+ export const sourceChapters = [ 1 , 2 ]
101+ const latestSourceChapter = sourceChapters . slice ( - 1 ) [ 0 ]
102+
100103const currentEnvironment = ( ) : ApplicationEnvironment => {
101104 switch ( process . env . NODE_ENV ) {
102105 case 'development' :
@@ -108,15 +111,15 @@ const currentEnvironment = (): ApplicationEnvironment => {
108111 }
109112}
110113
114+ export const defaultAcademy : IAcademyState = {
115+ gameCanvas : undefined
116+ }
117+
111118export const defaultApplication : IApplicationState = {
112119 title : 'Cadet' ,
113120 environment : currentEnvironment ( )
114121}
115122
116- export const defaultGame : IGameState = {
117- canvas : undefined
118- }
119-
120123export const defaultPlayground : IPlaygroundState = {
121124 context : createContext ( latestSourceChapter ) ,
122125 editorValue : '' ,
0 commit comments