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

613-feat: Update communication section #616

Merged
merged 5 commits into from
Oct 25, 2024

Conversation

KristiBo
Copy link
Collaborator

@KristiBo KristiBo commented Oct 21, 2024

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

Before:

before

After:

after

Added/updated tests?

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

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a new Telegram chat link for the JavaScript English community.
    • Added course-specific content for the JavaScript course, including new subtitles and paragraphs.
  • Bug Fixes

    • Updated test suite to enhance the selection method for the Discord link element.
  • Style

    • Restructured SCSS styles for improved organization without changing existing styles.

Copy link

Lighthouse Report:

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

View detailed report

@Quiddlee Quiddlee marked this pull request as ready for review October 24, 2024 11:02
Copy link
Contributor

coderabbitai bot commented Oct 24, 2024

πŸ“ Walkthrough
πŸ“ Walkthrough

Walkthrough

The pull request introduces several updates to the communication-related components within the application. A new constant for a Telegram chat link is added, and corresponding properties for English and Russian text are included in the communicationText object. The SCSS styles are restructured for better organization, and the tests for the Communication component are updated to reflect changes in how elements are selected. Overall, these modifications enhance the handling of communication channels and improve the component's dynamic content rendering.

Changes

File Change Summary
dev-data/communication.data.ts Added constant JS_EN_TELEGRAM_CHAT_LINK with URL 'https://t.me/RSS_EN'
dev-data/index.ts Exported JS_EN_TELEGRAM_CHAT_LINK from ./communication.data
dev-data/widget-communication.data.ts Added new properties to communicationText for English and Russian sections (8 properties total)
src/widgets/communication/ui/*.scss Restructured SCSS for .communication-content, removed .communication-paragraph, nested classes
src/widgets/communication/ui/communication.test.tsx Updated test to use screen.getByTestId('discord-link') for selecting Discord link element
src/widgets/communication/ui/communication.tsx Added constant JS_EN_TELEGRAM_CHAT_LINK, updated rendering logic, and added new properties to communicationText

Assessment against linked issues

Objective Addressed Explanation
Update text and links to include both Discord and Telegram (#[613]) βœ…
Modify communicationText for English JavaScript course (#[613]) βœ…

Possibly related PRs

Suggested reviewers

  • dzmitry-varabei
  • andron13
  • natanchik
  • SpaNb4
  • ansivgit

πŸ“œ Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between 9931444 and 3b6f5da.

πŸ“’ Files selected for processing (2)
  • dev-data/widget-communication.data.ts (2 hunks)
  • src/widgets/communication/ui/communication.tsx (4 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • dev-data/widget-communication.data.ts
  • src/widgets/communication/ui/communication.tsx

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

🧹 Outside diff range and nitpick comments (3)
dev-data/communication.data.ts (1)

Line range hint 3-19: Consider restructuring communication links for consistency.

Currently, Discord links are grouped in an object while Telegram links are separate constants. Consider creating a similar structure for Telegram links to maintain consistency and make future additions easier.

 export const RS_DOCS_COMMUNICATION_LINK = 'https://docs.rs.school/#/rs-school-chats';
 export const RS_DOCS_TELEGRAM_CHATS_LINK = 'https://docs.rs.school/#/rs-school-chats?id=telegram';
-export const JS_EN_TELEGRAM_CHAT_LINK = 'https://t.me/RSS_EN';
+
+export const TELEGRAM_LINKS = {
+  'js / front-end en': 'https://t.me/RSS_EN'
+};

 export const DISCORD_LINKS = {
   'js / front-end ru': 'https://discord.com/invite/QvEYg7EaQ4',
   'js / front-end en': 'https://discord.com/invite/uW5cCHR',
src/widgets/communication/ui/communication.test.tsx (1)

Line range hint 1-52: Test coverage needs expansion for Telegram functionality.

The test suite currently only validates Discord-related functionality. Based on the PR objectives of adding Telegram as a communication channel, we need additional test cases to verify:

  • Telegram link visibility
  • Correct Telegram URL
  • Proper rendering of updated text mentioning both platforms

Here's a suggested test structure:

it('should render both Discord and Telegram links correctly', () => {
  const firstCourse = Object.keys(DISCORD_LINKS)[0] as keyof typeof DISCORD_LINKS;
  
  renderWithRouter(<Communication courseName={firstCourse} />);
  
  const discordLink = screen.getByTestId('discord-link');
  const telegramLink = screen.getByTestId('telegram-link');
  
  expect(discordLink).toBeVisible();
  expect(telegramLink).toBeVisible();
  expect(telegramLink.getAttribute('href')).toMatch(TELEGRAM_LINK);
});
src/widgets/communication/ui/communication.tsx (1)

62-64: Consider adding aria-label for external links

While the external links are properly marked, consider adding aria-labels to improve accessibility.

-                      <LinkCustom href={DISCORD_LINKS[courseName]} external data-testid="discord-link">
+                      <LinkCustom 
+                        href={DISCORD_LINKS[courseName]} 
+                        external 
+                        data-testid="discord-link"
+                        aria-label="Join our Discord channel">

Also applies to: 80-82

πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between ceb60ed and c242ef5.

πŸ“’ Files selected for processing (6)
  • dev-data/communication.data.ts (1 hunks)
  • dev-data/index.ts (1 hunks)
  • dev-data/widget-communication.data.ts (2 hunks)
  • src/widgets/communication/ui/communication.module.scss (1 hunks)
  • src/widgets/communication/ui/communication.test.tsx (1 hunks)
  • src/widgets/communication/ui/communication.tsx (4 hunks)
πŸ”‡ Additional comments (9)
src/widgets/communication/ui/communication.module.scss (3)

5-15: LGTM: Proper SCSS nesting implemented

The .communication-wrapper is now correctly nested within .communication-content, improving code organization while maintaining the same visual output.


18-21: Skip comment about padding changes


23-36: πŸ› οΈ Refactor suggestion

Consider adding Telegram logo styles

Since the PR objectives mention adding Telegram as a communication channel, consider adding similar styling for the Telegram logo.

Add a new class for Telegram logo with appropriate branding colors:

  .discord-logo-wrapper {
    // ... existing styles ...
  }
+ .telegram-logo-wrapper {
+   flex-shrink: 0;
+   align-self: center;
+   width: 250px;
+   padding: 30px;
+   background-color: #0088cc;
+   border-radius: 30px;
+
+   @include media-tablet {
+     width: 150px;
+     padding: 15px;
+   }
+ }
dev-data/communication.data.ts (1)

3-3: LGTM! New Telegram link constant added successfully.

The constant follows the established naming convention and contains a valid Telegram chat link format.

src/widgets/communication/ui/communication.test.tsx (1)

46-46: Good improvement using test ID!

Using data-testid is more reliable than text-based queries as it's less prone to breaking when text content changes.

dev-data/index.ts (1)

13-13: LGTM! Export aligns with PR objectives.

The addition of JS_EN_TELEGRAM_CHAT_LINK is properly grouped with other communication-related exports.

Let's verify the constant's definition:

βœ… Verification successful

Constant is properly defined and used in the codebase

The verification shows that:

  • JS_EN_TELEGRAM_CHAT_LINK is correctly defined in communication.data.ts
  • It's properly exported in index.ts
  • It's being used in the communication widget component as an external link
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify the constant definition in communication.data.ts
rg -A 1 "JS_EN_TELEGRAM_CHAT_LINK" --type ts

Length of output: 634

dev-data/widget-communication.data.ts (1)

5-11: Verify content matches requirements.

The new English content properly reflects both Discord and Telegram as main communication channels, aligning with PR objectives. However, let's verify the exact text matches across components.

βœ… Verification successful

Let me search for the content and its usage to verify the text consistency across components. The previous command failed because the tsx file type wasn't recognized, so I'm adjusting the search to focus on TypeScript files and also looking at the actual content and usage of these strings.


Content matches requirements and is properly integrated

The text content is correctly implemented and consistent across components:

  • The strings are properly defined in widget-communication.data.ts
  • They are correctly imported and used in communication.tsx
  • Both Discord and Telegram are mentioned as communication channels
  • The content flow is logical: Discord introduction followed by Telegram mention
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Verify text consistency across components
rg -l "Discord.*Telegram|Telegram.*Discord" --type ts --type tsx

Length of output: 94


Script:

#!/bin/bash
# Search for Discord and Telegram mentions in TypeScript files
rg -l "Discord.*Telegram|Telegram.*Discord" --type ts

# Show content of the widget communication data file
cat dev-data/widget-communication.data.ts

# Search for any usage of these strings in the codebase
rg "subTitleJs|firstParagraphFirstHalf|firstParagraphFirstHalfJs|discordLink|discordLinkJs|firstParagraphSecondHalf|firstParagraphSecondHalfJs" --type ts

Length of output: 5548

src/widgets/communication/ui/communication.tsx (2)

11-11: LGTM: New imports and constants support Telegram integration

Also applies to: 21-21


68-72: LGTM: Telegram integration matches requirements

The implementation correctly adds Telegram as an additional communication channel for the JS/FE EN course.

dev-data/widget-communication.data.ts Outdated Show resolved Hide resolved
src/widgets/communication/ui/communication.tsx Outdated Show resolved Hide resolved
Copy link

Lighthouse Report:

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

View detailed report

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: 1

🧹 Outside diff range and nitpick comments (1)
src/widgets/communication/ui/communication.tsx (1)

46-47: Consider using the imported course constant

Instead of using a string literal, consider using the imported course constant for type safety.

-const isJsEnCourse = courseName === 'js / front-end en';
+const isJsEnCourse = courseName === JS_EN_COURSE;
πŸ“œ Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

πŸ“₯ Commits

Files that changed from the base of the PR and between c242ef5 and 9931444.

πŸ“’ Files selected for processing (1)
  • src/widgets/communication/ui/communication.tsx (4 hunks)
πŸ”‡ Additional comments (3)
src/widgets/communication/ui/communication.tsx (3)

11-11: LGTM: Telegram link import added

The import of JS_EN_TELEGRAM_CHAT_LINK aligns with the PR objective to add Telegram as a communication channel.


30-36: LGTM: New text properties for JS course

The addition of JS-specific text properties (subTitleJs, firstParagraphFirstHalfJs, etc.) supports the multilingual content requirements.


57-74: Reduce code duplication in conditional rendering

A previous review already suggested a refactor to reduce code duplication in this section. The suggestion remains valid and would improve maintainability.

<LinkCustom href={DISCORD_LINKS[courseName]} external>
{discordLink}
<Subtitle className={cx('communication-subtitle')}>
{isJsEnCourse ? subTitleJs : subTitle}
Copy link
Member

@Quiddlee Quiddlee Oct 24, 2024

Choose a reason for hiding this comment

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

please, move all the conditions above the return statement

const courseSubTitle = isJsEnCourse ? subTitleJs : subTitle;
Suggested change
{isJsEnCourse ? subTitleJs : subTitle}
{courseSubTitle}

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

Copy link

Lighthouse Report:

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

View detailed report

@dzmitry-varabei dzmitry-varabei merged commit 1d7b8aa into main Oct 25, 2024
4 checks passed
@dzmitry-varabei dzmitry-varabei deleted the feat/613-update-communication-section branch October 25, 2024 10:26
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.

[JS/FE En Course] Update the Communication section to include both Discord and Telegram
5 participants