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

Function Routes

web-app/src/Routes.tsx:15–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13 * we have to implement a custom router here
14 */
15const Routes = () => {
16 const { context, route, send } = useStateMachine()
17
18 // TODO: handle only full page errors
19 if (context.error) {
20 return <ErrorView send={send} error={context.error} />
21 }
22
23 logger(
24 `ROUTE: "${route}": ${context.position?.complete ? 'Completed' : 'On'} level ${
25 context.position?.levelId || 'unknown'
26 }, step ${context.position?.stepId || 'unknown'}`,
27 )
28
29 return (
30 <Router route={route}>
31 {/* Setup */}
32 <Route paths={{ Setup: { Startup: true, ValidateSetup: true } }}>
33 <LoadingPage text="Launching..." processes={context.processes} />
34 </Route>
35 <Route paths={{ Setup: { Start: true } }}>
36 <StartPage send={send} context={context} />
37 </Route>
38 <Route paths={{ Setup: { SelectTutorial: true } }}>
39 <SelectTutorialPage send={send} context={context} />
40 </Route>
41 <Route paths={{ Setup: { SetupNewTutorial: true, StartTutorial: true } }}>
42 <LoadingPage text="Configuring tutorial..." />
43 </Route>
44 {/* Tutorial */}
45 <Route paths={{ Tutorial: { Level: { Load: true } } }}>
46 <LoadingPage text="Loading Level..." processes={context.processes} />
47 </Route>
48 <Route paths={{ Tutorial: { Reset: true } }}>
49 <LoadingPage text="Resetting tutorial..." processes={context.processes} />
50 </Route>
51 <Route paths={{ Tutorial: { Level: true, Completed: true } }}>
52 <TutorialPage send={send} context={context} state={route.replace('Tutorial.', '')} />
53 </Route>
54 </Router>
55 )
56}
57
58export default Routes

Callers

nothing calls this directly

Calls 2

useStateMachineFunction · 0.85
loggerFunction · 0.50

Tested by

no test coverage detected