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

720-refactor: After completing registration section #748

Merged
merged 5 commits into from
Jan 22, 2025

Conversation

ansivgit
Copy link
Collaborator

@ansivgit ansivgit commented Jan 21, 2025

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

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

Description

Implement After Completing the Registration section of the new design for the mentorship page

Design file - https://www.figma.com/design/opKwNO3FhSfQqR5uUpjJQp/RS-Mentorship?node-id=0-1&p=f&t=9p19VOoIuzY2KHpn-0

Related Tickets & Documents

Screenshots, Recordings

Before

image

After

image

Added/updated tests?

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

Summary by CodeRabbit

  • New Features

    • Added a new section "After Completing Registration" for mentors.
    • Introduced localized content for mentorship registration follow-up steps in English and Russian.
  • Bug Fixes

    • Removed outdated steps and notes from the registration process.
  • Documentation

    • Expanded mentorship guidance with post-registration instructions.
  • Style

    • Added responsive styling for the new "After Registration" section with flexible layout and spacing.
  • Tests

    • Implemented unit tests for the "MentorsAfterRegister" component to ensure proper rendering and functionality in different languages.

@ansivgit ansivgit self-assigned this Jan 21, 2025
@github-actions github-actions bot changed the title Refactor/720 after completing registration section 720-refactor: After completing registration section Jan 21, 2025
Copy link

Lighthouse Report:

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

View detailed report

@ansivgit ansivgit marked this pull request as ready for review January 22, 2025 13:40
Copy link
Contributor

coderabbitai bot commented Jan 22, 2025

πŸ“ Walkthrough

Walkthrough

The pull request introduces a new "After Completing the Registration" section for the mentorship page. It involves creating a new component MentorsAfterRegister with localized data in English and Russian, removing previous "after registration" steps from the existing component, and adding styling and tests for the new section.

Changes

File Change Summary
dev-data/index.ts Added export for mentorsAfterRegisterData
dev-data/mentors-after-register.data.ts New constant with localized mentorship registration steps
dev-data/mentors-register.data.ts Removed stepsAfter and noteAfter sections
src/views/mentorship.tsx Imported and added MentorsAfterRegister component
src/views/mentorship/ui/mentors-after-register/index.ts Added export for MentorsAfterRegister
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss New styling for the after-registration section
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx New React component for after-registration steps
src/widgets/mentors-register/ui/mentors-register.tsx Removed noteAfter and stepsAfter rendering

Assessment against linked issues

Objective Addressed Explanation
Create section component in src/views/mentorship/ui βœ…

Possibly related issues

Possibly related PRs

Suggested labels

refactor, high priority

Suggested reviewers

  • dzmitry-varabei
  • andron13
  • natanchik
  • Quiddlee
  • SpaNb4
  • KristiBo

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

🧹 Nitpick comments (6)
dev-data/mentors-after-register.data.ts (1)

6-19: Consider using numeric IDs and fix typo in Russian text.

Two suggestions for improvement:

  1. Use numeric type for step IDs instead of strings since they represent sequential numbers
  2. Fix the spelling of "Π’Π΅Π»Π΅Π³Ρ€Π°ΠΌ" (single 'ΠΌ') in Russian content
-        id: '1',
+        id: 1,
// ... similar changes for other IDs

-        content: 'ΠΈΠ· письма ΠΊ сообщСству Π²Ρ‹Π±Ρ€Π°Π½Π½ΠΎΠ³ΠΎ курса Π² Π’Π΅Π»Π΅Π³Ρ€Π°ΠΌΠΌ ΠΈ Дискорд',
+        content: 'ΠΈΠ· письма ΠΊ сообщСству Π²Ρ‹Π±Ρ€Π°Π½Π½ΠΎΠ³ΠΎ курса Π² Π’Π΅Π»Π΅Π³Ρ€Π°ΠΌ ΠΈ Дискорд',

Also applies to: 26-39

src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (3)

23-24: Remove unnecessary data assignment.

The assignment const data = mentorsAfterRegisterData is redundant.

-  const data = mentorsAfterRegisterData;
-

40-40: Use bound className for step content.

The step-content className should use the bound classNames utility like other elements.

-                <p className="step-content">{content}</p>
+                <p className={cx('step-content')}>{content}</p>

26-46: Add accessibility attributes.

Consider adding ARIA labels and roles to improve accessibility.

-    <section className={cx('container')} data-testid="mentors-after-register">
+    <section 
+      className={cx('container')} 
+      data-testid="mentors-after-register"
+      aria-labelledby="after-register-title"
+    >
       <div className={cx('content', 'mentors-after-register')}>
-        <WidgetTitle mods="asterisk">{data[lang].title}</WidgetTitle>
+        <WidgetTitle 
+          id="after-register-title"
+          mods="asterisk"
+        >
+          {mentorsAfterRegisterData[lang].title}
+        </WidgetTitle>

-        <section className={cx('steps')}>
+        <section 
+          className={cx('steps')}
+          role="list"
+        >
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.test.tsx (2)

6-7: Improve regex patterns for language validation.

Current patterns are too permissive. Consider using more precise patterns that match the actual content structure.

-const latinSymbolsRegExp = /^[?!,.a-zA-Z0-9\s]+$/;
-const cyrillicSymbolsRegExp = /^[?!,.Π°-яА-ЯёЁ0-9\s]+$/;
+const latinSymbolsRegExp = /^[A-Z][a-zA-Z0-9\s.,!]+$/;
+const cyrillicSymbolsRegExp = /^[А-ЯЁ][Π°-яёА-ЯЁ0-9\s.,!]+$/;

