Skip to content

Conversation

@dev-kishor
Copy link

@dev-kishor dev-kishor commented Dec 9, 2024

Introduce a horizontal menu for mobile devices on the settings screen, enhancing navigation experience while maintaining vertical tabs for larger screens.

Summary by Sourcery

Implement horizontal tab navigation for the settings screen on mobile devices, enhancing the user experience by providing a more suitable navigation method for smaller screens while retaining the existing vertical tabs for larger screens.

New Features:

  • Introduce a horizontal tab navigation menu for mobile devices on the settings screen.

Enhancements:

  • Maintain vertical tab navigation for larger screens while adding horizontal navigation for mobile.

@dev-kishor dev-kishor requested a review from mgupta83 as a code owner December 9, 2024 18:11
@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Dec 9, 2024

Reviewer's Guide by Sourcery

This PR implements responsive navigation for the settings screen by introducing a horizontal menu for mobile devices while maintaining vertical tabs for larger screens. The implementation uses Ant Design's Grid breakpoints to detect mobile devices and conditionally renders either a horizontal Menu component or the existing VerticalTabs component.

No diagrams generated as the changes look simple and do not need a visual representation.

File-Level Changes

Change Details Files
Added responsive navigation with mobile device detection
  • Imported Grid component from antd for breakpoint detection
  • Added screens and isMobile variables using Grid.useBreakpoint()
  • Created profileNavigationMenu array for horizontal menu items
ui-community/src/components/layouts/admin/pages/settings.tsx
Implemented conditional rendering based on device type
  • Added ternary operator to switch between mobile and desktop layouts
  • Implemented horizontal menu layout with Col and Row components
  • Set up Routes configuration for mobile navigation
ui-community/src/components/layouts/admin/pages/settings.tsx
Updated route configuration and navigation structure
  • Modified pages array to use consistent path structure
  • Added default route redirect to 'general' path
  • Updated link generation for menu items
ui-community/src/components/layouts/admin/pages/settings.tsx

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @dev-kishor - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider expanding the mobile view breakpoint check beyond just 'xs' - you might want to use 'sm' or a custom breakpoint to better accommodate various device sizes and orientations.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Review instructions: all looks good
  • 🟢 Testing: all looks good
  • 🟡 Complexity: 1 issue found
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

</Helmet>
<VerticalTabs pages={pages} />
</Helmet>
{isMobile ? (
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider extracting routing logic into a shared component to avoid duplication between mobile and desktop views

The current implementation duplicates routing logic between VerticalTabs and explicit Routes. Consider extracting the Routes to a shared component and only varying the navigation UI:

export const Settings: React.FC<any> = () => {
  // ... existing setup code ...

  const routeElements = (
    <Routes>
      <Route path="/" element={<Navigate to="general" replace />} />
      {pages.map((page) => (
        <Route key={page.id} path={page.path} element={page.element} />
      ))}
    </Routes>
  );

  return (
    <SubPageLayout fixedHeader={false} header={...}>
      <Helmet>
        <title>Admin Settings</title>
      </Helmet>
      <Col>
        {isMobile ? (
          <Row>
            <Menu className="w-11/12" items={profileNavigationMenu} mode="horizontal" style={{ borderColor: '#3f4373' }} />
          </Row>
        ) : (
          <VerticalTabs pages={pages} />
        )}
        <Row style={{ width: '100%', padding: '24px 0px 0px 24px' }}>
          {routeElements}
        </Row>
      </Col>
    </SubPageLayout>
  );
};

This approach:

  • Consolidates routing logic in one place
  • Maintains separate mobile/desktop navigation UIs
  • Reduces code duplication and maintenance overhead

@dev-kishor dev-kishor changed the title Implement horizontal tab navigation for mobile settings screen Enhanced sidebar and Implement horizontal tab navigation for mobile settings screen || Admin Portal Dec 31, 2024
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.

Admin Portal: UI enhancements for making the Admin Portal mobile-optimized

1 participant