Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Launch Terminal Instructions experiment for Shell stage 1 and 2 #2521

Merged
merged 8 commits into from
Jan 10, 2025

Conversation

andy1li
Copy link
Member

@andy1li andy1li commented Jan 7, 2025

Checklist:

  • I've thoroughly self-reviewed my changes
  • I've added tests for my changes, unless they affect admin-only areas (or are otherwise not worth testing)
  • I've verified any visual changes using Percy (add a commit with [percy] in the message to trigger)

Summary by CodeRabbit

  • New Features

    • Added terminal instructions for shell course stages.
    • Introduced conditional rendering of stage instructions based on user permissions.
    • Enhanced instructional content with interactive tooltips and detailed guidance.
    • Added new properties to manage feature visibility based on user roles.
  • Improvements

    • Updated the EmberTooltip component to allow specification of a tooltip container.

@andy1li andy1li self-assigned this Jan 7, 2025
Copy link
Contributor

coderabbitai bot commented Jan 7, 2025

Walkthrough

This pull request modifies the instructional content within the CoursePage::InstructionsCard component by introducing conditional rendering for terminal-specific guidance in the first and second stages of a course. It includes new computed properties and methods to manage visibility based on feature flags, enhancing user interaction through tooltips and structured layouts. The original instructions are preserved as a fallback, ensuring a seamless experience for users regardless of their access to the new features.

Changes

File Change Summary
app/components/course-page/.../first-stage-tutorial-card.hbs Added conditional rendering with new shell prompt instructions and interactive tooltip.
app/components/course-page/.../first-stage-tutorial-card.ts Added isTerminalInstructionsPingingClicked tracked property, shouldShowTerminalInstructions and shouldShowTerminalInstructionsPinging computed properties, and handleTerminalClick action method.
app/components/course-page/.../second-stage-tutorial-card.hbs Implemented conditional rendering for shell-specific instructions with terminal output simulation.
app/components/course-page/.../second-stage-tutorial-card.ts Added isTerminalInstructionsPingingClicked tracked property, shouldShowTerminalInstructions and shouldShowTerminalInstructionsPinging computed properties, and handleTerminalClick action method.
app/services/feature-flags.js Introduced canSeeTerminalInstructionsForStage1And2 method to manage feature flag visibility.
types/glint.d.ts Updated EmberTooltip argument structure to include optional popperContainer property.

Possibly related PRs

  • course dark mode #2024: This PR enhances the dark mode styling for various components, including the copyable-terminal-command, which is relevant to the changes in the main PR that also involve conditional rendering and user interaction based on dark mode preferences.
  • Add dark mode toggle #2039: This PR introduces a dark mode toggle feature, which is directly related to the changes in the main PR that modify how instructional content is displayed based on user interaction and preferences.
  • add dark mode upgrade flow #2044: This PR focuses on enhancing dark mode functionality, including updates to the leaderboard and other components, which aligns with the main PR's changes that improve user experience based on conditional rendering.
  • Add extensions dark mode styles #2045: This PR adds dark mode styles and tests for the dark mode toggle, which is relevant to the main PR's focus on improving instructional content display based on user interaction and preferences.

Suggested labels

enhancement

Suggested reviewers

  • rohitpaulk

Poem

🐰 A Rabbit's Terminal Tale 🖥️
With flags unfurled and instructions clear,
Our shell now whispers, "Learning's here!"
A prompt that dances, a tooltip's light,
Guiding coders through the digital night.
Terminal wisdom, now plain to see! 🚀

Finishing Touches

  • 📝 Generate Docstrings (Beta)

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@andy1li andy1li force-pushed the terminal-instructions-experiment branch 2 times, most recently from 7733897 to 8038953 Compare January 7, 2025 07:31
Copy link

github-actions bot commented Jan 7, 2025

Test Results

  1 files  ±0    1 suites  ±0   8m 8s ⏱️ +46s
595 tests ±0  554 ✅ ±0  41 💤 ±0  0 ❌ ±0 
610 runs  ±0  569 ✅ ±0  41 💤 ±0  0 ❌ ±0 

Results for commit 9ad923a. ± Comparison against base commit 81ecce2.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Jan 7, 2025

Codecov Report

Attention: Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...age/course-stage-step/first-stage-tutorial-card.ts 0.00% 4 Missing ⚠️
...ge/course-stage-step/second-stage-tutorial-card.ts 0.00% 4 Missing ⚠️
app/services/feature-flags.js 0.00% 1 Missing ⚠️
Additional details and impacted files

📢 Thoughts on this report? Let us know!

…d second stage tutorial cards and feature flag logic [percy]
@andy1li andy1li changed the title feat: Add conditional rendering for terminal instructions in first an… Launch Terminal Instructions experiment for Shell stage 1 and 2 Jan 7, 2025
@andy1li andy1li requested a review from rohitpaulk January 7, 2025 07:52
@andy1li andy1li force-pushed the terminal-instructions-experiment branch from 9429043 to de8da26 Compare January 7, 2025 08:02
@rohitpaulk
Copy link
Member

Awesome work @andy1li! Like how we added interactivity.

Wonder if we could make the availability of tooltips a bit more obvious - maybe by adding dotted underlines? No need to try right now, we can try some options on our call and finalize

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (2)
app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs (1)

16-23: Consider enhancing tooltip visibility.

As suggested in the PR comments by rohitpaulk, consider adding dotted underlines to make the tooltips more discoverable.

