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

fix(tp): fix career partner banner UI on tablet and mobile #993

Merged
merged 3 commits into from
Nov 4, 2024

Conversation

katamatata
Copy link
Contributor

@katamatata katamatata commented Oct 30, 2024

What Github issue does this PR relate to? Insert link.

Closes #964

What should the reviewer know?

In this PR, we:

  • Fixed the career partner banner UI on tablet and mobile
  • Refactored the code related to the active tab, adding the missing active tab bar on tablet and mobile and displaying the missing active tab bar for jobseeker users

Screenshots

Tablet view:
image

Mobile view:
image

Jobseeker view:
image

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced navigation item styling for improved responsiveness and visual feedback.
    • Conditional rendering for jobseeker navigation, directing users to their specific profile page.
  • Bug Fixes

    • Improved layout and alignment in the Career Partner Banner for better mobile compatibility.
  • Style

    • Updated styles across navigation and Career Partner components to enhance user experience and responsiveness.

Copy link

coderabbitai bot commented Oct 30, 2024

Walkthrough

The pull request includes modifications to the styling and functionality of navigation components and the Career Partner banner within the application. Key changes involve updating CSS styles for responsiveness, introducing new classes for active states in navigation items, and altering JSX structure for better alignment with design specifications. Conditional rendering has been implemented to enhance navigation based on user context, specifically for jobseekers. These adjustments aim to improve the user interface across various screen sizes.

Changes

File Path Change Summary
.../TpMainNavItem.scss Updated styles for .tp-main-nav-item and .tp-main-nav-item__active-bar. Added media queries for responsiveness.
.../TpMainNavItem.tsx Added conditional rendering for active state in Link component, enhancing visual feedback.
.../CareerPartnerBanner.scss Modified styles and added nested classes for responsive design. Improved mobile layout.
.../CareerPartnerBanner.tsx Updated JSX structure and class names for consistency with new styling conventions.
.../LoggedIn.tsx Implemented conditional rendering for TpMainNavItem based on tpJobseekerDirectoryEntry.

Assessment against linked issues

Objective Addressed Explanation
Career Partner banner for tablet and mobile layouts should be implemented (964)
The active bar should not appear on the tablet layout (964)

Possibly related PRs

Suggested labels

Area/frontend [react], Bug report

Suggested reviewers

  • helloanil
  • ericbolikowski

Poem

In the land of code where rabbits hop,
We’ve styled the banners, made them pop!
With active bars that shine so bright,
On all devices, they look just right.
So let’s celebrate this UI delight,
Hooray for changes, all day and night! 🐇✨


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.

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

@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: 3

🧹 Outside diff range and nitpick comments (3)
apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.scss (1)

Line range hint 72-83: Remove unnecessary line-height percentage comments.

The implementation looks good, but the percentage comments (/* 156.25% / and / 148.148% */) don't add value and should be removed for cleaner code.

    font-size: 16px;
-   line-height: 25px; /* 156.25% */
+   line-height: 25px;

    @include mobile() {
      font-size: 13.5px;
-     line-height: 20px; /* 148.148% */
+     line-height: 20px;
    }
apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss (2)

11-23: Consider using a standard breakpoint variable

While the implementation is correct, the hardcoded breakpoint value (1191px) should be replaced with a standard breakpoint variable for better maintainability.

Consider using Bulma's built-in breakpoint variables since you're already importing Bulma:

