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

Experiment: Stage 1 - Show All Steps At Once #2504

Merged
merged 3 commits into from
Dec 27, 2024
Merged

Conversation

andy1li
Copy link
Member

@andy1li andy1li commented Dec 27, 2024

image

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

    • Introduced conditional rendering for tutorial steps, allowing all steps to be displayed at once or in a navigable format based on user progress.
    • Added a help forum link that appears based on specific conditions to assist users.
  • Bug Fixes

    • Improved logic for displaying completion status of steps to ensure accurate feedback.
  • Documentation

    • Updated parameters in the tutorial card component to include current step information for better context.

@andy1li andy1li self-assigned this Dec 27, 2024
Copy link
Contributor

coderabbitai bot commented Dec 27, 2024

Walkthrough

The pull request modifies the FirstStageTutorialCard component to include conditional rendering based on the shouldShowAllStepsAtOnceForStage1 property. When true, all tutorial steps are displayed at once; otherwise, the original expandable structure is maintained. Additionally, new computed properties are introduced to enhance type safety and manage step visibility and completion status. The FeatureFlagsService is updated to include a new property for user permissions, and the template is adjusted to pass the current step and display a help forum link conditionally.

Changes

File Change Summary
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs Added conditional rendering for tutorial steps based on shouldShowAllStepsAtOnceForStage1
app/components/course-page/course-stage-step/first-stage-tutorial-card.ts Added new computed properties: currentStep, hasPassedTests, shouldShowAllStepsAtOnceForStage1; Updated component signature to include currentStep
app/services/feature-flags.js Added canSeeAllStepsAtOnceForStage1 computed property; Removed canSeeTweaksForStage1
app/templates/course/stage/instructions.hbs Updated component invocation to pass @currentStep parameter and added a conditional block for help forum link
app/controllers/course/stage/instructions.ts Added new computed properties: currentCourse, shouldShowStage1ForumLinkCTA

Possibly related PRs

Suggested reviewers

  • rohitpaulk

Poem

🐰 A rabbit's guide to coding's art,
Steps unfurled, a tutorial's start.
Flags wave high, all steps in sight,
Learning's journey, pure delight!
Code flows free, no mystery's might 🚀


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bade66b and 4071e9d.

📒 Files selected for processing (2)
  • app/controllers/course/stage/instructions.ts (2 hunks)
  • app/templates/course/stage/instructions.hbs (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • app/controllers/course/stage/instructions.ts
  • app/templates/course/stage/instructions.hbs

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 stage-1-experiments branch from 0d45ebd to b3f4200 Compare December 27, 2024 00:14
Copy link

github-actions bot commented Dec 27, 2024

Test Results

  1 files  ±0    1 suites  ±0   5m 58s ⏱️ - 1m 16s
588 tests ±0  548 ✅ +1  40 💤 ±0  0 ❌ ±0 
603 runs  ±0  563 ✅ +2  40 💤 ±0  0 ❌  - 1 

Results for commit 4071e9d. ± Comparison against base commit 299487f.

♻️ This comment has been updated with latest results.

Copy link

codecov bot commented Dec 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Additional details and impacted files

📢 Thoughts on this report? Let us know!

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 (1)
app/components/course-page/course-stage-step/first-stage-tutorial-card.hbs (1)

61-76: “Tests passed” vs. “Tests failed” messaging
The strikethrough usage is a neat way to show progression. Make sure the fallback text is comprehensible if test statuses are in an unexpected state.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 299487f and b3f4200.

📒 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 (3 hunks)
  • app/services/feature-flags.js (1 hunks)
  • app/templates/course/stage/instructions.hbs (1 hunks)
🔇 Additional comments (15)
app/services/feature-flags.js (1)

13-15: Validate staff check vs. feature flag logic
The new canSeeAllStepsAtOnceForStage1 getter uses the currentUser?.isStaff check or a 'test' flag value to allow visibility. Ensure that this aligns with the intended product requirements and that 'test' is the only permissible override.

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

9-9: Good addition of CourseStageStep import
Importing CourseStageStep clarifies the type for currentStep. This addition improves code readability and type safety.


19-19: Check for potential null usage
Be certain that currentStep is always passed into this component. If it's undefined, calls to this.args.currentStep could be problematic.


76-78: Straightforward getter implementation
currentCourse is a concise getter referencing courseStage.course. Looks good.


80-82: Clarify condition in hasPassedTests
this.args.currentStep.testsStatus === 'passed' or this.args.currentStep.status === 'complete' is a clear check. Verify that these statuses are consistently set in upstream logic so that the getter remains accurate.


92-94: Use feature flags for dynamic step rendering
shouldShowAllStepsAtOnceForStage1 delegating to featureFlags.canSeeAllStepsAtOnceForStage1 is a solid approach for toggling UI logic. Confirm that the feature flag is consistently set for relevant users in production/staging.

app/templates/course/stage/instructions.hbs (1)

36-41: Passing @currentStep is beneficial
Adding @currentStep ensures the component has all relevant data, especially for multi-step logic. Great addition for clarity.

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

1-10: Conditional UI for showing all steps
When this.shouldShowAllStepsAtOnceForStage1 is true, the new InstructionsCard block enumerates steps directly. This is a clear, user-friendly alternative, but ensure you’ve tested both paths (flag on/off).


11-26: Step 1 structure
Nicely separates “Open a file” into its own subcomponent NavigateToFileStep. This helps maintain step-by-step clarity.


27-44: Step 2 structure
Both the text and the dedicated UncommentCodeStep subcomponent highlight the user’s next action. This streamline is good.


45-60: Step 3 includes instructions for submitting code
Clear instructions are given with a sample Git command. This is intuitive for new users. The usage of CopyableTerminalCommand adds convenience.


77-96: Encourage forum help
Linking directly to a new forum topic is a user-friendly mechanism. Everything here looks straightforward.


100-127: Fallback to ExpandableStepList
Retaining the original ExpandableStepList path ensures backward compatibility if the feature flag is off. Good approach.


128-141: “Tests failed” note
This note clarifies the user journey during the first Git push. The short explanation is likely helpful to newcomers.


142-144: Closing conditional
Ends the InstructionsCard gracefully. No issues noted.

Copy link
Member

@rohitpaulk rohitpaulk left a comment

Choose a reason for hiding this comment

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

Notes added

…first stage tutorial card and instructions page
@andy1li
Copy link
Member Author

andy1li commented Dec 27, 2024

image

…1ForumLinkCTA` and update its logic

Updated the name of the `shouldShowNeedHelpForumLink` property to `shouldShowStage1ForumLinkCTA` and modified its logic to align with its new name.
@andy1li andy1li merged commit 07f69c2 into main Dec 27, 2024
8 checks passed
@andy1li andy1li deleted the stage-1-experiments branch December 27, 2024 21:44
@coderabbitai coderabbitai bot mentioned this pull request Dec 28, 2024
3 tasks
@andy1li andy1li restored the stage-1-experiments branch January 6, 2025 01:44
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