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(speakers_catalog): fix speakers catalog – mobile edits #3359

Conversation

FussuChalice
Copy link
Contributor

Description

[FIX] Speakers catalog – mobile edits https://app.clickup.com/t/86c0wm5a6
Card icon-buttons adjustment https://app.clickup.com/t/86c0wm5e3
Speaker's action buttons as horizontal flexbox https://app.clickup.com/t/86c0wm5jc

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • Any dependent changes have been merged and published in downstream modules

@rhahao
Copy link
Member

rhahao commented Jan 11, 2025

Copy link

vercel bot commented Jan 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
organized-app ✅ Ready (Inspect) Visit Preview Jan 11, 2025 6:23pm

Copy link
Contributor

coderabbitai bot commented Jan 11, 2025

Walkthrough

This pull request focuses on enhancing the responsiveness of several components across the persons and speakers catalog features. The changes primarily introduce a new tablet600Down breakpoint from the useBreakpoints hook, which allows for more granular control over layout and styling at smaller screen sizes. Components like DateHistory, OutgoingSpeakersHeader, IncomingCongregation, and others have been updated to adapt their layout, button positioning, and visibility based on this new breakpoint.

Changes

File Change Summary
src/features/persons/date_history/index.tsx Updated button layout and rendering using tablet600Down breakpoint; added new delete button with conditional rendering
src/features/persons/speakers_catalog/my_congregation/header/index.tsx Introduced responsive layout for action buttons using useBreakpoints and tablet600Down
src/features/persons/speakers_catalog/my_congregation/index.tsx Modified ScrollableTabs component's borderRadius to use var(--radius-l)
src/features/persons/speakers_catalog/other_congregations/congregation_item/index.tsx Added new buttons with responsive layout using useBreakpoints and conditional rendering
src/features/persons/speakers_catalog/other_congregations/header/index.tsx Adjusted layout and button visibility based on tablet600Down breakpoint
src/features/persons/speakers_catalog/other_congregations/speakers_list/edit/index.tsx Updated flexWrap and button widths using tablet600Down breakpoint

Sequence Diagram

sequenceDiagram
    participant User
    participant Component
    participant Breakpoints
    
    User->>Breakpoints: Resize screen
    Breakpoints->>Component: Trigger tablet600Down state
    Component->>Component: Adjust layout
    Component->>Component: Modify button positioning
    Component->>User: Render responsive UI
Loading

Possibly related PRs

Suggested reviewers

  • rhahao

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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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
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

🧹 Nitpick comments (7)
src/features/persons/date_history/index.tsx (1)

56-56: Consider extracting button styles to a shared constant.

The button styling properties are duplicated between delete and add buttons. Consider extracting these common styles to reduce duplication:

+ const mobileButtonStyles = {
+   height: '32px',
+   minHeight: '32px !important',
+   width: tablet600Down ? 'fit-content' : 'auto',
+ };

  <Button
    variant="small"
    color="red"
    startIcon={<IconDelete />}
-   sx={{
-     height: '32px',
-     minHeight: '32px !important',
-     width: tablet600Down ? 'fit-content' : 'auto',
-   }}
+   sx={mobileButtonStyles}
    onClick={() => onDelete(id)}
  >

Also applies to: 59-71

src/features/persons/speakers_catalog/other_congregations/header/index.tsx (1)

45-83: Extract duplicate IconExpand component.

The IconExpand component and its styles are duplicated. Consider extracting it into a reusable component:

+ const ExpandButton = ({ expanded, onClick }) => (
+   <IconButton onClick={onClick}>
+     <IconExpand
+       color="var(--black)"
+       sx={{
+         transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
+         transition: 'transform 0.3s',
+       }}
+     />
+   </IconButton>
+ );

  {tablet600Down && (
-   <IconButton onClick={() => onExpandChange(cong_number)}>
-     <IconExpand
-       color="var(--black)"
-       sx={{
-         transform: expanded ? 'rotate(180deg)' : 'rotate(0deg)',
-         transition: 'transform 0.3s',
-       }}
-     />
-   </IconButton>
+   <ExpandButton expanded={expanded} onClick={() => onExpandChange(cong_number)} />
  )}
src/features/persons/speakers_catalog/other_congregations/congregation_item/index.tsx (1)

1-1: Remove unnecessary eslint disable comment.

The @typescript-eslint/no-unused-vars disable comment appears to be unnecessary as all imported variables are used in the component.

src/features/persons/speakers_catalog/my_congregation/header/index.tsx (2)

55-103: Consider breaking down the mobile layout into smaller components.

The mobile layout section is quite large and contains nested conditional rendering. Consider extracting the mobile actions into a separate component for better maintainability:

