+
{{#if (and (not this.shouldHideCompletionNotice) @step.completionNoticeMessage)}}
{{svg-jar "arrow-right" class="w-4 h-4 fill-current text-teal-500"}}
+ {{else if (eq @step.type "PreChallengeAssessmentStep")}}
+
+ {{svg-jar "dots-horizontal" class="w-4 h-4 fill-current text-teal-500"}}
+
{{else if (eq @step.type "CourseStageStep")}}
{{svg-jar "dots-horizontal" class="w-4 h-4 fill-current text-teal-500"}}
diff --git a/app/controllers/course/pre-challenge-assessment.ts b/app/controllers/course/pre-challenge-assessment.ts
new file mode 100644
index 0000000000..7b26908f13
--- /dev/null
+++ b/app/controllers/course/pre-challenge-assessment.ts
@@ -0,0 +1,17 @@
+import Controller from '@ember/controller';
+import { inject as service } from '@ember/service';
+import type AuthenticatorService from 'codecrafters-frontend/services/authenticator';
+import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state';
+import type { ModelType as CourseRouteModelType } from 'codecrafters-frontend/routes/course';
+import type Step from 'codecrafters-frontend/utils/course-page-step-list/step';
+
+export default class PreChallengeAssessmentController extends Controller {
+ declare model: CourseRouteModelType;
+
+ @service declare authenticator: AuthenticatorService;
+ @service declare coursePageState: CoursePageStateService;
+
+ get currentStep(): Step {
+ return this.coursePageState.currentStep as Step;
+ }
+}
diff --git a/app/router.ts b/app/router.ts
index 40f7389cf6..8aedef2a2d 100644
--- a/app/router.ts
+++ b/app/router.ts
@@ -46,6 +46,7 @@ Router.map(function () {
// TODO: Add dark mode support
this.route('course', { path: '/courses/:course_slug' }, function () {
this.route('introduction');
+ this.route('pre-challenge-assessment');
this.route('setup');
// Stage identifier either be '1' (for base stages) or 'ext2:1' (for extension stages)
diff --git a/app/templates/course/introduction.hbs b/app/templates/course/introduction.hbs
index 4dfd607487..4c1667ef06 100644
--- a/app/templates/course/introduction.hbs
+++ b/app/templates/course/introduction.hbs
@@ -7,11 +7,13 @@
/>
{{/if}}
-
-
+
+ {{!--
+
+ /> --}}
\ No newline at end of file
diff --git a/app/templates/course/pre-challenge-assessment.hbs b/app/templates/course/pre-challenge-assessment.hbs
new file mode 100644
index 0000000000..3ca187fa2d
--- /dev/null
+++ b/app/templates/course/pre-challenge-assessment.hbs
@@ -0,0 +1,13 @@
+
+
+
+ Complete the pre-challenge assessment below to proceed:
+
+
+
+
+
\ No newline at end of file
diff --git a/app/utils/course-page-step-list.ts b/app/utils/course-page-step-list.ts
index 5ddf97903a..552807517f 100644
--- a/app/utils/course-page-step-list.ts
+++ b/app/utils/course-page-step-list.ts
@@ -10,6 +10,7 @@ import RepositoryStageListItemModel from 'codecrafters-frontend/models/repositor
import CourseCompletedStep from 'codecrafters-frontend/utils/course-page-step-list/course-completed-step';
import CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step';
import IntroductionStep from 'codecrafters-frontend/utils/course-page-step-list/introduction-step';
+import PreChallengeAssessmentStep from 'codecrafters-frontend/utils/course-page-step-list/pre-challenge-assessment-step';
import SetupStep from 'codecrafters-frontend/utils/course-page-step-list/setup-step';
import Step from 'codecrafters-frontend/utils/course-page-step-list/step';
import StepGroup from 'codecrafters-frontend/utils/course-page-step-list/step-group';
@@ -31,6 +32,7 @@ export class StepList {
const steps: Step[] = [];
steps.push(new IntroductionStep(this.repository));
+ steps.push(new PreChallengeAssessmentStep(this.repository));
steps.push(new SetupStep(this.repository));
if (!this.repository.stageList) {
diff --git a/app/utils/course-page-step-list/introduction-step.ts b/app/utils/course-page-step-list/introduction-step.ts
index 2114674d3b..1c6c728cd3 100644
--- a/app/utils/course-page-step-list/introduction-step.ts
+++ b/app/utils/course-page-step-list/introduction-step.ts
@@ -15,13 +15,7 @@ export default class IntroductionStep extends Step {
if (this.status === 'complete') {
return {
dotType: 'none',
- text: 'Introduction complete.',
- };
- } else if (this.status === 'in_progress') {
- return {
- dotColor: 'yellow',
- dotType: 'blinking',
- text: 'Complete pre-challenge assessment to proceed',
+ text: 'Language selected.',
};
} else {
return {
@@ -40,27 +34,11 @@ export default class IntroductionStep extends Step {
}
get status() {
- // @ts-ignore
- if (this.repository.isNew) {
- return 'not_started';
- }
-
- // Old users don't have a pre-challenge assessment, let's still show this as completed for them.
- // @ts-ignore
- if (this.repository.firstSubmissionCreated) {
- return 'complete';
- }
-
- // @ts-ignore
- if (this.repository.preChallengeAssessmentSectionList.isComplete) {
- return 'complete';
- }
-
- return 'in_progress';
+ return this.repository.language ? 'complete' : 'not_started';
}
get title() {
- return 'Introduction';
+ return 'Select language';
}
get type(): 'IntroductionStep' {
diff --git a/app/utils/course-page-step-list/pre-challenge-assessment-step.ts b/app/utils/course-page-step-list/pre-challenge-assessment-step.ts
new file mode 100644
index 0000000000..f164ee2842
--- /dev/null
+++ b/app/utils/course-page-step-list/pre-challenge-assessment-step.ts
@@ -0,0 +1,51 @@
+import Step from 'codecrafters-frontend/utils/course-page-step-list/step';
+import type ProgressIndicator from 'codecrafters-frontend/utils/course-page-step-list/progress-indicator';
+import { tracked } from '@glimmer/tracking';
+import type RepositoryModel from 'codecrafters-frontend/models/repository';
+
+export default class PreChallengeAssessmentStep extends Step {
+ @tracked repository: RepositoryModel;
+
+ constructor(repository: RepositoryModel) {
+ super();
+
+ this.repository = repository;
+ }
+
+ get progressIndicator(): ProgressIndicator | null {
+ if (this.status === 'complete') {
+ return {
+ dotType: 'none',
+ text: 'Pre-challenge assessment complete.',
+ };
+ } else {
+ return {
+ dotType: 'none',
+ text: 'Complete pre-challenge assessment to proceed',
+ };
+ }
+ }
+
+ get routeParams() {
+ return {
+ route: 'course.pre-challenge-assessment',
+ models: [this.repository.course.slug],
+ };
+ }
+
+ get status() {
+ if (!this.repository.language) {
+ return 'locked';
+ }
+
+ return this.repository.preChallengeAssessmentSectionList.isComplete ? 'complete' : 'in_progress';
+ }
+
+ get title() {
+ return 'Pre-challenge assessment';
+ }
+
+ get type(): 'PreChallengeAssessmentStep' {
+ return 'PreChallengeAssessmentStep';
+ }
+}
diff --git a/app/utils/course-page-step-list/step.ts b/app/utils/course-page-step-list/step.ts
index e6e5ab4053..4d19598377 100644
--- a/app/utils/course-page-step-list/step.ts
+++ b/app/utils/course-page-step-list/step.ts
@@ -3,6 +3,7 @@ import { type ProgressIndicatorWithDot } from 'codecrafters-frontend/utils/cours
export type StepType =
| 'IntroductionStep'
+ | 'PreChallengeAssessmentStep'
| 'SetupStep'
| 'CourseStageStep'
| 'BaseStagesCompletedStep'
diff --git a/app/utils/pre-challenge-assessment-section-list.ts b/app/utils/pre-challenge-assessment-section-list.ts
index ed1ac2ce06..62336f9d8e 100644
--- a/app/utils/pre-challenge-assessment-section-list.ts
+++ b/app/utils/pre-challenge-assessment-section-list.ts
@@ -139,7 +139,6 @@ export class SectionList {
export function buildSectionList(repository: RepositoryModel) {
return new SectionList([
- new SelectLanguageSection(repository),
new SelectLanguageProficiencyLevelSection(repository),
new SelectExpectedActivityFrequencySection(repository),
new SelectRemindersPreferenceSection(repository),
diff --git a/tests/acceptance/course-page/complete-first-stage-test.js b/tests/acceptance/course-page/complete-first-stage-test.js
index 80460ed8af..ba7fdb5544 100644
--- a/tests/acceptance/course-page/complete-first-stage-test.js
+++ b/tests/acceptance/course-page/complete-first-stage-test.js
@@ -44,6 +44,8 @@ module('Acceptance | course-page | complete-first-stage', function (hooks) {
assert.notOk(coursePage.firstStageTutorialCard.steps[1].isComplete, 'Second step is not complete');
assert.notOk(coursePage.firstStageTutorialCard.steps[1].isExpanded, 'Second step is not expanded');
+ // await this.pauseTest();
+
await coursePage.firstStageTutorialCard.steps[0].click();
assert.notOk(coursePage.firstStageTutorialCard.steps[0].isComplete, 'First step is not complete');
diff --git a/tests/acceptance/course-page/start-course-test.js b/tests/acceptance/course-page/start-course-test.js
index 8116dcf784..62a46df992 100644
--- a/tests/acceptance/course-page/start-course-test.js
+++ b/tests/acceptance/course-page/start-course-test.js
@@ -54,6 +54,7 @@ module('Acceptance | course-page | start-course', function (hooks) {
await catalogPage.visit();
await catalogPage.clickOnCourse('Build your own Dummy');
await courseOverviewPage.clickOnStartCourse();
+ await this.pauseTest();
assert.strictEqual(currentURL(), '/courses/dummy/introduction', 'current URL is course page URL');