-              <p class="mt-0 mb-2 cursor-pointer w-fit text-slate-300 dark:text-slate-600">$
+              <p class="mt-0 mb-2 cursor-pointer w-fit text-slate-300 dark:text-slate-600 border-b border-dotted border-slate-300 dark:border-slate-600">$
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1)

25-28: Remove commented-out code.

Clean up the commented-out question mark circle implementation.

-            {{!-- <div class="flex items-center justify-center rounded-full relative">
-              {{svg-jar "question-mark-circle" class="w-6 h-6 text-blue-500"}}
-            </div> --}}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 81ecce2 and 1f7c6d7.

📒 Files selected for processing (5)
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1 hunks)
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.ts (1 hunks)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs (1 hunks)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.ts (1 hunks)
  • app/services/feature-flags.js (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Test
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs

[error] 21-21: Object literal may only specify known properties, and 'popperContainer' does not exist in type 'NamedArgs'

🔇 Additional comments (5)
app/services/feature-flags.js (1)

17-19: LGTM! Clean implementation of the feature flag.

The implementation follows the established patterns in the service and provides clear control over the terminal instructions experiment.

app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs (1)

9-14: Nice touch with the terminal window styling!

The implementation of the terminal window UI with the three dots header follows common terminal app patterns and supports dark mode well.

app/components/course-page/course-stage-step/second-stage-tutorial-card.ts (1)

86-88: LGTM! Clean getter implementation.

The shouldShowTerminalInstructions getter is well-implemented and properly typed.

app/components/course-page/course-stage-step/first-stage-tutorial-card.ts (2)

88-90: LGTM! Clean implementation of the feature flag check.

The computed property follows Ember.js conventions and is well-typed. The implementation aligns with the PR objectives to conditionally show terminal instructions for Shell stages.


88-90: Verify feature flag implementation and test coverage.

Since this is an experimental feature, let's ensure proper implementation of the feature flag.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (1)
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1)

4-4: ⚠️ Potential issue

Replace hardcoded condition with feature flag check.

The hardcoded {{#if true}} defeats the purpose of the feature flag implementation.

-      {{#if true}}
+      {{#if this.shouldShowTerminalInstructions}}
🧹 Nitpick comments (1)
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1)

17-21: Consider enhancing tooltip discoverability.

As suggested in the PR feedback, consider adding a dotted underline or similar visual indicator to make the tooltip's presence more apparent to users.

-              <span class="relative flex size-6">
+              <span class="relative flex size-6 border-b border-dotted border-slate-400 dark:border-slate-500">
                <span class="animate-ping absolute inline-flex h-full w-full rounded-full bg-sky-400 opacity-75"></span>
                {{svg-jar "question-mark-circle" class="size-6 text-blue-500"}}
              </span>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1f7c6d7 and 9a37bf2.

📒 Files selected for processing (3)
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1 hunks)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs (1 hunks)
  • types/glint.d.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint
  • GitHub Check: test
🔇 Additional comments (2)
types/glint.d.ts (1)

22-22: LGTM! Type definition added for EmberTooltip's popperContainer.

The addition of popperContainer?: string to EmberTooltip's type definition properly types the property and should resolve the pipeline failures.

app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1)

8-24: Well-structured terminal UI implementation!

The terminal UI implementation follows best practices with:

  • Semantic HTML structure
  • Proper dark mode support
  • Consistent spacing and styling
  • Good accessibility considerations

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (3)
app/components/course-page/course-stage-step/first-stage-tutorial-card.ts (3)

77-77: Consider adding JSDoc documentation.

The tracked property is well-named and correctly implemented. Consider adding JSDoc documentation to explain its purpose and when it changes.

+  /**
+   * Tracks whether the user has clicked on the terminal instructions.
+   * Used to control the visibility of the pinging animation.
+   */
   @tracked isTerminalInstructionsPingingClicked = false;

91-97: Add type safety for feature flags.

The computed properties are well-implemented, but consider adding type safety for the feature flags to prevent runtime errors.

+  // In services/feature-flags.ts
+  interface FeatureFlags {
+    canSeeTerminalInstructionsForStage1And2: boolean;
+    // ... other flags
+  }

+  export default class FeatureFlagsService {
+    get canSeeTerminalInstructionsForStage1And2(): boolean {
+      // implementation
+    }
+  }

   // In this file
   get shouldShowTerminalInstructions() {
-    return this.featureFlags.canSeeTerminalInstructionsForStage1And2;
+    return Boolean(this.featureFlags.canSeeTerminalInstructionsForStage1And2);
   }

143-146: Add analytics tracking for terminal interactions.

For consistency with other user interactions in this component, consider tracking this interaction in analytics.

   @action
   handleTerminalClick() {
     this.isTerminalInstructionsPingingClicked = true;
+    this.analyticsEventTracker.track('terminal_instructions_clicked', {
+      repository_id: this.args.repository.id,
+      course_stage_id: this.args.courseStage.id
+    });
   }
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 18d1265 and 9ad923a.

📒 Files selected for processing (4)
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1 hunks)
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.ts (4 hunks)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs (1 hunks)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.ts (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (3)
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.hbs
  • app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs
  • app/components/course-page/course-stage-step/second-stage-tutorial-card.ts
🔇 Additional comments (1)
app/components/course-page/course-stage-step/first-stage-tutorial-card.ts (1)

12-12: LGTM!

The import of tracked is correctly placed and necessary for the new tracked property.

Copy link

codecov bot commented Jan 10, 2025

Bundle Report

Changes will increase total bundle size by 35.95MB (100.0%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
client-array-push 35.95MB 35.95MB (100%) ⬆️⚠️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants