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

Payouts Account (create, destroy, get) #40

Merged
merged 10 commits into from
Mar 30, 2024
Merged

Payouts Account (create, destroy, get) #40

merged 10 commits into from
Mar 30, 2024

Conversation

jamalsoueidan
Copy link
Owner

@jamalsoueidan jamalsoueidan commented Mar 27, 2024


Type

enhancement, documentation


Description

  • Added a new payout option to the account menu with a corresponding icon.
  • Enhanced the FeaturedArtists component with improved skeleton loaders and added overflow: hidden to the Box component.
  • Implemented the account payouts page with a loader function and a table to display payout history.
  • Implemented the account payouts settings page with input fields for bank account information using react-imask.
  • Setup the main structure for the account payouts section with navigation buttons.
  • Updated the private route regex to include the payouts route.
  • Added react-imask and its dependencies to the project.

Changes walkthrough

Relevant files
Enhancement
AccountMenu.tsx
Add Payout Option to Account Menu                                               

app/components/AccountMenu.tsx

  • Added a new menu item for payouts with an icon in the account menu.
  • +7/-0     
    ($locale)._index.tsx
    Enhance FeaturedArtists Skeleton Loaders and Box Styling 

    app/routes/($locale)._index.tsx

  • Improved the skeleton loaders in the FeaturedArtists component.
  • Added overflow: hidden style to the Box component.
  • +6/-4     
    ($locale).account.payouts._index.tsx
    Implement Account Payouts Page with Loader Function           

    app/routes/($locale).account.payouts._index.tsx

  • Implemented the loader function for account payouts.
  • Created a table to display payout history.
  • +52/-0   
    ($locale).account.payouts.settings.tsx
    Implement Account Payouts Settings Page                                   

    app/routes/($locale).account.payouts.settings.tsx

  • Implemented the loader function for payout settings.
  • Added input fields for bank account information using react-imask.
  • +43/-0   
    ($locale).account.payouts.tsx
    Setup Structure for Account Payouts Section                           

    app/routes/($locale).account.payouts.tsx

  • Setup the main structure for the account payouts section.
  • Added navigation buttons for payouts and settings.
  • +30/-0   
    ($locale).account.tsx
    Update Private Route Regex to Include Payouts                       

    app/routes/($locale).account.tsx

  • Updated route regex to include payouts in the list of private routes.
  • +1/-1     
    Dependencies
    package-lock.json
    Add `react-imask` Dependency                                                         

    package-lock.json

    • Added react-imask and its dependencies to the lock file.
    +49/-0   
    package.json
    Add `react-imask` to Dependencies                                               

    package.json

    • Added react-imask to the list of dependencies.
    +1/-0     

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @jamalsoueidan
    Copy link
    Owner Author

    #35

    @github-actions github-actions bot added documentation Improvements or additions to documentation enhancement New feature or request labels Mar 27, 2024
    Copy link

    PR Description updated to latest commit (a567697)

    Copy link
    Contributor

    shopify bot commented Mar 27, 2024

    Oxygen deployed a preview of your payouts branch. Details:

    Storefront Status Preview link Deployment details Last update (UTC)
    Booking Store ✅ Successful (Logs) Preview deployment Inspect deployment March 30, 202410:31 PM

    Learn more about Hydrogen's GitHub integration.

    Copy link

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR introduces several new features across multiple components and files, including third-party library integration, which requires careful review of the integration and functionality.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The hardcoded elements in app/routes/($locale).account.payouts._index.tsx might be placeholder data. Ensure dynamic data fetching and rendering are implemented.

    Performance Concern: The loader functions in payout-related routes do not seem to use the fetched customer data. This could lead to unnecessary data fetching and performance issues.

    🔒 Security concerns

    No

    Code feedback:
    relevant fileapp/routes/($locale).account.payouts._index.tsx
    suggestion      

    Consider fetching and displaying dynamic payout data instead of using hardcoded values in elements. This will ensure the table displays actual payout information to the user. [important]

    relevant lineconst elements = [

    relevant fileapp/routes/($locale).account.payouts.settings.tsx
    suggestion      

    Ensure proper validation and error handling for the bank account input fields to prevent submission of invalid data. This could be implemented using form validation libraries or custom validation logic. [important]

    relevant line

    relevant fileapp/routes/($locale).account.payouts._index.tsx
    suggestion      

    Implement a loading state and error handling for the async data fetching in the loader function to improve the user experience in case of slow network conditions or errors. [medium]

    relevant lineexport async function loader({context}: LoaderFunctionArgs) {

    relevant fileapp/routes/($locale).account.tsx
    suggestion      

    Consider adding a fallback or redirection mechanism for unauthorized access attempts to the payouts route, enhancing the security and user experience. [medium]

    relevant line/^\/account\/(payouts|orders|business|profile|dashboard|addresses|upload|public|booked|bookings|password|locations|services|schedules)(\/.*)?$/.test(


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link

    github-actions bot commented Mar 27, 2024

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Use a loop to generate repetitive components.

    Consider reducing the number of consecutive components by using a loop to generate them,
    enhancing code maintainability and readability.

    app/routes/($locale)._index.tsx [162-166]

    -<Skeleton height={10} radius="lg" />
    -<Skeleton height={10} radius="lg" />
    -<Skeleton height={10} radius="lg" />
    -<Skeleton height={10} radius="lg" />
    -<Skeleton height={10} radius="lg" />
    +{[...Array(5)].map((_, index) => (
    +  <Skeleton key={index} height={10} radius="lg" />
    +))}
     
    Display real payout amounts instead of hardcoded values.

    Instead of hardcoding the payout amount, consider fetching and displaying real data to
    ensure the payouts page reflects actual transactions.

    app/routes/($locale).account.payouts._index.tsx [27]

    -<Table.Td>0.00 DKK</Table.Td>
    +<Table.Td>{element.amount} DKK</Table.Td>
     
    Best practice
    Wrap inputs and button in a form tag for better accessibility.

    For better accessibility and form handling, wrap the inputs and button inside a

    tag and
    handle form submission properly.

    app/routes/($locale).account.payouts.settings.tsx [30-40]

    -<TextInput label="Fuldnavn" />
    -<Flex gap="lg">
    -  <InputBase label="Regnr" component={IMaskInput} mask="0000" w="80" />
    -  <InputBase label="Kontonummer" component={IMaskInput} mask="0000-0000-0000-0000" />
    -</Flex>
    -<Button>Gem</Button>
    +<form onSubmit={handleSubmit}>
    +  <TextInput label="Fuldnavn" />
    +  <Flex gap="lg">
    +    <InputBase label="Regnr" component={IMaskInput} mask="0000" w="80" />
    +    <InputBase label="Kontonummer" component={IMaskInput} mask="0000-0000-0000-0000" />
    +  </Flex>
    +  <Button type="submit">Gem</Button>
    +</form>
     
    Maintainability
    Use descriptive variable names for better readability.

    Use a more descriptive variable name than elements for the data array to improve code
    readability and maintainability.

    app/routes/($locale).account.payouts._index.tsx [12-17]

    -const elements = [
    +const payoutRecords = [
       {position: 6, mass: 12.011, symbol: 'C', name: 'Carbon'},
       {position: 7, mass: 14.007, symbol: 'N', name: 'Nitrogen'},
       {position: 39, mass: 88.906, symbol: 'Y', name: 'Yttrium'},
       {position: 56, mass: 137.33, symbol: 'Ba', name: 'Barium'},
       {position: 58, mass: 140.12, symbol: 'Ce', name: 'Cerium'},
     ];
     
    Performance
    Optimize private route matching for better performance.

    Utilize a more efficient regex pattern or a different method for matching private routes
    to enhance performance and readability.

    app/routes/($locale).account.tsx [24]

    -/^\/account\/(payouts|orders|business|profile|dashboard|addresses|upload|public|booked|bookings|password|locations|services|schedules)(\/.*)?$/.test(pathname)
    +pathname.startsWith('/account/') && ['/payouts', '/orders', '/business', '/profile', '/dashboard', '/addresses', '/upload', '/public', '/booked', '/bookings', '/password', '/locations', '/services', '/schedules'].some(path => pathname.includes(path))
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

     - Implement loader function to fetch payout account details
     - Add UI components to display payout account information
     - Enable creation and deletion of payout accounts
     - Adjust phone number and account number formatting in payout creation
    @jamalsoueidan jamalsoueidan changed the title Payouts Payouts Account (create, destroy, get) Mar 30, 2024
    @jamalsoueidan jamalsoueidan merged commit de5e6d0 into main Mar 30, 2024
    4 checks passed
    @jamalsoueidan jamalsoueidan deleted the payouts branch March 30, 2024 22:32
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 3
    Projects
    Status: Done
    Development

    Successfully merging this pull request may close these issues.

    1 participant