Skip to content

add new class option for cn, only show 1 button for cn class creation…#7915

Merged
mrfinch merged 1 commit intomasterfrom
saurabh/cn-class
Jan 30, 2025
Merged

add new class option for cn, only show 1 button for cn class creation…#7915
mrfinch merged 1 commit intomasterfrom
saurabh/cn-class

Conversation

@mrfinch
Copy link
Copy Markdown
Contributor

@mrfinch mrfinch commented Jan 30, 2025

… and open links in new tab

Summary by CodeRabbit

  • Translations

    • Added new translations for Ozaria game-based learning platform
    • Expanded translations for Hour of Code activities, CodeCombat Worlds, and CodeCombat Junior
  • New Features

    • Introduced new classroom types for CodeNinja programs
    • Added support for 'annual-plan-cn-coco' classroom type
  • User Interface

    • Updated teacher dashboard components to improve navigation
    • Added option to open external links in new tabs
    • Modified button visibility based on user roles
  • Validation

    • Increased maximum camp duration from 5 to 7 days

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 30, 2025

Walkthrough

This pull request introduces several enhancements to the CodeCombat platform, focusing on expanding classroom types, updating translations, and refining the teacher dashboard interface. The changes include adding new classroom configurations, introducing translations for game-based learning experiences like Ozaria and CodeCombat Junior, and modifying UI components to better support different user roles, particularly for CodeNinja users.

Changes

File Change Summary
app/locale/en.js Added translations for new features including Ozaria Classroom, AI HackStack, Hour of Code activities, CodeCombat Worlds, and CodeCombat Junior curriculum
app/models/Classroom.js Added four new classroom types to codeNinjaClassroomTypes, including disabled and new annual plan configurations
app/schemas/models/classroom.schema.js Updated type enum to include 'annual-plan-cn-coco' classroom type
ozaria/site/components/teacher-dashboard/... Multiple UI component updates:
- Added target="_blank" to external links in ClassLinksComponent.vue
- Modified button visibility and computed properties in TitleBar.vue based on user roles
- Updated camp duration validation in ModalEditClass.vue to allow up to 7 days

Possibly related PRs

Poem

🐰 In CodeCombat's digital realm so bright,
New classrooms bloom with learning's might
Translations dance, links open wide
Ninja teachers take their stride
Code adventures, fresh and bold! 🚀

✨ 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.

Copy link
Copy Markdown
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 (5)
ozaria/site/components/teacher-dashboard/common/TitleBar.vue (2)

Line range hint 278-291: Consider differentiating tracking events for better analytics.

Both buttons currently use the same tracking event name 'Add New Class Clicked'. Consider using distinct event names to better track CodeNinja vs regular user interactions.

-      window.tracker?.trackEvent('Add New Class Clicked', { category: 'Teachers', label: this.$route.path })
+      window.tracker?.trackEvent('Add New Club Clicked', { category: 'Teachers', label: this.$route.path })

Line range hint 278-291: Maintain consistent styling between buttons.

The regular "Add Class" button includes the dusk-btn class while the CodeNinja "Add Club" button doesn't. Consider applying consistent styling to both buttons.

       <primary-button
         v-if="!showClassInfo && isCodeNinja"
         id="new-club-btn-shepherd"
-        class="btn-title-padding btn-margins-height"
+        class="btn-title-padding btn-margins-height dusk-btn"
         @click="clickNewClub"
       >
ozaria/site/components/teacher-dashboard/BaseMyClasses/components/ClassLinksComponent.vue (1)

46-46: LGTM! Consider adding rel="noopener" for security.

The addition of target="_blank" to external links is a good practice. However, for enhanced security, consider adding rel="noopener" to prevent potential exploitation through window.opener.

Apply this pattern to all external links:

-target="_blank"
+target="_blank" rel="noopener"

Also applies to: 62-62, 78-78, 96-96, 111-111, 126-126, 141-141, 156-156, 176-176, 208-208, 226-226, 241-241, 256-256, 271-271, 286-286, 309-309, 339-339, 383-383, 443-443, 473-473, 517-517, 547-547, 561-561, 575-575, 589-589

ozaria/site/components/teacher-dashboard/modals/ModalEditClass.vue (1)

