diff --git a/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.hbs b/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.hbs index 60bd8d99d..5f13a634a 100644 --- a/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.hbs +++ b/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.hbs @@ -11,61 +11,123 @@ {{/unless}} -{{#if this.solution}} - - <:content> -
- {{#each this.solution.changedFiles as |changedFile|}} - {{! Extra if condition convinces typescript that solution isn't null }} - {{#if this.solution}} - - {{/if}} - {{/each}} -
+{{#if this.canSeeLanguageGuideBeforeSolution}} + {{#if @languageGuide}} +
+ {{markdown-to-html @languageGuide.markdownForBeginner}} +
+ {{/if}} - {{#unless this.solutionIsBlurred}} - - {{svg-jar "eye-off" class="size-4"}} - Hide Solution - + {{#if this.solution}} + + <:content> +
+ + {{#each this.solution.changedFiles as |changedFile|}} + {{! Extra if condition convinces typescript that solution isn't null }} + {{#if this.solution}} + + {{/if}} + {{/each}} +
- {{#if @languageGuide}} -
- {{markdown-to-html @languageGuide.markdownForBeginner}} -
- {{/if}} - {{/unless}} - + {{svg-jar "eye-off" class="size-4"}} + Hide Solution + + {{/unless}} + - <:overlay> - -
- {{svg-jar "eye" class="size-6"}} - Click to reveal solution + <:overlay> + +
+ {{svg-jar "eye" class="size-6"}} + Click to reveal solution +
+
+ + + + {{/if}} +{{else}} + {{#if this.solution}} + + <:content> +
+ {{#each this.solution.changedFiles as |changedFile|}} + {{! Extra if condition convinces typescript that solution isn't null }} + {{#if this.solution}} + + {{/if}} + {{/each}}
- - - -
+ + {{#unless this.solutionIsBlurred}} + + {{svg-jar "eye-off" class="size-4"}} + Hide Solution + + + {{#if @languageGuide}} +
+ {{markdown-to-html @languageGuide.markdownForBeginner}} +
+ {{/if}} + {{/unless}} + + + <:overlay> + +
+ {{svg-jar "eye" class="size-6"}} + Click to reveal solution +
+
+ + + + {{/if}} {{/if}} \ No newline at end of file diff --git a/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.ts b/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.ts index 18e4d4fb1..230f06f00 100644 --- a/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.ts +++ b/app/components/course-page/course-stage-step/second-stage-tutorial-card/implement-solution-step.ts @@ -2,7 +2,9 @@ import Component from '@glimmer/component'; import type RepositoryModel from 'codecrafters-frontend/models/repository'; import type CourseStageModel from 'codecrafters-frontend/models/course-stage'; import type CourseStageLanguageGuideModel from 'codecrafters-frontend/models/course-stage-language-guide'; +import type FeatureFlagsService from 'codecrafters-frontend/services/feature-flags'; import { action } from '@ember/object'; +import { inject as service } from '@ember/service'; import { tracked } from '@glimmer/tracking'; interface Signature { @@ -17,8 +19,13 @@ interface Signature { } export default class ImplementSolutionStepComponent extends Component { + @service declare featureFlags: FeatureFlagsService; @tracked solutionIsBlurred = true; + get canSeeLanguageGuideBeforeSolution() { + return this.featureFlags.canSeeLanguageGuideBeforeSolutionForStage2; + } + get solution() { return this.args.repository.secondStageSolution; } diff --git a/app/services/feature-flags.ts b/app/services/feature-flags.ts index c6828c3bf..725aa3d8f 100644 --- a/app/services/feature-flags.ts +++ b/app/services/feature-flags.ts @@ -18,6 +18,10 @@ export default class FeatureFlagsService extends Service { return Boolean(this.currentUser && (this.currentUser.isStaff || this.currentUser.isConceptAuthor)); } + get canSeeLanguageGuideBeforeSolutionForStage2(): boolean { + return Boolean(this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-language-guide-before-solution-for-stage-2') === 'test'); + } + get canSeeSplitUpGitCommandsForStage1(): boolean { return Boolean(this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-split-up-git-commands-for-stage-1') === 'test'); }