refactor: clean up unused lesson imports and improve code consistency
This commit is contained in:
@@ -92,7 +92,7 @@ async function initializeModules() {
|
|||||||
const progressData = lessonEngine.loadUserProgress();
|
const progressData = lessonEngine.loadUserProgress();
|
||||||
const lastModuleId = progressData?.lastModuleId;
|
const lastModuleId = progressData?.lastModuleId;
|
||||||
|
|
||||||
if (lastModuleId && modules.find(m => m.id === lastModuleId)) {
|
if (lastModuleId && modules.find((m) => m.id === lastModuleId)) {
|
||||||
selectModule(lastModuleId);
|
selectModule(lastModuleId);
|
||||||
} else if (modules.length > 0) {
|
} else if (modules.length > 0) {
|
||||||
selectModule(modules[0].id);
|
selectModule(modules[0].id);
|
||||||
|
|||||||
@@ -5,34 +5,10 @@
|
|||||||
// Import lesson configs
|
// Import lesson configs
|
||||||
import basicSelectorsConfig from "../../lessons/00-basic-selectors.json";
|
import basicSelectorsConfig from "../../lessons/00-basic-selectors.json";
|
||||||
import advancedSelectorsConfig from "../../lessons/01-advanced-selectors.json";
|
import advancedSelectorsConfig from "../../lessons/01-advanced-selectors.json";
|
||||||
import carouselConfig from "../../lessons/02-css-only-carousel.json";
|
|
||||||
// import basicsConfig from "../../lessons/00-basics.json";
|
|
||||||
// import boxModelConfig from "../../lessons/01-box-model.json";
|
|
||||||
// import selectorsConfig from "../../lessons/02-selectors.json";
|
|
||||||
// import colorsConfig from "../../lessons/03-colors.json";
|
|
||||||
// import typographyConfig from "../../lessons/04-typography.json";
|
|
||||||
import unitVariablesConfig from "../../lessons/05-units-variables.json";
|
|
||||||
// import transitionsAnimationsConfig from "../../lessons/06-transitions-animations.json";
|
|
||||||
// import layoutConfig from "../../lessons/07-layouts.json";
|
|
||||||
// import responsiveConfig from "../../lessons/08-responsive.json";
|
|
||||||
import tailwindConfig from "../../lessons/10-tailwind-basics.json";
|
import tailwindConfig from "../../lessons/10-tailwind-basics.json";
|
||||||
|
|
||||||
// Module store
|
// Module store
|
||||||
const moduleStore = [
|
const moduleStore = [basicSelectorsConfig, advancedSelectorsConfig, tailwindConfig];
|
||||||
// basicsConfig,
|
|
||||||
basicSelectorsConfig,
|
|
||||||
advancedSelectorsConfig,
|
|
||||||
tailwindConfig
|
|
||||||
// carouselConfig
|
|
||||||
// boxModelConfig,
|
|
||||||
// selectorsConfig,
|
|
||||||
// colorsConfig
|
|
||||||
// typographyConfig,
|
|
||||||
// unitVariablesConfig
|
|
||||||
// transitionsAnimationsConfig,
|
|
||||||
// layoutConfig,
|
|
||||||
// responsiveConfig
|
|
||||||
];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load all available modules
|
* Load all available modules
|
||||||
|
|||||||
@@ -3,7 +3,6 @@
|
|||||||
* Single source of truth for lesson state and progress
|
* Single source of truth for lesson state and progress
|
||||||
*/
|
*/
|
||||||
import { validateUserCode } from "../helpers/validator.js";
|
import { validateUserCode } from "../helpers/validator.js";
|
||||||
import { showFeedback } from "../helpers/renderer.js";
|
|
||||||
|
|
||||||
export class LessonEngine {
|
export class LessonEngine {
|
||||||
constructor() {
|
constructor() {
|
||||||
@@ -55,7 +54,7 @@ export class LessonEngine {
|
|||||||
* @returns {boolean} Whether the operation was successful
|
* @returns {boolean} Whether the operation was successful
|
||||||
*/
|
*/
|
||||||
setModuleById(moduleId) {
|
setModuleById(moduleId) {
|
||||||
const module = this.modules.find(m => m.id === moduleId);
|
const module = this.modules.find((m) => m.id === moduleId);
|
||||||
if (!module) return false;
|
if (!module) return false;
|
||||||
|
|
||||||
this.setModule(module);
|
this.setModule(module);
|
||||||
|
|||||||
Reference in New Issue
Block a user