297-298: LGTM! Consider extracting magic numbers to constants.

The validation for camp duration has been updated from 5 to 7 days. While the change is correct, consider extracting these magic numbers to named constants for better maintainability.

Consider defining constants at the top of the file:

+const CAMP_MAX_DAYS = 7
+const CLUB_MAX_WEEKS = 14

-} else if (this.newClubType.includes('camp') && moment(this.newClassDateEnd).diff(moment(this.newClassDateStart), 'days') > 7) {
-  errorMsg = 'Camp should be at most 7 days'
+} else if (this.newClubType.includes('camp') && moment(this.newClassDateEnd).diff(moment(this.newClassDateStart), 'days') > CAMP_MAX_DAYS) {
+  errorMsg = `Camp should be at most ${CAMP_MAX_DAYS} days`
-} else if (this.newClubType.includes('club') && moment(this.newClassDateEnd).diff(moment(this.newClassDateStart), 'weeks') > 14) {
-  errorMsg = 'Club should be at most 14 weeks'
+} else if (this.newClubType.includes('club') && moment(this.newClassDateEnd).diff(moment(this.newClassDateStart), 'weeks') > CLUB_MAX_WEEKS) {
+  errorMsg = `Club should be at most ${CLUB_MAX_WEEKS} weeks`
app/locale/en.js (1)

Line range hint 1000-1050: Consider refactoring long string concatenations

Several translations use string concatenation with + operators which can be hard to maintain. Consider using template literals or interpolation.

Example refactor:

-'faq_row3_p_part1': 'We customize solutions for schools and districts and work with you to understand your use case, context, and budget. ',
-'faq_row3_p_part2': ' for further details! We also provide a ',
+faq_row3_p: 'We customize solutions for schools and districts and work with you to understand your use case, context, and budget. For further details! We also provide a'
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dd290a4 and 6a9aeb0.

📒 Files selected for processing (6)
  • app/locale/en.js (1 hunks)
  • app/models/Classroom.js (1 hunks)
  • app/schemas/models/classroom.schema.js (1 hunks)
  • ozaria/site/components/teacher-dashboard/BaseMyClasses/components/ClassLinksComponent.vue (25 hunks)
  • ozaria/site/components/teacher-dashboard/common/TitleBar.vue (2 hunks)
  • ozaria/site/components/teacher-dashboard/modals/ModalEditClass.vue (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: ESLint CI
  • GitHub Check: Node.js CI (18.10.0)
🔇 Additional comments (7)
ozaria/site/components/teacher-dashboard/common/TitleBar.vue (1)

146-148: LGTM! Clean implementation of CodeNinja-specific logic.

The addition of the CodeNinja check aligns well with the PR objectives to provide different UI experiences based on user roles.

app/schemas/models/classroom.schema.js (1)

123-123: LGTM! The new classroom type follows the schema's conventions.

The addition of annual-plan-cn-coco to the classroom types is consistent with the existing enum values and aligns with the PR objectives.

app/models/Classroom.js (1)

497-506: LGTM! Consider documenting the disabled types.

The new classroom types are well-structured and follow the existing pattern. However, it would be helpful to understand the purpose of the disabled types (club-3-month, camp-week, and annual-plan). Are these planned for future use?

Let me check if these types are referenced elsewhere in the codebase:

app/locale/en.js (4)

Line range hint 1-10: LGTM - Module exports and nativeDescription setup looks good

The basic structure with module.exports and initial translation setup follows best practices.


4713-4713: ⚠️ Potential issue

Remove stray line number

There appears to be a stray line number 4713~ in the translations that should be removed.

Likely invalid or redundant comment.


Line range hint 12-20: Verify HTML links in ozaria_home translations

The links in the translations use HTML tags directly. Consider using a link helper/formatter for consistency and to avoid potential XSS issues.


Line range hint 2000-2050: Verify markdown link formatting

Several translations use markdown-style links with ** for bold. Ensure these are being parsed correctly by the translation system.

@mrfinch mrfinch merged commit 9ba6188 into master Jan 30, 2025
@mrfinch mrfinch deleted the saurabh/cn-class branch January 30, 2025 10:11
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.

1 participant