diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs b/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs index c9b5661b4..076b1ba4d 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs @@ -21,22 +21,45 @@ @isComplete={{this.uncommentCodeStepIsComplete}} /> {{else if (eq stepList.expandedStep.id "submit-code")}} - + {{/if}} - {{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}} - {{#unless this.uncommentCodeStepIsComplete}} -
-

- {{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}} - Note: - After your first Git push, you should see - Tests - failed - in the bar below this card. This is expected! Complete the steps above to pass the tests. -

-
- {{/unless}} + {{#if @shouldHideTestRunnerCardRelatedCopy}} + {{#if this.shouldShowLinkToForum}} +
+

Need help?

+ +
+ {{/if}} + {{else}} + {{! After step 2, step 3 already contains a note on Tests Failed, so we can hide this !}} + {{#unless this.uncommentCodeStepIsComplete}} +
+

+ {{svg-jar "information-circle" class="w-5 h-5 mb-1 inline-flex text-sky-500"}} + Note: + After your first Git push, you should see + Tests failed + in the bar below this card. This is expected! Complete the steps above to pass the tests. +

+
+ {{/unless}} + {{/if}} \ No newline at end of file diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts b/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts index 22329a74e..833b2a7da 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card.ts @@ -4,6 +4,7 @@ import CoursePageStateService from 'codecrafters-frontend/services/course-page-s import FeatureFlagsService from 'codecrafters-frontend/services/feature-flags'; import Store from '@ember-data/store'; import type CourseStageModel from 'codecrafters-frontend/models/course-stage'; +import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step'; import type RepositoryModel from 'codecrafters-frontend/models/repository'; import type { Step } from 'codecrafters-frontend/components/expandable-step-list'; import { action } from '@ember/object'; @@ -14,6 +15,8 @@ interface Signature { Args: { repository: RepositoryModel; courseStage: CourseStageModel; + currentStep: CourseStageStep; + shouldHideTestRunnerCardRelatedCopy: boolean; }; } @@ -70,6 +73,10 @@ export default class FirstStageTutorialCardComponent extends Component

- Once you run the commands above, the - Tests failed - message below this card will change to - Tests passed. + Once you run the commands above, our system will automatically test your code.

{{#if @isComplete}} @@ -23,10 +20,12 @@ {{#unless @isComplete}} -

- Note: - If you're still seeing "Tests failed" after completing the steps above, - view logs - to troubleshoot. -

+ {{#unless @shouldHideTestRunnerCardRelatedCopy}} +

+ Note: + If you're still seeing "Tests failed" after completing the steps above, + view logs + to troubleshoot. +

+ {{/unless}} {{/unless}} \ No newline at end of file diff --git a/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts b/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts index a10c576ed..d6c56f9fc 100644 --- a/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts +++ b/app/components/course-page/course-stage-step/first-stage-tutorial-card/submit-code-step.ts @@ -8,6 +8,7 @@ interface Signature { Args: { isComplete: boolean; + shouldHideTestRunnerCardRelatedCopy: boolean; }; } diff --git a/app/controllers/course/stage/instructions.ts b/app/controllers/course/stage/instructions.ts index 132665df7..798eccfe0 100644 --- a/app/controllers/course/stage/instructions.ts +++ b/app/controllers/course/stage/instructions.ts @@ -4,6 +4,7 @@ import { tracked } from '@glimmer/tracking'; import type AuthenticatorService from 'codecrafters-frontend/services/authenticator'; import type CoursePageStateService from 'codecrafters-frontend/services/course-page-state'; import type CourseStageModel from 'codecrafters-frontend/models/course-stage'; +import type FeatureFlagsService from 'codecrafters-frontend/services/feature-flags'; import type RepositoryModel from 'codecrafters-frontend/models/repository'; import type CourseStageStep from 'codecrafters-frontend/utils/course-page-step-list/course-stage-step'; import { action } from '@ember/object'; @@ -11,10 +12,10 @@ import type RouterService from '@ember/routing/router-service'; import { next } from '@ember/runloop'; import { task } from 'ember-concurrency'; import type Store from '@ember-data/store'; - export default class CourseStageInstructionsController extends Controller { @service declare authenticator: AuthenticatorService; @service declare coursePageState: CoursePageStateService; + @service declare featureFlags: FeatureFlagsService; @service declare router: RouterService; @service declare store: Store; @@ -47,6 +48,10 @@ export default class CourseStageInstructionsController extends Controller { return this.model.courseStage.prerequisiteInstructionsMarkdownFor(this.model.activeRepository); } + get shouldHideTestRunnerCardBeforeStage1Submission() { + return this.featureFlags.cannotSeeTestRunnerCardBeforeStage1Submission; + } + get shouldShowFeedbackPrompt() { return !this.currentStep.courseStage.isFirst && this.currentStep.status === 'complete'; } @@ -56,7 +61,21 @@ export default class CourseStageInstructionsController extends Controller { } get shouldShowTestRunnerCard() { - return this.isCurrentStage && this.currentStep.status !== 'complete'; + if (!this.isCurrentStage) { + return false; + } + + if (this.currentStep.status === 'complete') { + return false; + } + + if (this.model.courseStage.isFirst) { + // For stage 1, we hide the test runner card until the user's submission. + return !(this.model.activeRepository.submissionsCount <= 1 && this.shouldHideTestRunnerCardBeforeStage1Submission); + } else { + // For other stages, we always show the test runner card + return true; + } } get shouldShowUpgradePrompt() { diff --git a/app/services/feature-flags.js b/app/services/feature-flags.js index c3dd77615..d5f34c3fd 100644 --- a/app/services/feature-flags.js +++ b/app/services/feature-flags.js @@ -18,8 +18,8 @@ export default class FeatureFlagsService extends Service { return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-short-instructions-for-stage-2') === 'test'; } - get canSeeTweaksForStage1() { - return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-tweaks-for-stage-1') === 'test'; + get cannotSeeTestRunnerCardBeforeStage1Submission() { + return this.currentUser?.isStaff || this.getFeatureFlagValue('cannot-see-test-runner-card-before-stage1-submission') === 'test'; } get currentUser() { diff --git a/app/templates/course/stage/instructions.hbs b/app/templates/course/stage/instructions.hbs index 091a908dd..9a7e2689a 100644 --- a/app/templates/course/stage/instructions.hbs +++ b/app/templates/course/stage/instructions.hbs @@ -33,7 +33,13 @@ {{/if}} {{#if @model.courseStage.isFirst}} - + {{/if}} {{#if @model.courseStage.isSecond}}