Skip to content

Comments

[WEB-2025] chore: profile page enhancements#5209

Merged
SatishGandham merged 14 commits intopreviewfrom
fix/work-url-patterns
Jul 24, 2024
Merged

[WEB-2025] chore: profile page enhancements#5209
SatishGandham merged 14 commits intopreviewfrom
fix/work-url-patterns

Conversation

@anmolsinghbhatia
Copy link
Collaborator

@anmolsinghbhatia anmolsinghbhatia commented Jul 23, 2024

Changes:

This PR includes following changes:

  • Render username in the header and remove the tooltip.
  • Adjust the profile sidebar height to match the screen.
  • Highlight the app sidebar "Your Work" only for the current user profile.
  • Fix the profile page section indicator.
  • Layout changes: Move the filter item to the app header.

References:

[WEB-2025]

Media:

Media
WEB-2025 (1)
WEB-2025 (2)

Summary by CodeRabbit

  • New Features

    • Enhanced UserProfileHeader to display user-specific project data and conditionally render a profile issues filter.
    • Updated ProfileLayout to utilize dynamic data fetching for user projects, improving responsiveness and interactivity.
    • Streamlined URL generation in SidebarUserMenu for better link management and clarity.
    • Improved type safety and prop management in ProfileSidebar, facilitating flexible styling options.
  • Bug Fixes

    • Adjusted navigation paths in profile constants for uniformity and correct route matching.
  • Documentation

    • Updated component prop types for improved clarity and type safety across profile-related components.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 23, 2024

Walkthrough

The recent changes enhance the user profile experience by improving data handling and UI responsiveness. Key updates include the integration of user project data across components, dynamic breadcrumb labeling, and refined navigation logic. With a focus on type safety and clearer prop management, the updates streamline the rendering process and enhance the overall clarity of the user interface.

Changes

Files Change Summary
web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx
web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx
Improved user project data handling and dynamic rendering enhancements for profile context.
web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx Simplified navbar logic by removing unnecessary props.
web/core/components/profile/sidebar.tsx Enhanced type safety and prop management; removed internal data fetching logic.
web/core/components/workspace/sidebar/user-menu.tsx Added a helper function for URL generation, improving link management clarity.
web/core/constants/profile.ts Standardized URL paths for profile navigation by adjusting selected properties.
web/core/constants/dashboard.ts Introduced a new type for link options and modified the highlight function for flexibility.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ProfileHeader
    participant ProfileLayout
    participant ProfileSidebar

    User->>ProfileHeader: Request user profile
    ProfileHeader->>ProfileLayout: Fetch userProjectsData
    ProfileLayout->>ProfileSidebar: Pass userProjectsData
    ProfileSidebar->>ProfileLayout: Render sidebar with projects
    ProfileLayout->>User: Display user profile
Loading

🐇 In a world of user tales,
Where profiles bloom and details sail,
New paths we carve, with data bright,
A rabbit's hop brings joy and light!
With every click, we navigate,
A clearer view, oh, isn't it great? 🌟


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

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.

@anmolsinghbhatia anmolsinghbhatia changed the title [WEB-2025] chore: work page enhancements [WEB-2025] chore: profile page enhancements Jul 23, 2024
@anmolsinghbhatia anmolsinghbhatia marked this pull request as ready for review July 23, 2024 12:58
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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 66c2cbe and f8a61d9.

Files selected for processing (6)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx (2 hunks)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx (3 hunks)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx (2 hunks)
  • web/core/components/profile/sidebar.tsx (2 hunks)
  • web/core/components/workspace/sidebar/user-menu.tsx (2 hunks)
  • web/core/constants/profile.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/navbar.tsx
Additional comments not posted (21)
web/core/constants/profile.ts (2)

53-53: LGTM! Verify routing logic.

The change from an empty string to a forward slash (/) in the selected value ensures consistency in URL paths. Verify that this aligns with the application's routing logic.


61-76: LGTM! Verify routing logic.

The change to include a trailing slash in the selected values ensures consistency in URL paths. Verify that this aligns with the application's routing logic.

web/core/components/workspace/sidebar/user-menu.tsx (5)

37-38: LGTM!

The getHref helper function improves code readability and maintainability by centralizing URL generation logic.


40-40: LGTM!

The currentUserPath variable correctly constructs the path string for the current user's profile.


41-41: LGTM!

The isCurrentUser variable correctly identifies if the current pathname corresponds to the user's profile.


76-76: LGTM!

The Link component's href attribute correctly utilizes the getHref function, improving code readability and maintainability.


79-79: LGTM!

The isActive logic correctly accounts for the isCurrentUser flag, ensuring that the active state reflects the user's context accurately.

web/app/[workspaceSlug]/(projects)/profile/[userId]/layout.tsx (7)

5-5: LGTM!

The useSWR hook is correctly imported for data fetching.


10-10: LGTM!

The USER_PROFILE_PROJECT_SEGREGATION constant is correctly imported for data fetching.


22-22: LGTM!

The instance creation of UserService is correct and aligns with the usage in the component.


43-48: LGTM!

The useSWR hook is correctly used to fetch user project data conditionally based on the presence of workspaceSlug and userId.


64-70: LGTM!

The AppHeader component correctly receives userProjectsData as a prop, enhancing the contextual information displayed in the header.