const MobileActions = ({ 
  editMode, 
  onEditModeChange, 
  expanded,
  onExpandChange,
  congAccountConnected,
  handleOpenAccess 
}) => {
  const { t } = useAppTranslation();
  const { isPublicTalkCoordinator } = useCurrentUser();

  return (
    <Box sx={{ display: 'flex', alignItems: 'center', gap: '8px' }}>
      {/* ... extracted mobile actions ... */}
    </Box>
  );
};

140-170: Extract duplicate action buttons logic.

The action buttons logic is duplicated between mobile and desktop layouts. Consider creating a shared component:

const ActionButtons = ({ 
  editMode, 
  onEditModeChange,
  expanded,
  onExpandChange,
  congAccountConnected,
  handleOpenAccess
}) => {
  // ... shared action buttons logic
};
src/features/persons/speakers_catalog/other_congregations/speakers_list/edit/index.tsx (2)

56-56: Consider consolidating breakpoint usage for consistency.

The component uses both tabletDown and tablet600Down breakpoints. Consider using a single breakpoint consistently throughout the component to maintain uniform responsive behavior.


234-247: Consider consolidating duplicate button styles.

The songs button shares identical styling with the delete button. Consider extracting the common styles into a shared style object or component to reduce duplication.

+ const commonButtonStyle = {
+   height: '32px',
+   minHeight: '32px !important',
+   width: tablet600Down ? 'fit-content' : 'auto',
+ };

  <Button
    variant="small"
    color="red"
    startIcon={<IconDelete />}
-   sx={{
-     height: '32px',
-     minHeight: '32px !important',
-     justifySelf: 'flex-end',
-     width: tablet600Down ? 'fit-content' : 'auto',
-   }}
+   sx={{
+     ...commonButtonStyle,
+     justifySelf: 'flex-end',
+   }}
    onClick={() => handleDeleteSpeaker(speaker.person_uid)}
  >
    {t('tr_delete')}
  </Button>
  {selectedTalks.length > 0 && (
    <Button
      variant="small"
      startIcon={<IconSong />}
-     sx={{
-       height: '32px',
-       minHeight: '32px !important',
-       width: tablet600Down ? 'fit-content' : 'auto',
-     }}
+     sx={commonButtonStyle}
      onClick={handleOpenSpeakerDetails}
    >
      {t('tr_songs')}
    </Button>
  )}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2adc064 and 1c2e705.

📒 Files selected for processing (6)
  • src/features/persons/date_history/index.tsx (2 hunks)
  • src/features/persons/speakers_catalog/my_congregation/header/index.tsx (4 hunks)
  • src/features/persons/speakers_catalog/my_congregation/index.tsx (1 hunks)
  • src/features/persons/speakers_catalog/other_congregations/congregation_item/index.tsx (3 hunks)
  • src/features/persons/speakers_catalog/other_congregations/header/index.tsx (2 hunks)
  • src/features/persons/speakers_catalog/other_congregations/speakers_list/edit/index.tsx (4 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/features/persons/speakers_catalog/my_congregation/index.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Summary
🔇 Additional comments (5)
src/features/persons/date_history/index.tsx (1)

21-21: LGTM! Good breakpoint organization.

The addition of tablet600Down alongside existing breakpoints provides better granular control for mobile layouts.

src/features/persons/speakers_catalog/other_congregations/header/index.tsx (1)

86-113: LGTM! Good responsive design pattern.

The conditional rendering based on tablet600Down effectively organizes the UI elements for different screen sizes.

src/features/persons/speakers_catalog/other_congregations/congregation_item/index.tsx (1)

66-96: LGTM! Well-structured mobile layout.

The mobile button container is well-organized with proper spacing and alignment. Good use of the Button component's variant prop for consistent styling.

src/features/persons/speakers_catalog/other_congregations/speakers_list/edit/index.tsx (2)

213-214: LGTM! Improved mobile layout handling.

The flexWrap adjustment ensures a consistent horizontal button layout on mobile devices.


228-228: LGTM! Appropriate button width adjustment for mobile.

The width adjustment to 'fit-content' on mobile screens helps optimize space usage.

@rhahao rhahao merged commit a17880c into sws2apps:main Jan 12, 2025
11 checks passed
Copy link

cypress bot commented Jan 12, 2025

organized-app    Run #1928

Run Properties:  status check passed Passed #1928  •  git commit a17880cdcd: fix(persons): speakers catalog edits in mobile view
Project organized-app
Branch Review main
Run status status check passed Passed #1928
Run duration 00m 05s
Commit git commit a17880cdcd: fix(persons): speakers catalog edits in mobile view
Committer Max Makaluk
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 1
View all changes introduced in this branch ↗︎

@rhahao
Copy link
Member

rhahao commented Jan 15, 2025

🎉 This PR is included in version 3.6.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

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