File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change 11import { get } from 'svelte/store'
22import { tutorialsToDo , skippedAll } from './stores'
33import { UserService } from './gen'
4+ import { TUTORIALS_CONFIG } from './tutorials/config'
45
5- const MAX_TUTORIAL_ID = 7
6+ /**
7+ * Get the maximum tutorial index from the config.
8+ * This ensures we don't hardcode the max ID and it automatically updates when tutorials are added.
9+ */
10+ function getMaxTutorialId ( ) : number {
11+ let maxId = 0
12+ for ( const tab of Object . values ( TUTORIALS_CONFIG ) ) {
13+ for ( const tutorial of tab . tutorials ) {
14+ if ( tutorial . index !== undefined && tutorial . index > maxId ) {
15+ maxId = tutorial . index
16+ }
17+ }
18+ }
19+ return maxId
20+ }
21+
22+ const MAX_TUTORIAL_ID = getMaxTutorialId ( )
623
724/**
825 * Helper function to calculate tutorial progress for a given set of tutorial indexes.
You can’t perform that action at this time.
0 commit comments