13-53: Add test for default lang prop.

Add a test to verify that 'en' is used when lang prop is undefined.

it('uses "en" as default language when lang prop is undefined', () => {
  const { rerender } = render(<MentorsAfterRegister />);
  const titleWithoutLang = screen.getByTestId('widget-title');
  
  rerender(<MentorsAfterRegister lang="en" />);
  const titleWithEn = screen.getByTestId('widget-title');
  
  expect(titleWithoutLang.textContent).toBe(titleWithEn.textContent);
});
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 9b5b3fa and fb804d0.

πŸ“’ Files selected for processing (9)
  • dev-data/index.ts (1 hunks)
  • dev-data/mentors-after-register.data.ts (1 hunks)
  • dev-data/mentors-register.data.ts (0 hunks)
  • src/views/mentorship.tsx (2 hunks)
  • src/views/mentorship/ui/mentors-after-register/index.ts (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.test.tsx (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (1 hunks)
  • src/widgets/mentors-register/ui/mentors-register.tsx (0 hunks)
πŸ’€ Files with no reviewable changes (2)
  • src/widgets/mentors-register/ui/mentors-register.tsx
  • dev-data/mentors-register.data.ts
βœ… Files skipped from review due to trivial changes (2)
  • src/views/mentorship/ui/mentors-after-register/index.ts
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.module.scss
πŸ”‡ Additional comments (2)
src/views/mentorship.tsx (1)

2-2: LGTM!

The MentorsAfterRegister component is properly integrated and positioned logically in the UI flow.

Also applies to: 35-35

dev-data/index.ts (1)

65-65: LGTM! Export follows established patterns.

The new export for mentorsAfterRegisterData is well-placed and maintains the file's alphabetical ordering.

Copy link

Lighthouse Report:

  • Performance: 97 / 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: 0

🧹 Nitpick comments (3)
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (3)

16-20: Consider strengthening the type definitions.

The types could be more specific:

  • id could be constrained to positive integers
  • content might need to support HTML content if rich text is required
 type StepAfterRegisterProps = {
-  id: number;
+  id: Positive<number>;
   subtitle: string;
-  content: string;
+  content: string | JSX.Element;
 };

23-23: Add type safety for the data access.

Consider adding type checking for the imported data to ensure type safety at runtime.

-  const data = mentorsAfterRegisterData;
+  const data = mentorsAfterRegisterData satisfies Record<Language, {
+    title: string;
+    steps: StepAfterRegisterProps[];
+  }>;

31-43: Extract the step rendering logic.

Consider extracting the step rendering logic into a separate component for better maintainability and reusability.

+const AfterRegisterStep = ({ id, subtitle, content }: StepAfterRegisterProps) => (
+  <article className={cx('step')} data-testid="after-register-step">
+    <Subtitle className={cx('step-subtitle')} fontSize="small" color="black">
+      {`${id}. ${subtitle}`}
+    </Subtitle>
+    <p className={cx('step-content')} data-testid="step-content">{content}</p>
+  </article>
+);

 <section className={cx('steps')}>
-  {data[lang].steps.map((step: StepAfterRegisterProps) => {
-    const { id, subtitle, content } = step;
-
-    return (
-      <article className={cx('step')} key={step.id} data-testid="after-register-step">
-        <Subtitle className={cx('step-subtitle')} fontSize="small" color="black">
-          {`${id}. ${subtitle}`}
-        </Subtitle>
-        <p className={cx('step-content')} data-testid="step-content">{content}</p>
-      </article>
-    );
-  })}
+  {data[lang].steps.map((step) => (
+    <AfterRegisterStep key={step.id} {...step} />
+  ))}
 </section>
πŸ“œ Review details

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

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between fb804d0 and 67e9cf6.

πŸ“’ Files selected for processing (3)
  • dev-data/mentors-after-register.data.ts (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.test.tsx (1 hunks)
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • dev-data/mentors-after-register.data.ts
  • src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.test.tsx
πŸ”‡ Additional comments (2)
src/views/mentorship/ui/mentors-after-register/ui/mentors-after-register.tsx (2)

6-6: Verify the data import path.

The import path 'data' seems inconsistent with the path mentioned in the summary ('dev-data/index.ts'). Ensure the import path is correct and follows the project's path aliasing conventions.

βœ… Verification successful

Import path is correctly configured

The import path 'data' is valid as it's properly aliased to '../dev-data' in tsconfig.json.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for the actual location of mentorsAfterRegisterData
rg --type ts "export.*mentorsAfterRegisterData"

Length of output: 223


Script:

#!/bin/bash
# Check for path alias configurations in tsconfig files
fd tsconfig.json --exec cat {}

Length of output: 1174


40-40: Consider content sanitization.

If the content can include HTML, ensure proper sanitization to prevent XSS attacks.

@ansivgit ansivgit merged commit 8e650bb into main Jan 22, 2025
3 checks passed
@ansivgit ansivgit deleted the refactor/720-after-completing-registration-section branch January 22, 2025 18:04
@coderabbitai coderabbitai bot mentioned this pull request Jan 24, 2025
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mentorship Redesign: After Completing the Registration section
4 participants