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

725-feat: Sync wearecommunity link with api data #726

Merged
merged 5 commits into from
Jan 27, 2025

Conversation

Quiddlee
Copy link
Member

@Quiddlee Quiddlee commented Jan 11, 2025

What type of PR is this? (select all that apply)

  • πŸ• Feature
  • πŸ› Bug Fix
  • 🚧 Breaking Change
  • πŸ§‘β€πŸ’» Code Refactor
  • πŸ“ Documentation Update

Description

Related Tickets & Documents

Screenshots, Recordings

image

Added/updated tests?

  • πŸ‘Œ Yes
  • πŸ™…β€β™‚οΈ No, because they aren't needed
  • πŸ™‹β€β™‚οΈ No, because I need help

[optional] Are there any post deployment tasks we need to perform?

[optional] What gif best describes this PR or how it makes you feel?

Summary by CodeRabbit

  • New Features

    • Added localized registration status messages for courses
    • Introduced ability to disable enrollment links when registration is not available
  • Bug Fixes

    • Updated course enrollment link handling to support null/empty states
  • Style

    • Added new opacity variable for disabled elements
    • Created a new .disabled CSS class for visual indication of disabled state
  • Chores

    • Updated type definitions to support more flexible course enrollment properties
    • Added constants for registration status messages in English and Russian

@Quiddlee Quiddlee self-assigned this Jan 11, 2025
@github-actions github-actions bot changed the title Feat/725 sync wearecommunity link with api data 725-feat: Sync wearecommunity link with api data Jan 11, 2025
@Quiddlee Quiddlee added the feature New feature or request label Jan 11, 2025
Copy link

Lighthouse Report:

  • Performance: 75 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

Copy link

Lighthouse Report:

  • Performance: 97 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

Copy link

Lighthouse Report:

  • Performance: 73 / 100
  • Accessibility: 100 / 100
  • Best Practices: 100 / 100
  • SEO: 100 / 100

View detailed report

@SpaNb4 SpaNb4 marked this pull request as ready for review January 27, 2025 11:08
Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

πŸ“ Walkthrough

Walkthrough

This pull request introduces enhancements to course registration and localization across multiple components. The changes primarily focus on adding support for displaying a "Registration will open soon" message when course enrollment is not available, synchronizing Wearecommunity links from API data, and updating type definitions to accommodate nullable enrollment links.

Changes

