diff --git a/app/components/course-page/previous-steps-incomplete-overlay.hbs b/app/components/course-page/previous-steps-incomplete-overlay.hbs new file mode 100644 index 0000000000..efde57356f --- /dev/null +++ b/app/components/course-page/previous-steps-incomplete-overlay.hbs @@ -0,0 +1,17 @@ + + <:content> + {{yield}} + + <:overlay> + + + \ No newline at end of file diff --git a/app/components/course-page/previous-steps-incomplete-overlay.ts b/app/components/course-page/previous-steps-incomplete-overlay.ts new file mode 100644 index 0000000000..bf862303cc --- /dev/null +++ b/app/components/course-page/previous-steps-incomplete-overlay.ts @@ -0,0 +1,55 @@ +import { action } from '@ember/object'; +import { tracked } from '@glimmer/tracking'; +import { service } from '@ember/service'; +import Component from '@glimmer/component'; +import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state'; +import { Step } from 'codecrafters-frontend/utils/course-page-step-list'; + +interface Signature { + Element: HTMLDivElement; + + Args: { + currentStep: Step; + }; + + Blocks: { + default: []; + }; +} + +export default class PreviousStepsIncompleteOverlayComponent extends Component { + @tracked modalWasDismissed = false; + @tracked lastSeenStepId: string | null = null; + + @service declare coursePageState: CoursePageStateService; + + get shouldShowModal(): boolean { + // This _shouldn't_ happen as long as we're always rendered in the course page, but let's be safe + if (!this.coursePageState.activeStep) { + return false; + } + + return !this.modalWasDismissed && this.args.currentStep.status === 'locked'; + } + + @action + handleModalDismissed() { + this.modalWasDismissed = true; + } + + @action + handleStepIdUpdated() { + if (this.args.currentStep.id === this.lastSeenStepId) { + return; + } + + this.lastSeenStepId = this.args.currentStep.id; + this.modalWasDismissed = false; + } +} + +declare module '@glint/environment-ember-loose/registry' { + export default interface Registry { + 'CoursePage::PreviousStepsIncompleteOverlay': typeof PreviousStepsIncompleteOverlayComponent; + } +} diff --git a/app/components/course-page/step-content.hbs b/app/components/course-page/step-content.hbs index ab9fe9dde7..fcb0b4a5db 100644 --- a/app/components/course-page/step-content.hbs +++ b/app/components/course-page/step-content.hbs @@ -9,21 +9,5 @@ /> {{/if}} - - <:content> - {{yield}} - - <:overlay> - - - + {{yield}} \ No newline at end of file diff --git a/app/controllers/course/setup.ts b/app/controllers/course/setup.ts index 1792cea08e..0c49d841a6 100644 --- a/app/controllers/course/setup.ts +++ b/app/controllers/course/setup.ts @@ -2,9 +2,14 @@ import Controller from '@ember/controller'; import { inject as service } from '@ember/service'; import type { ModelType } from 'codecrafters-frontend/routes/course/setup'; import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state'; +import type { Step } from 'codecrafters-frontend/utils/course-page-step-list'; export default class CourseSetupController extends Controller { declare model: ModelType; @service declare coursePageState: CoursePageStateService; + + get currentStep(): Step { + return this.coursePageState.activeStep as Step; + } } diff --git a/app/templates/course/base-stages-completed.hbs b/app/templates/course/base-stages-completed.hbs index 2bad2dc901..5015a5443c 100644 --- a/app/templates/course/base-stages-completed.hbs +++ b/app/templates/course/base-stages-completed.hbs @@ -1,3 +1,3 @@ -
+
\ No newline at end of file diff --git a/app/templates/course/completed.hbs b/app/templates/course/completed.hbs index 4afda47912..485610c7bc 100644 --- a/app/templates/course/completed.hbs +++ b/app/templates/course/completed.hbs @@ -1,4 +1,4 @@ {{! @glint-nocheck: not typesafe yet !}} -
+
\ No newline at end of file diff --git a/app/templates/course/extension-completed.hbs b/app/templates/course/extension-completed.hbs index 18c9035bb3..d8a754a3fc 100644 --- a/app/templates/course/extension-completed.hbs +++ b/app/templates/course/extension-completed.hbs @@ -1,3 +1,3 @@ -
+
\ No newline at end of file diff --git a/app/templates/course/introduction.hbs b/app/templates/course/introduction.hbs index ffe25d8baa..a159e80fce 100644 --- a/app/templates/course/introduction.hbs +++ b/app/templates/course/introduction.hbs @@ -1,4 +1,4 @@ -
+
{{#if this.authenticator.currentUser.pendingProductWalkthroughFeatureSuggestion}} - -
\ No newline at end of file + +
+ +
+
\ No newline at end of file diff --git a/app/templates/course/stage/code-examples.hbs b/app/templates/course/stage/code-examples.hbs index f3275a25a0..30bac05867 100644 --- a/app/templates/course/stage/code-examples.hbs +++ b/app/templates/course/stage/code-examples.hbs @@ -1,5 +1,5 @@
+
Concepts are interactive tutorials that teach you fundamental concepts related to this challenge.
diff --git a/app/templates/course/stage/instructions.hbs b/app/templates/course/stage/instructions.hbs index 1b5bb30b4f..1dfcd5683d 100644 --- a/app/templates/course/stage/instructions.hbs +++ b/app/templates/course/stage/instructions.hbs @@ -1,101 +1,103 @@ -
- {{#if this.shouldShowUpgradePrompt}} - - {{/if}} + +
+ {{#if this.shouldShowUpgradePrompt}} + + {{/if}} - {{#if this.shouldShowFeedbackPrompt}} - - {{/if}} - - {{#if (gt this.badgeAwards.length 0)}} - - {{/if}} + {{#if this.shouldShowFeedbackPrompt}} + + {{/if}} - {{#if @model.courseStage.isFirst}} - - {{/if}} + {{#if (gt this.badgeAwards.length 0)}} + + {{/if}} - {{#if @model.courseStage.isSecond}} - - {{/if}} + {{#if @model.courseStage.isFirst}} + + {{/if}} - {{#if this.shouldShowTestRunnerCard}} -
- + {{/if}} - {{#if this.shouldSuppressTestRunnerCardExpands}} - -
- {{#if (eq this.currentStep.testsStatus "failed")}} -

- This failure is expected! Check the - How to pass this stage - section for instructions. -

- {{else}} -

- Check the - How to pass this stage - section for instructions. -

- {{/if}} -
-
- {{/if}} -
- {{/if}} + {{#if this.shouldShowTestRunnerCard}} +
+ - {{! TODO: Bring this back? }} - {{!-- {{#if this.shouldShowPrerequisites}} - - {{/if}} --}} + {{#if this.shouldSuppressTestRunnerCardExpands}} + +
+ {{#if (eq this.currentStep.testsStatus "failed")}} +

+ This failure is expected! Check the + How to pass this stage + section for instructions. +

+ {{else}} +

+ Check the + How to pass this stage + section for instructions. +

+ {{/if}} +
+
+ {{/if}} +
+ {{/if}} - + {{! TODO: Bring this back? }} + {{!-- {{#if this.shouldShowPrerequisites}} + + {{/if}} --}} - {{#if this.shouldShowLanguageGuide}} - - {{/if}} + -
-
-

Hints

+ {{#if this.shouldShowLanguageGuide}} + + {{/if}} - {{#if @model.activeRepository.language}} -
- Filter by {{@model.activeRepository.language.name}} - +
+
+

Hints

- - {{#if this.commentListIsFilteredByLanguage}} - You're currently viewing hints that are relevant to - {{@model.activeRepository.language.name}}. Turn this off to view hints for all languages. - {{else}} - You're currently viewing hints for all languages. Turn this on to filter hints that are relevant to - {{@model.activeRepository.language.name}}. - {{/if}} - -
- {{/if}} -
+ {{#if @model.activeRepository.language}} +
+ Filter by {{@model.activeRepository.language.name}} + + + + {{#if this.commentListIsFilteredByLanguage}} + You're currently viewing hints that are relevant to + {{@model.activeRepository.language.name}}. Turn this off to view hints for all languages. + {{else}} + You're currently viewing hints for all languages. Turn this on to filter hints that are relevant to + {{@model.activeRepository.language.name}}. + {{/if}} + +
+ {{/if}} +
- + +
-
\ No newline at end of file +
\ No newline at end of file diff --git a/app/templates/course/stage/screencasts.hbs b/app/templates/course/stage/screencasts.hbs index 51ebbae144..efeee144f6 100644 --- a/app/templates/course/stage/screencasts.hbs +++ b/app/templates/course/stage/screencasts.hbs @@ -1,4 +1,4 @@ -
+
Screencasts are recordings of CodeCrafters users passing this stage. This is a beta feature, please send us
diff --git a/tests/acceptance/course-page/view-code-examples-test.js b/tests/acceptance/course-page/view-code-examples-test.js index dd69c669c2..303583cf67 100644 --- a/tests/acceptance/course-page/view-code-examples-test.js +++ b/tests/acceptance/course-page/view-code-examples-test.js @@ -187,7 +187,6 @@ module('Acceptance | course-page | view-code-examples', function (hooks) { await courseOverviewPage.clickOnStartCourse(); await coursePage.sidebar.clickOnStepListItem('Respond to PING'); await coursePage.yourTaskCard.clickOnActionButton('Code Examples'); - await coursePage.previousStepsIncompleteModal.clickOnJustExploringButton(); assert.strictEqual(coursePage.codeExamplesTab.solutionCards[0].changedFiles.length, 2, 'shows 2 changed files'); assert.strictEqual(coursePage.codeExamplesTab.solutionCards[0].unchangedFiles.length, 2, 'shows 2 unchanged files'); @@ -594,7 +593,6 @@ module('Acceptance | course-page | view-code-examples', function (hooks) { await catalogPage.clickOnCourse('Build your own Redis'); await courseOverviewPage.clickOnStartCourse(); await coursePage.sidebar.clickOnStepListItem('Implement the ECHO command'); - await coursePage.previousStepsIncompleteModal.clickOnJustExploringButton(); await coursePage.yourTaskCard.clickOnActionButton('Code Examples'); await coursePage.codeExamplesTab.languageDropdown.toggle();