-    @media screen and (max-width: 1191px) {
+    @media screen and (max-width: $desktop - 1px) {

25-39: Clean up horizontal active bar implementation

Two suggestions for improvement:

  1. Use the same breakpoint variable as suggested earlier for consistency
  2. Remove the unnecessary content: ''; declaration on line 31 as it's not needed for block elements

Apply these changes:

-    @media screen and (max-width: 1191px) {
+    @media screen and (max-width: $desktop - 1px) {
       display: block;
-      content: '';
       position: absolute;
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 4d71252 and 0ceee02.

📒 Files selected for processing (5)
  • apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss (1 hunks)
  • apps/redi-talent-pool/src/components/molecules/TpMainNavItem.tsx (1 hunks)
  • apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.scss (2 hunks)
  • apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.tsx (1 hunks)
  • apps/redi-talent-pool/src/components/templates/LoggedIn.tsx (1 hunks)
🔇 Additional comments (11)
apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.tsx (1)

Line range hint 1-53: Verify responsive layout implementation.

The structural changes look good, but let's ensure all responsive styles are properly implemented in the associated SCSS file.

✅ Verification successful

Responsive styles are properly implemented

The SCSS file includes comprehensive responsive styles using Bulma's @include mobile() mixins. The implementation covers:

  • Adjusted margins and padding for mobile view
  • Proper spacing adjustments for separators and badges
  • Responsive font sizes and line heights for the bottom text
  • Appropriate padding modifications for various elements in mobile view
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if responsive styles are implemented in the SCSS file
rg -A 3 "@media" "apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.scss"

Length of output: 88


Script:

#!/bin/bash
# Let's first check if the SCSS file exists and see its content
cat apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.scss

Length of output: 1655

apps/redi-talent-pool/src/components/organisms/CareerPartnerBanner.scss (4)

1-15: LGTM! Responsive design improvements look good.

The base structure uses appropriate flex layout and the mobile adjustments create better spacing and containment for smaller screens. The max-width of 550px is a good choice to maintain readability on tablets.


34-71: LGTM! Well-structured responsive typography and spacing.

The badge and metadata sections have appropriate responsive adjustments and consistent typography settings. The mobile-specific margin and padding adjustments align well with the PR objectives for better tablet/mobile layouts.


24-32: 🛠️ Refactor suggestion

Consider simplifying the separator implementation.

While the current implementation works, it could be simplified using a single border property.

    &__separator {
-     width: 1px;
      height: 2rem;
-     border-left: 1px solid black;
+     border: 1px solid black;
      margin: 0 24px;
      @include mobile() {
        margin: 0 16px;
      }
    }

Likely invalid or redundant comment.


Line range hint 1-83: Verify the tablet-specific layout requirements.

While the mobile responsive adjustments look good, the PR objectives mention specific requirements about the active bar visibility in tablet layout. Please ensure these tablet-specific requirements are addressed, possibly through a tablet-specific media query.

apps/redi-talent-pool/src/components/molecules/TpMainNavItem.tsx (2)

Line range hint 1-99: Clean and well-structured implementation!

The component follows React best practices with:

  • Proper use of TypeScript interfaces
  • Callback optimization with useCallback
  • Clean separation of concerns
  • Correct ref forwarding implementation

57-62: Verify responsive behavior of active bars.

The implementation adds two active bar elements that are conditionally rendered together. According to the PR objectives, the active bar should only be visible in desktop layout.

Let's verify the responsive behavior:

Consider adding comments to clarify the purpose of each active bar element:

 {isActive && (
   <>
+    {/* Vertical active bar for desktop view */}
     <div className="tp-main-nav-item__active-bar"></div>
+    {/* Horizontal active bar for tablet/mobile view */}
     <div className="tp-main-nav-item__active-bar--horizontal"></div>
   </>
 )}
✅ Verification successful

Active bars implementation correctly handles responsive behavior

The SCSS implementation properly manages the visibility of active bars across different layouts:

  • Vertical bar (tp-main-nav-item__active-bar) is visible only on desktop and hidden below 1191px
  • Horizontal bar (tp-main-nav-item__active-bar--horizontal) is hidden by default and shown below 1191px

The implementation aligns with the PR objectives for responsive behavior. The code comments in the SCSS file also provide clear documentation of the purpose of each bar.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the active bars have proper responsive styling
# Expected: Find media queries controlling visibility of active bars

# Search for related SCSS rules
rg -t scss "tp-main-nav-item__active-bar" 

# Search for related media queries
rg -t scss "@media.*tp-main-nav-item__active-bar"

Length of output: 151


Script:

#!/bin/bash
# Let's try searching without file type restriction since scss might not be recognized
# Search for SCSS/CSS files first
fd -e scss -e css

# Then search for the class names in all files
rg "tp-main-nav-item__active-bar"

# Also search for any media query related styling
rg "@media.*tp-main-nav-item"

Length of output: 5735


Script:

#!/bin/bash
# Let's check the content of the SCSS file for the component
cat apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss

# Also search for any responsive styles in this file
rg -A 5 -B 5 "@media" apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss

Length of output: 2957

apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss (1)

7-9: LGTM: Container positioning improvements

The changes to justify-content and positioning create a proper layout foundation for both the centered content and absolutely positioned active indicators.

apps/redi-talent-pool/src/components/templates/LoggedIn.tsx (3)

70-87: Clean implementation of conditional profile navigation.

The conditional rendering based on user type improves the navigation experience by directing jobseekers to their specific profile page while maintaining the default behavior for other users.

Let's verify the navigation behavior across different user types:

✅ Verification successful

Navigation implementation is correctly integrated across the codebase

The verification shows that:

  • The conditional profile navigation is properly implemented in LoggedIn.tsx
  • The redirection logic in Me.tsx correctly handles jobseeker profiles by redirecting to /app/jobseeker-profile/${id}
  • TpMainNavItem usage is consistent throughout the application with proper page type definitions
  • No conflicting implementations of profile navigation were found
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify navigation implementation consistency
# Look for any other profile-related routing logic that might need updates

# Search for profile route definitions
echo "Checking profile route definitions..."
rg -l "jobseeker-profile|/app/me" --type tsx

# Search for potential profile navigation logic
echo "Checking profile navigation logic..."
ast-grep --pattern 'to={$_("/app/me")}'

Length of output: 284


Script:

#!/bin/bash
# Let's try with correct file extensions and more specific patterns

# Search for profile route definitions and navigation logic
echo "Checking profile routes and navigation..."
rg -l "jobseeker-profile|/app/me" --type ts --type tsx --type jsx

# Search for TpMainNavItem usage
echo "Checking TpMainNavItem usage..."
rg "TpMainNavItem" -A 3 --type ts --type tsx --type jsx

# Look for other profile-related routing
echo "Checking other profile routing..."
rg "to=.*(/app/me|/app/jobseeker-profile)" --type ts --type tsx --type jsx

Length of output: 527


Script:

#!/bin/bash
# Let's try without file type restrictions since the environment might not recognize tsx/jsx

# Search for profile route definitions and navigation logic
echo "Checking profile routes and navigation..."
rg -l "jobseeker-profile|/app/me"

# Search for TpMainNavItem usage
echo "Checking TpMainNavItem usage..."
rg "TpMainNavItem" -A 3

# Look for other profile-related routing
echo "Checking other profile routing..."
rg "to=.*(/app/me|/app/jobseeker-profile)"

Length of output: 11969


70-87: Verify tablet/mobile UI requirements.

While the navigation logic is sound, the PR objectives mention tablet/mobile UI fixes. This component might need additional styling updates to fully address the UI requirements.

Let's check for related style definitions:

✅ Verification successful

Let me analyze the styling implementation with these commands first.


Mobile/tablet UI requirements are properly implemented

The navigation component has comprehensive responsive styling implementations:

  • The side menu (tp-side-menu) transforms into a fixed bottom navigation on mobile/tablet using @include touch()
  • TpMainNavItem has specific mobile/tablet adaptations:
    • Active state indicator switches from vertical (right side) to horizontal (top) bar below 1191px
    • Icon sizes and spacing are consistently maintained across devices
  • The navbar has proper mobile adaptations including padding adjustments and a mobile menu overlay
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify responsive styling implementation
# Look for responsive styles that affect the navigation

echo "Checking for responsive styles..."
fd "LoggedIn.scss|TpMainNavItem.scss" --type scss --exec cat {}

Length of output: 395


Script:

#!/bin/bash
# Let's try a different approach to find style files and check responsive styles
# First, let's find the exact location of style files related to navigation

# Look for any CSS/SCSS files related to LoggedIn or TpMainNavItem
fd -e css -e scss . | grep -i "logged\|nav"

# Also search for responsive style patterns in TSX files
rg -i "@media|breakpoint|mobile|tablet" "LoggedIn.tsx|TpMainNavItem.tsx" --type tsx

# Search for styled-components or other styling approaches
ast-grep --pattern 'styled.$_'

Length of output: 551


Script:

#!/bin/bash
# Let's examine the content of the relevant style files we found
echo "=== LoggedIn.scss content ==="
cat "apps/redi-talent-pool/src/components/templates/LoggedIn.scss"

echo -e "\n=== TpMainNavItem.scss content ==="
cat "apps/redi-talent-pool/src/components/molecules/TpMainNavItem.scss"

echo -e "\n=== Navbar.scss content ==="
cat "apps/redi-talent-pool/src/components/organisms/Navbar.scss"

Length of output: 4860


75-78: Verify active state behavior for deep routes.

The current active state check is exact (===). Consider if this should handle nested routes or partial matches for better UX.

Let's check for potential edge cases:

✅ Verification successful

The exact match for jobseeker profile route is correct - no changes needed

Looking at the routes configuration, /app/jobseeker-profile/:tpJobseekerProfileId is defined with exact: true and there are no nested routes under this path. The current exact match implementation in LoggedIn.tsx aligns with the routing setup. The CV builder uses includes() because it has nested routes (/app/cv-builder and /app/cv-builder/:id), but the jobseeker profile doesn't have this requirement.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check for nested routes that might break active state
# Look for routes that extend the base jobseeker profile path

echo "Checking for nested profile routes..."
rg "/app/jobseeker-profile/[^\"']*/" --type tsx

Length of output: 395


Script:

#!/bin/bash
# Let's try a different approach to find nested routes and route patterns
# First, let's check the routing setup in the codebase
rg -A 5 "Route.*path.*jobseeker-profile" --type ts --type tsx

# Also check for any navigation or link components using this path
rg -A 2 "to=.*jobseeker-profile" --type ts --type tsx

# And check the component itself for any route-related logic
fd "LoggedIn.tsx" --type file --exec cat "{}"

Length of output: 9686


Script:

#!/bin/bash
# Let's check for any nested routes under CV builder since we see it uses includes()
rg -l "/app/cv-builder" --type-add 'tsx:*.{tsx,ts}' --type tsx

# Also check for route definitions
fd "router|routes" -e tsx -e ts --exec cat "{}"

Length of output: 10947

Comment on lines +17 to 31
<div className="career-partner-banner-top__badge">
<Icon
icon="careerPartnerBadge"
size="large"
className="career-partner-badge-icon"
className="career-partner-banner-top__badge-icon"
/>
<Heading size="smaller">Career Partner</Heading>
<Heading
size="smaller"
className="career-partner-banner-top__badge-text"
>
Career
<br />
Partner
</Heading>
</div>
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

Consider improving heading accessibility for screen readers.

While the visual layout with <br /> tags works well, screen readers might pause awkwardly between "Career" and "Partner". Consider using CSS for visual formatting while maintaining semantic meaning.

-          <Heading
-            size="smaller"
-            className="career-partner-banner-top__badge-text"
-          >
-            Career
-            <br />
-            Partner
-          </Heading>
+          <Heading
+            size="smaller"
+            className="career-partner-banner-top__badge-text"
+            aria-label="Career Partner"
+          >
+            <span className="career-partner-banner-top__badge-text-line">Career</span>
+            <span className="career-partner-banner-top__badge-text-line">Partner</span>
+          </Heading>

Add to your SCSS:

.career-partner-banner-top__badge-text-line {
  display: block;
}

Copy link
Contributor

@astkhikatredi astkhikatredi left a comment

Choose a reason for hiding this comment

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

Thank you, Kate!

Copy link
Contributor

@ericbolikowski ericbolikowski left a comment

Choose a reason for hiding this comment

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

Good work! 🥳 Let's get this deployed

@katamatata katamatata merged commit 31265d5 into master Nov 4, 2024
2 checks passed
@katamatata katamatata deleted the fix/tp/career-partner-banner branch November 4, 2024 08:09
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.

[TP/Company profile]: Fix the Career Partner banner UI for tablet and mobile layouts
4 participants