Skip to content

Commit

Permalink
Merge pull request #2540 from codecrafters-io/revert-2521-experiment
Browse files Browse the repository at this point in the history
Revert Terminal Instructions experiment for Shell stage 1 and 2
  • Loading branch information
andy1li authored Jan 16, 2025
2 parents 11ac5f4 + ce2ce67 commit 1e83a81
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 93 deletions.
Original file line number Diff line number Diff line change
@@ -1,41 +1,10 @@
<CoursePage::InstructionsCard @title="How to pass this stage" id="first-stage-tutorial-card" ...attributes>
<:content>
<div class="prose dark:prose-invert mb-5">
{{#if (and (eq @repository.course.slug "shell") this.shouldShowTerminalInstructions)}}
<p>
In this stage, you'll implement printing a shell prompt
<code>"$ "</code>
and waiting for user input.
</p>
<div class="mb-6 bg-slate-800 dark:bg-slate-100 rounded-xl max-w-md shadow-md dark:shadow-slate-600">
<div class="flex items-center h-14 px-5 gap-2.5">
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
</div>
<div class="pt-0 p-5">
<button
type="button"
class="flex items-center gap-2 w-fit {{if this.shouldShowTerminalInstructionsPinging 'cursor-pointer' 'cursor-default'}}"
{{on "click" this.handleTerminalClick}}
>
<span class="font-mono text-slate-100 dark:text-slate-800">$</span>
<div class="relative flex size-6">
{{#if this.shouldShowTerminalInstructionsPinging}}
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
{{/if}}
{{svg-jar "question-mark-circle" class="size-6 text-blue-500"}}
</div>
<EmberTooltip @side="right" @text='Print "$ " to pass this stage.' @popperContainer="body" />
</button>
</div>
</div>
{{else}}
<p>
Since this is the first stage, we've included some commented code to help you get started. To pass this stage, simply uncomment the code and
submit your changes.
</p>
{{/if}}
<p>
Since this is the first stage, we've included some commented code to help you get started. To pass this stage, simply uncomment the code and
submit your changes.
</p>
</div>

<ExpandableStepList @steps={{this.steps}} @onManualStepComplete={{this.handleStepCompletedManually}} class="scroll-mt-32" as |stepList|>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,6 @@ export default class FirstStageTutorialCardComponent extends Component<Signature
return this.coursePageState.manuallyCompletedStepIdsInFirstStageInstructions.includes('navigate-to-file');
}

get shouldShowTerminalInstructions() {
return this.featureFlags.canSeeTerminalInstructionsForStage1And2;
}

get shouldShowTerminalInstructionsPinging() {
return !this.hasPassedTests && !this.isTerminalInstructionsPingingClicked;
}

get steps() {
return [
new NavigateToFileStep(this.args.repository, this.navigateToFileStepIsComplete),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,9 @@
<:content>
<div class="prose dark:prose-invert mb-5">
{{#if (eq @repository.course.slug "shell")}}
{{#if this.shouldShowTerminalInstructions}}
<p>
In this stage, you’ll implement error handling for invalid commands. For now, treat all commands as invalid.
</p>
<div class="mb-6 bg-slate-800 dark:bg-slate-100 rounded-xl max-w-md shadow-md dark:shadow-slate-600">
<div class="flex items-center h-14 px-5 gap-2.5">
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
<div class="size-3 bg-slate-500 dark:bg-slate-300 rounded-full flex-shrink-0"></div>
</div>
<div class="pt-0 p-5 font-mono">
<div class="flex items-center gap-2 mb-2 text-slate-300 dark:text-slate-600 cursor-default w-fit">$
<span class="text-red-400">invalid_command</span>
<EmberTooltip @side="right" @text="Treat every command as invalid for now." @popperContainer="body" />
</div>
<button
type="button"
class="flex items-center gap-2 text-slate-100 dark:text-slate-800 w-fit
{{if this.shouldShowTerminalInstructionsPinging 'cursor-pointer' 'cursor-auto'}}"
{{on "click" this.handleTerminalClick}}
>
invalid_command: command not found
<span class="relative flex size-6">
{{#if this.shouldShowTerminalInstructionsPinging}}
<span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
{{/if}}
{{svg-jar "question-mark-circle" class="size-6 text-blue-500"}}
</span>
<EmberTooltip @side="right" @text="Read the command and print the error message." @popperContainer="body" />
</button>
</div>
</div>
{{else}}
<div class="mt-2 mb-5 prose-compact">
{{markdown-to-html @courseStage.shortInstructionsMarkdown}}
</div>
{{/if}}
<div class="mt-2 mb-5 prose-compact">
{{markdown-to-html @courseStage.shortInstructionsMarkdown}}
</div>
{{else}}
<p>
In this stage, you'll implement your own solution. Unlike stage 1, your repository doesn't contain commented code to pass this stage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,6 @@ export default class SecondStageTutorialCardComponent extends Component<Signatur
);
}

get shouldShowTerminalInstructions() {
return this.featureFlags.canSeeTerminalInstructionsForStage1And2;
}

get shouldShowTerminalInstructionsPinging() {
return !this.runTestsStepIsComplete && !this.isTerminalInstructionsPingingClicked;
}

get steps() {
return [
new ImplementSolutionStep(this.args.repository, this.implementSolutionStepIsComplete),
Expand Down
2 changes: 1 addition & 1 deletion app/models/course-stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Our interactive concepts can help with this:

get shortInstructionsMarkdown() {
return `
In this stage, you'll implement support for handling invalid commands in your shell.
In this stage, you'll handle invalid commands in your shell. For now, treat all commands as invalid.
Example:
Expand Down
4 changes: 0 additions & 4 deletions app/services/feature-flags.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ export default class FeatureFlagsService extends Service {
return this.currentUser && (this.currentUser.isStaff || this.currentUser.isConceptAuthor);
}

get canSeeTerminalInstructionsForStage1And2() {
return this.currentUser?.isStaff || this.getFeatureFlagValue('can-see-terminal-instructions-for-stage-1-and-2') === 'test';
}

get currentUser() {
return this.authenticator.currentUser;
}
Expand Down

0 comments on commit 1e83a81

Please sign in to comment.