File Change Summary
dev-data/... Added registration message constants, updated course and hero course data with new localization properties
src/shared/constants.ts Introduced REGISTRATION_WILL_OPEN_SOON and REGISTRATION_WILL_OPEN_SOON_RU constants
src/entities/course/types.ts Modified Course and ApiCoursesResponse types to support nullable enrollment links
src/shared/ui/link-custom/... Added disabled state support for custom links
src/widgets/*/ui/... Updated components to handle conditional registration link rendering

Assessment against linked issues

Objective Addressed Explanation
Sync Wearecommunity link with API data [#725] βœ…

Possibly related PRs

Suggested Labels

high priority

Suggested Reviewers

  • andron13
  • dzmitry-varabei
  • natanchik
  • Quiddlee
  • ansivgit
✨ 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.

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
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)
src/entities/course/helpers/sync-with-api-data.ts (1)

22-22: Add null check before assignment.

Consider adding a null check before assigning wearecommunityUrl to handle potential API inconsistencies.

-    clonedCourse.enroll = currApiCourse.wearecommunityUrl;
+    clonedCourse.enroll = currApiCourse.wearecommunityUrl ?? null;
src/widgets/training-program/ui/training-program.tsx (1)

41-44: Remove redundant course check.

The course check is unnecessary since course is already guaranteed to exist from the selectCourse call above.

-          {course && (
            <LinkCustom href={enrollHref} variant="primary" external disabled={!course.enroll}>
              {registrationLinkText}
            </LinkCustom>
-          )}
+          <LinkCustom href={enrollHref} variant="primary" external disabled={!course.enroll}>
+            {registrationLinkText}
+          </LinkCustom>
πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between e091d61 and b809a4f.

πŸ“’ Files selected for processing (17)
  • dev-data/about-course.data.tsx (2 hunks)
  • dev-data/courses.data.ts (9 hunks)
  • dev-data/hero-course.data.ts (1 hunks)
  • dev-data/training-program.data.tsx (2 hunks)
  • src/core/styles/_constants.scss (1 hunks)
  • src/entities/course/helpers/sync-with-api-data.ts (1 hunks)
  • src/entities/course/types.ts (2 hunks)
  • src/shared/__tests__/constants.ts (2 hunks)
  • src/shared/constants.ts (1 hunks)
  • src/shared/ui/link-custom/link-custom.module.scss (1 hunks)
  • src/shared/ui/link-custom/link-custom.tsx (3 hunks)
  • src/widgets/about-course/ui/about-course/about-course.test.tsx (2 hunks)
  • src/widgets/about-course/ui/about-course/about-course.tsx (2 hunks)
  • src/widgets/hero-course/ui/hero-course.test.tsx (2 hunks)
  • src/widgets/hero-course/ui/hero-course.tsx (2 hunks)
  • src/widgets/training-program/ui/training-program.test.tsx (2 hunks)
  • src/widgets/training-program/ui/training-program.tsx (2 hunks)
πŸ”‡ Additional comments (17)
dev-data/hero-course.data.ts (1)

4-11: LGTM! Clean localization implementation.

The addition of noLinkLabel for both languages follows good localization practices.

src/shared/constants.ts (1)

5-6: LGTM! Well-structured constants.

Clear and consistent naming for internationalized messages.

src/entities/course/types.ts (1)

25-25: LGTM! Type definitions are well-structured.

The type changes properly handle nullable values and maintain type safety.

Also applies to: 42-42

src/widgets/hero-course/ui/hero-course.tsx (1)

35-38: LGTM!

Clean implementation that follows the consistent pattern across components.

Also applies to: 64-65

src/widgets/about-course/ui/about-course/about-course.test.tsx (2)

7-7: LGTM! Clean setup of test dependencies.

The import of localization constants and mock course setup look good.

Also applies to: 11-13


65-89: LGTM! Comprehensive test coverage for registration message.

The test cases effectively verify both English and Russian localization scenarios when enrollment links are not available.

src/widgets/hero-course/ui/hero-course.test.tsx (2)

6-6: LGTM! Clean import.

The import statement follows the project's conventions.


63-87: LGTM! Consistent test implementation.

The test cases maintain consistency with other components while thoroughly verifying the registration message functionality.

src/widgets/training-program/ui/training-program.test.tsx (2)

7-7: LGTM! Clean import.

The import statement follows the project's conventions.


91-115: LGTM! Consistent test implementation.

The test cases effectively verify the registration message functionality while maintaining consistency with other components.

dev-data/courses.data.ts (1)

38-38: LGTM! Consistent enrollment link handling.

Setting all enrollment links to null aligns with the PR objective to sync wearecommunity links with API data.

Also applies to: 58-58, 78-78, 97-97, 116-116, 135-135, 154-154, 174-174, 193-193

src/shared/__tests__/constants.ts (1)

80-80: LGTM! Test data updated correctly.

The changes to set enroll: null for specific courses align with the feature's objective to handle courses where registration is not available.

Also applies to: 177-177

dev-data/about-course.data.tsx (1)

8-8: LGTM! Localization properly implemented.

The addition of noLinkLabel with appropriate localized messages enhances the user experience when registration is not available.

Also applies to: 21-21, 27-27, 33-33

src/shared/ui/link-custom/link-custom.module.scss (1)

93-96: LGTM! Disabled state properly implemented.

The .disabled class correctly implements both visual feedback and interaction prevention.

src/core/styles/_constants.scss (1)

81-81: LGTM! Opacity constant added correctly.

The new $opacity-30 variable follows the established pattern and fills a logical gap in the opacity scale.

dev-data/training-program.data.tsx (2)

18-18: LGTM!

The import statement follows the project's conventions and the constants are used appropriately.


306-313: Consider adding type definitions for the trainingProgramLink object.

The object structure has been updated with new properties, but type definitions are missing. This could lead to type errors in consuming components.

Let's verify the impact and type definitions:

βœ… Verification successful

Explicit type definitions would be beneficial but not critical

The object's structure is consistent and TypeScript will infer types correctly. The only consumer (training-program.tsx) properly handles both properties.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for type definitions and usages of trainingProgramLink
echo "Searching for type definitions..."
rg -t typescript -t tsx "type.*trainingProgramLink|interface.*trainingProgramLink"

echo -e "\nSearching for usages..."
rg -t typescript -t tsx "trainingProgramLink" -B 2 -A 2

Length of output: 350


Script:

#!/bin/bash
# Search for files with .ts, .tsx extensions and grep for patterns
echo "Searching for type definitions..."
fd -e ts -e tsx | xargs rg "type.*trainingProgramLink|interface.*trainingProgramLink"

echo -e "\nSearching for usages..."
fd -e ts -e tsx | xargs rg "trainingProgramLink" -B 2 -A 2

Length of output: 2061

@Quiddlee Quiddlee merged commit adba889 into main Jan 27, 2025
3 checks passed
@Quiddlee Quiddlee deleted the feat/725-sync-wearecommunity-link-with-api-data branch January 27, 2025 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request preview
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync Wearecommunity link with API data
5 participants