Skip to content

provider_profile_and_user_dev: Added ProviderUsers Component Code#168

Merged
Riyad-Murad merged 1 commit intostagingfrom
provider_profile_and_users_dev
May 20, 2025
Merged

provider_profile_and_user_dev: Added ProviderUsers Component Code#168
Riyad-Murad merged 1 commit intostagingfrom
provider_profile_and_users_dev

Conversation

@Riyad-Murad
Copy link
Owner

@Riyad-Murad Riyad-Murad commented May 20, 2025

Summary by Sourcery

Add a provider users listing feature with a dedicated page component that fetches and displays users in a reusable table.

New Features:

  • Add ProviderUsers component that retrieves provider’s users via Redux and displays them in a table
  • Introduce ProviderUsersService to fetch user data from the API endpoint
  • Create a reusable CustomTable component for rendering tabular data

Enhancements:

  • Add CSS styling for the provider users layout and custom table appearance

@sourcery-ai
Copy link

sourcery-ai bot commented May 20, 2025

Reviewer's Guide

The PR enhances the ProviderUsers page by introducing stateful data fetching via a dedicated service, rendering the results in a reusable CustomTable component, and updating styles accordingly.

Sequence Diagram: Fetching and Displaying Provider Users

sequenceDiagram
    participant User as User (Provider Admin)
    participant PUP as ProviderUsers Page
    participant PUComp as ProviderUsers Component
    participant PUSvc as ProviderUsersService
    participant API as Backend API

    User->>PUP: Navigates to Users Page
    activate PUP
    PUP->>PUComp: Mounts
    activate PUComp
    PUComp->>PUComp: useEffect triggered (initial load / userId change)
    PUComp->>PUSvc: getAllUsers(userId)
    activate PUSvc
    PUSvc->>API: GET /providers/getAllUsers/{providerId}
    activate API
    API-->>PUSvc: User Data Response (users[])
    deactivate API
    PUSvc-->>PUComp: users[]
    deactivate PUSvc
    PUComp->>PUComp: setUsers(users[])
    PUComp->>PUP: Renders CustomTable with users
    deactivate PUComp
    PUP-->>User: Displays table of users
    deactivate PUP
Loading

File-Level Changes

Change Details Files
Enhance ProviderUsers component with dynamic data fetching and display
  • Initialize users state and select userId from Redux
  • Fetch user list via ProviderUsersService in useEffect
  • Define table headers and integrate CustomTable
  • Adjust container layout with right margin
amp-client/src/Pages/ProviderPages/ProviderUsers/ProviderUsers.jsx
amp-client/src/Pages/ProviderPages/ProviderUsers/styles.css
Add ProviderUsersService for API interactions
  • Implement getAllUsers method with axios GET call
  • Include error handling and ensure array return
  • Expose service interface for component use
amp-client/src/Pages/ProviderPages/Services/ProviderUsersService/ProviderUsersService.js
Introduce reusable CustomTable component
  • Render table based on headers and data props
  • Include FontAwesome edit icon in actions column
  • Provide default table and icon styles
amp-client/src/Components/CommonComponents/CustomTable/CustomTable.jsx
amp-client/src/Components/CommonComponents/CustomTable/styles.css

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@Riyad-Murad Riyad-Murad merged commit 7cf95fe into staging May 20, 2025
1 check passed
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.

1 participant