86-91: LGTM!

The ProfileSidebar component is correctly conditionally rendered based on screen size, improving the user experience across devices.


62-84: LGTM!

The layout structure has been refined to enhance responsiveness and user experience.

web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx (4)

19-21: Type Definition Update: Ensure Optional Properties are Handled Properly.

The type and showProfileIssuesFilter properties are optional. Ensure that all usages of these properties handle the case where they might be undefined.


25-25: Destructuring Props: Default Values for Optional Properties.

The destructuring of props includes default values for optional properties. This is a good practice to avoid undefined values.


42-46: Breadcrumb Label: Correctness and Clarity.

The breadcrumb label is dynamically generated based on whether the current user is the same as the user being viewed. This enhances the clarity of navigation.


53-55: Conditional Rendering: Profile Issues Filter.

The ProfileIssuesFilter component is conditionally rendered based on the showProfileIssuesFilter property. Ensure that this property is correctly passed down from the parent component.

web/core/components/profile/sidebar.tsx (3)

31-34: Type Definition: Ensure Correctness of New Type.

The TProfileSidebar type definition includes userProjectsData and an optional className property. Ensure that all usages of these properties handle the case where they might be undefined.


37-37: Destructuring Props: Default Values for Optional Properties.

The destructuring of props includes a default value for the optional className property. This is a good practice to avoid undefined values.


84-87: Class Name Concatenation: Ensure Proper Handling of Class Names.

The cn utility is used to concatenate class names. Ensure that this utility handles cases where className might be an empty string or undefined.

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between f8a61d9 and 8f5a1f8.

Files selected for processing (1)
  • web/core/components/profile/sidebar.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • web/core/components/profile/sidebar.tsx

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

Outside diff range, codebase verification and nitpick comments (2)
web/core/constants/dashboard.ts (2)

296-298: Consider renaming id to userId.

The existing comment suggests updating the name to userId for better clarity.

type TLinkOptions = {
-  id: string | undefined;
+  userId: string | undefined;
};

305-305: Update highlight function calls to match the new signature

Ensure that all function calls to highlight match the new signature and utilize the TLinkOptions type correctly. The following locations need to be updated:

  • web/ce/constants/workspace.ts: Multiple instances
  • web/core/constants/profile.ts: Multiple instances
  • web/core/constants/project.ts: Multiple instances
  • web/app/profile/sidebar.tsx
  • web/app/[workspaceSlug]/(projects)/settings/sidebar.tsx
  • web/app/[workspaceSlug]/(projects)/settings/mobile-header-tabs.tsx
  • web/app/[workspaceSlug]/(projects)/projects/(detail)/[projectId]/settings/sidebar.tsx

Please review and update these instances to ensure consistency with the new function signature.

Analysis chain

LGTM! But verify the function usage in the codebase.

The code changes are approved.

However, ensure that all function calls to highlight match the new signature and utilize the TLinkOptions type correctly.

Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify all function calls to `highlight` match the new signature and utilize the `TLinkOptions` type correctly.

# Test: Search for the function usage. Expect: Only occurances of the new signature.
rg --type typescript -A 5 $'highlight'

Length of output: 72


Script:

#!/bin/bash
# Description: Verify all function calls to `highlight` match the new signature and utilize the `TLinkOptions` type correctly.

# Test: Search for the function usage. Expect: Only occurrences of the new signature.
rg --type ts -A 5 'highlight'

# Test: Search for the usage of TLinkOptions. Expect: Correct usage in function calls.
rg --type ts -A 5 'TLinkOptions'

Length of output: 53338

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 8f5a1f8 and cae2cde.

Files selected for processing (3)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx (1 hunks)
  • web/core/components/workspace/sidebar/user-menu.tsx (2 hunks)
  • web/core/constants/dashboard.ts (2 hunks)
Files skipped from review as they are similar to previous changes (2)
  • web/app/[workspaceSlug]/(projects)/profile/[userId]/header.tsx
  • web/core/components/workspace/sidebar/user-menu.tsx
Additional comments not posted (1)
web/core/constants/dashboard.ts (1)

321-322: Ensure options?.id usage is consistent with the new TLinkOptions type.

If you rename id to userId, ensure the usage here is updated accordingly.

highlight: (pathname: string, baseUrl: string, options?: TLinkOptions) =>
-  options?.id ? pathname.includes(`${baseUrl}/profile/${options?.id}`) : false,
+  options?.userId ? pathname.includes(`${baseUrl}/profile/${options?.userId}`) : false,

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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between cae2cde and b163793.

Files selected for processing (3)
  • packages/types/src/issues/issue.d.ts (2 hunks)
  • web/core/components/workspace/sidebar/user-menu.tsx (2 hunks)
  • web/core/constants/dashboard.ts (2 hunks)
Files skipped from review due to trivial changes (1)
  • packages/types/src/issues/issue.d.ts
Files skipped from review as they are similar to previous changes (2)
  • web/core/components/workspace/sidebar/user-menu.tsx
  • web/core/constants/dashboard.ts

@SatishGandham SatishGandham merged commit 4d978c1 into preview Jul 24, 2024
@SatishGandham SatishGandham deleted the fix/work-url-patterns branch July 24, 2024 12:22
@coderabbitai coderabbitai bot mentioned this pull request Nov 7, 2024
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.

2 participants