MCPcopy Create free account
hub / github.com/coderoad/coderoad-vscode / TutorialPage

Function TutorialPage

web-app/src/containers/Tutorial/index.tsx:102–244  ·  view source on GitHub ↗
(props: PageProps)

Source from the content-addressed store, hash-verified

100 */
101
102const TutorialPage = (props: PageProps) => {
103 const theme: Theme = useTheme()
104 const { position, processes, testStatus } = props.context
105
106 const tutorial = selectors.currentTutorial(props.context)
107
108 const onContinue = (): void => {
109 props.send({
110 type: 'NEXT_LEVEL',
111 })
112 }
113
114 const onRunTest = (): void => {
115 props.send({ type: 'RUN_TEST' })
116 }
117
118 const onReset = (): void => {
119 props.send({ type: 'RUN_RESET' })
120 }
121
122 const onResetToPosition = (position: T.Position): void => {
123 props.send({ type: 'RUN_RESET_TO_POSITION', payload: { position } })
124 }
125
126 const [menuVisible, setMenuVisible] = React.useState(false)
127
128 const [page, setPage] = React.useState<'level' | 'review' | 'settings'>('level')
129
130 const onSettingsReset = () => {
131 //Reset to first level first step
132 const level: T.LevelUI | null = levels.length ? levels[1] : null
133 if (level) {
134 onResetToPosition({
135 levelId: level.id,
136 stepId: level.steps.length ? level.steps[0].id : null,
137 complete: false,
138 })
139 setPage('level')
140 }
141 }
142 // format level code with status for easy rendering
143 const { level, levels, levelIndex, stepIndex } = formatLevels({
144 position,
145 levels: tutorial.levels,
146 testStatus,
147 })
148
149 const disableOptions = processes.length > 0 || props.state === 'Level.TestRunning'
150
151 return (
152 <div>
153 <div css={styles.page}>
154 <div css={styles.header}>
155 <a onClick={() => setMenuVisible(!menuVisible)}>
156 <Icon type="toggle-left" size="small" style={styles.menuIcon(theme)} />
157 </a>
158 <span css={styles.title}>{tutorial.summary.title}</span>
159 </div>

Callers

nothing calls this directly

Calls 2

formatLevelsFunction · 0.85
sendMethod · 0.65

Tested by

no test coverage detected