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

Make header buttons more button-like #2578

Merged
merged 3 commits into from
Dec 18, 2024
Merged

Make header buttons more button-like #2578

merged 3 commits into from
Dec 18, 2024

Conversation

frzyc
Copy link
Owner

@frzyc frzyc commented Dec 16, 2024

Describe your changes

Since more functions are folded into the card header modals, it's becoming more imperative to convey to the user that the headers are buttons, without having to hover over them.

Converts CardAction to outlined buttons, where the outline helps user denote that this element is a button.
For consistency, Tabs are outlined as well.

Full changelog:

  • Decrease padding around the team page
  • Decrease height of header elements in the team page (was using up too much above-the-fold real-estate)
  • Change outline style of tabs/buttons in the header to match outline button style
  • Add outline button like elements to other pages:
    • Team card header
    • Build Management cards
    • Character cards in Characters page
    • Loadout editor in the Character modal in Characters page

Issue or discord link

Testing/validation

Current vs New
Screenshot 2024-12-16 034953

image
image
image

Checklist before requesting a review (leave this PR as draft if any part of this list is not done.)

  • I have commented my code in hard-to understand areas.
  • I have made corresponding changes to README or wiki.
  • For front-end changes, I have updated the corresponding English translations.
  • I have run yarn run mini-ci locally to validate format and lint.
  • If I have added a new library or app, I have updated the deployment scripts to ignore changes as needed

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Expanded the color palette in the theme to include new neutral colors for enhanced customization.
    • Introduced a new TeamEditorModal component for streamlined team editing functionality.
  • Improvements

    • Enhanced visual presentation and interactivity of the LoadoutTabs and CharacterPanel components.
    • Updated the LoadoutHeader to simplify interactions with a button-centric design.
    • Replaced card-based layouts with box-based layouts for a more modern UI structure.
    • Improved the TeammateDisplay component with dynamic border colors based on character elements.
    • Enhanced the CharacterCard and LoadoutCard components with updated styling and interaction models.
  • Bug Fixes

    • Adjusted opacity and box shadow for improved visual consistency.
    • Corrected minor typographical errors in state management functions.

Copy link
Contributor

coderabbitai bot commented Dec 16, 2024

Walkthrough

This pull request introduces comprehensive updates across multiple files in the Genshin Impact (GI) page team module. The changes primarily focus on enhancing UI components, theme configuration, and component interactions. The modifications include extending the theme's color palette, updating component styling, replacing CardActionArea with more direct interaction methods like buttons and modals, and streamlining the visual presentation of team and character-related interfaces.

Changes

File Change Summary
libs/common/ui/src/theme/index.ts Extended Palette and PaletteOptions interfaces with nine new neutral color variations (neutral100-neutral900) derived from primary palette. Updated ButtonPropsColorOverrides, ChipPropsColorOverrides, and InputBasePropsColorOverrides to include new neutral colors.
libs/gi/page-team/src/CharacterDisplay/Content.tsx Updated color manipulation, adjusted CardThemed shadow and background opacity, enhanced LoadoutTabs styling with dynamic color handling.
libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx Replaced CardActionArea with Button components, added elementKey prop, simplified component structure.
libs/gi/page-team/src/TeamCharacterSelector.tsx Introduced TeamEditorModal, replaced edit mode logic with modal-based editing, removed CardActionArea.
libs/gi/page-team/src/index.tsx Replaced CardContent with Box component, maintained existing functionality and layout.
libs/gi/page-team/src/TeamSetting/TeamComponents.tsx Enhanced TeammateDisplay by adding color manipulation for border styling based on character elements.
libs/gi/ui/src/components/artifact/ArtifactCardNano.tsx Adjusted vertical padding in Box when no artifact is present.
libs/gi/ui/src/components/build/BuildCard.tsx Replaced CardActionArea with Button, updated interaction model and styling.
libs/gi/ui/src/components/character/CharacterCard.tsx Restructured CharacterCardProps type definition and updated sx prop for CardThemed.
libs/gi/ui/src/components/character/editor/LoadoutCard.tsx Replaced CardActionArea with Button, streamlined layout.
libs/gi/ui/src/components/character/editor/LoadoutHeaderContent.tsx Added width: '100%' style to CardContent for improved layout.
libs/gi/ui/src/components/team/TeamCard.tsx Replaced CardActionArea with Button components, adjusted layout and styling.
libs/gi/ui/src/components/team/TeamDelModal.tsx Replaced CardActionArea with Button, corrected state setter function name.
libs/gi/ui/src/components/weapon/WeaponCardNano.tsx Adjusted vertical padding in Box for placeholder image when no weapon data is available.

Possibly Related PRs

Poem

🐰 Neutral colors bloom like spring,
Buttons dance and components swing!
From shadows soft to borders bright,
Our UI leaps with pure delight!
Code rabbits hop, the theme takes flight! 🌈


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

github-actions bot commented Dec 16, 2024

[sr-frontend] [Mon Dec 16 09:06:01 UTC 2024] - Deployed ae3e850 to https://genshin-optimizer-prs.github.io/pr/2578/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Mon Dec 16 09:06:12 UTC 2024] - Deployed ae3e850 to https://genshin-optimizer-prs.github.io/pr/2578/frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Mon Dec 16 09:39:00 UTC 2024] - Deployed 107586e to https://genshin-optimizer-prs.github.io/pr/2578/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Mon Dec 16 09:39:33 UTC 2024] - Deployed 107586e to https://genshin-optimizer-prs.github.io/pr/2578/sr-frontend (Takes 3-5 minutes after this completes to be available)

[frontend] [Mon Dec 16 20:57:38 UTC 2024] - Deployed ef9ff3f to https://genshin-optimizer-prs.github.io/pr/2578/frontend (Takes 3-5 minutes after this completes to be available)

[sr-frontend] [Mon Dec 16 20:58:14 UTC 2024] - Deployed ef9ff3f to https://genshin-optimizer-prs.github.io/pr/2578/sr-frontend (Takes 3-5 minutes after this completes to be available)

[Wed Dec 18 03:06:49 UTC 2024] - Deleted deployment

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 comments (1)
libs/common/ui/src/theme/index.ts (1)

Line range hint 227-237: Fix inconsistent naming in neutral color definitions.

Some neutral colors are incorrectly named as 'primary' which could cause confusion.

 neutral700: defaultTheme.palette.augmentColor({
   color: { main: '#191C2B' },
-  name: 'primary',
+  name: 'neutral700',
 }),
 neutral800: defaultTheme.palette.augmentColor({
   color: { main: '#0C0F1A' },
-  name: 'primary',
+  name: 'neutral800',
 }),
 neutral900: defaultTheme.palette.augmentColor({
   color: { main: '#020515' },
-  name: 'primary',
+  name: 'neutral900',
 }),
🧹 Nitpick comments (4)
libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (1)

51-57: Simplify Typography styling

The Typography component inside the Button has unnecessary styling properties. The Button component already handles alignment of its children.

 <Typography
   variant="h6"
   noWrap
-  sx={{
-    alignItems: 'center',
-    justifyContent: 'center',
-  }}
 >
libs/gi/page-team/src/CharacterDisplay/Content.tsx (1)

130-134: Consider memoizing color calculations

The color calculations are performed on every render. Consider memoizing these values using useMemo to optimize performance.

+ const colorMemo = useMemo(() => {
    const color = elementKey && theme.palette[elementKey]?.main
    const colorrgb = color && hexToColor(color)
    return (alpha = 1) =>
      (colorrgb && colorToRgbaString(colorrgb, alpha)) ??
      `rgba(255,255,255,${alpha})`
+ }, [elementKey, theme])
libs/gi/page-team/src/TeamCharacterSelector.tsx (1)

225-277: Consider adding form validation

The TeamEditorModal component could benefit from form validation to ensure data quality. Consider adding validation for empty names or maximum length constraints.

 const handleName = (teamName: string): void => {
+  if (!teamName.trim()) return
+  if (teamName.length > 50) return
   database.teams.set(teamId, { name: teamName })
 }
libs/gi/page-team/src/index.tsx (1)

Line range hint 171-190: Nice touch with the element-based gradient background!

The dynamic background gradient based on character's element adds visual depth and reinforces the game's element system. However, consider caching the gradient value to optimize performance.

 sx={(theme) => {
   const elementKey = characterKey && getCharEle(characterKey)
   if (!elementKey) return {}
   const hex = theme.palette[elementKey].main as string
   const color = hexToColor(hex)
   if (!color) return {}
   const rgba = colorToRgbaString(color, 0.1)
+  // Memoize the gradient value using useMemo to prevent recalculation on every render
+  const gradientStyle = useMemo(() => ({
+    background: `linear-gradient(to bottom, ${rgba} 0%, rgba(0,0,0,0)) 25%`
+  }), [rgba])
-  return {
-    background: `linear-gradient(to bottom, ${rgba} 0%, rgba(0,0,0,0)) 25%`
-  }
+  return gradientStyle
 }}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 66413c0 and 0a1dea3.

📒 Files selected for processing (5)
  • libs/common/ui/src/theme/index.ts (1 hunks)
  • libs/gi/page-team/src/CharacterDisplay/Content.tsx (9 hunks)
  • libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (2 hunks)
  • libs/gi/page-team/src/TeamCharacterSelector.tsx (8 hunks)
  • libs/gi/page-team/src/index.tsx (2 hunks)
🔇 Additional comments (7)
libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (2)

3-3: LGTM! Clean component signature update

The addition of ElementKey type and Button component, along with the updated component signature, provides better type safety and aligns with the goal of making headers more button-like.

Also applies to: 8-8, 14-14


64-96: LGTM! Consistent button implementation

The second button maintains consistency with the first button's styling and behavior, creating a cohesive user interface.

libs/gi/page-team/src/CharacterDisplay/Content.tsx (1)

Line range hint 88-98: LGTM! Improved visual hierarchy

The adjustments to box shadow (1px) and background opacity (0.3) enhance the visual hierarchy while maintaining readability.

libs/gi/page-team/src/TeamCharacterSelector.tsx (2)

63-63: LGTM! Clean state management

The use of useBoolState hook simplifies modal state management and reduces boilerplate code.


Line range hint 172-201: LGTM! Consistent tab styling

The tab styling maintains consistency with the button-like design pattern, creating a cohesive user interface.

libs/gi/page-team/src/index.tsx (1)

203-212: LGTM! Clean implementation of flexible container.

The Box component with consistent padding and gap provides a better structure for the content layout.

libs/common/ui/src/theme/index.ts (1)

106-115: LGTM! Comprehensive neutral color palette addition.

The neutral color palette provides a good range of options for button styling, improving the visual hierarchy of the UI.

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 (2)
libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (2)

23-55: Consider extracting common tooltip styles and enhancing accessibility

While the implementation is solid, consider these improvements:

  1. The tooltip style structure is duplicated. Consider extracting it to a reusable component.
  2. Add aria-label to improve accessibility for screen readers.

Example refactor:

+ const TooltipContent = ({ title }: { title: string }) => (
+   <Box>
+     <Box sx={{ display: 'flex', color: 'info.light', gap: 1 }}>
+       <BorderColorIcon />
+       <Typography>
+         <strong>{title}</strong>
+       </Typography>
+     </Box>
+     {!!teamChar.description && (
+       <Typography>{teamChar.description}</Typography>
+     )}
+   </Box>
+ )

  <BootstrapTooltip
    placement="top"
-   title={
-     <Box>
-       <Box sx={{ display: 'flex', color: 'info.light', gap: 1 }}>
-         <BorderColorIcon />
-         <Typography>
-           <strong>{t('loadout.edit')}</strong>
-         </Typography>
-       </Box>
-       {!!teamChar.description && (
-         <Typography>{teamChar.description}</Typography>
-       )}
-     </Box>
-   }
+   title={<TooltipContent title={t('loadout.edit')} />}
  >
    <Button
+     aria-label={`Edit loadout for ${teamChar.name}`}
      // ... rest of the button props
    >

Line range hint 14-93: Good architectural choice moving to semantic button elements

The transition from CardActionArea to semantic Button components is a solid architectural decision that:

  1. Improves accessibility by using proper semantic HTML
  2. Makes the interactive nature of these elements more obvious to users
  3. Provides better keyboard navigation support by default

The use of elementKey for styling is also a good pattern for maintaining visual consistency with the game's element system.

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 0a1dea3 and 7d9e0fa.

📒 Files selected for processing (1)
  • libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (2 hunks)
🔇 Additional comments (3)
libs/gi/page-team/src/CharacterDisplay/LoadoutHeader.tsx (3)

3-8: LGTM! Import changes align with button-centric UI approach

The removal of Card-related imports and addition of Button components aligns well with the PR's objective of making headers more button-like.


Line range hint 14-20: LGTM! Clean component signature with proper type safety

The addition of the elementKey prop with proper TypeScript typing enhances the component's flexibility for element-based styling. Hook usage follows React best practices.


57-89: Consider handling long build names and text overflow

While the Typography component has noWrap, there might be cases where very long build names could affect the layout. Consider:

  1. Adding a maximum width constraint
  2. Implementing text truncation with ellipsis
  3. Adding a tooltip with the full name for truncated text

Let's check for potentially long build names in the database:

@frzyc frzyc requested a review from nguyentvan7 December 16, 2024 09:42
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: 1

🔭 Outside diff range comments (1)
libs/gi/ui/src/components/character/CharacterCard.tsx (1)

Line range hint 52-59: Consider replacing CardActionArea with Button component

Given the PR's objective of making elements more button-like, consider using MUI's Button component instead of CardActionArea. This would provide better semantic meaning and accessibility.

- <CardActionArea
-   onClick={onClickHandler}
-   sx={{ flexGrow: 1, display: 'flex', flexDirection: 'column' }}
- >
-   {children}
- </CardActionArea>
+ <Button
+   onClick={onClickHandler}
+   variant="outlined"
+   fullWidth
+   sx={{ 
+     flexGrow: 1, 
+     display: 'flex', 
+     flexDirection: 'column',
+     textTransform: 'none'
+   }}
+ >
+   {children}
+ </Button>
🧹 Nitpick comments (7)
libs/gi/page-team/src/TeamSetting/TeamComponents.tsx (1)

160-174: Consider performance and maintainability improvements.

The element-based styling implementation looks good, but could benefit from some refinements:

  1. Consider extracting magic numbers for opacity into named constants
  2. The color transformation could be memoized to prevent unnecessary recalculations

Here's a suggested improvement:

+ const BORDER_OPACITY = {
+   default: 0.3,
+   hover: 0.8,
+ } as const;
+
  <CardThemed
    bgt="light"
    sx={(theme) => {
+     const getColorRgba = useMemo(() => {
        const color = elementKey && theme.palette[elementKey]?.main
        const colorrgb = color && hexToColor(color)
        return (alpha = 1) =>
          (colorrgb && colorToRgbaString(colorrgb, alpha)) ??
          `rgba(255,255,255,${alpha})`
+     }, [elementKey, theme.palette]);

      return {
-       border: `1px solid ${colorrbga(0.3)}`,
+       border: `1px solid ${getColorRgba(BORDER_OPACITY.default)}`,
        '&:hover': {
-         border: `1px solid ${colorrbga(0.8)}`,
+         border: `1px solid ${getColorRgba(BORDER_OPACITY.hover)}`,
        },
      }
    }}
  >
libs/gi/ui/src/components/character/CharacterCard.tsx (1)

93-101: Use theme values for consistent styling

While the border and hover effects align with making elements more interactive, consider using theme values for colors and borders instead of hardcoded rgba values.

  sx={{
    height: '100%',
    display: 'flex',
    flexDirection: 'column',
-   border: '1px solid rgba(200,200,200,0.3)',
-   ':hover': {
-     border: '1px solid rgba(200,200,200,0.8)',
-   },
+   border: `1px solid ${theme.palette.divider}`,
+   ':hover': {
+     border: `1px solid ${theme.palette.action.hover}`,
+   },
  }}
libs/gi/ui/src/components/artifact/ArtifactCardNano.tsx (2)

Line range hint 41-48: Consider converting CardActionArea to an outlined button for consistency.

Given the PR's objective of making interactive elements more button-like, consider updating the CardActionArea wrapper to use an outlined button style, similar to other changes in this PR. This would make the interactive nature of the artifact card more obvious to users.

Example approach:

- const actionWrapperFunc = useCallback(
-   (children: ReactNode) => (
-     <CardActionArea onClick={onClick} sx={{ height: '100%' }}>
-       {children}
-     </CardActionArea>
-   ),
-   [onClick]
- )
+ const actionWrapperFunc = useCallback(
+   (children: ReactNode) => (
+     <Button
+       variant="outlined"
+       onClick={onClick}
+       sx={{
+         height: '100%',
+         p: 0,
+         '&:hover': {
+           backgroundColor: 'transparent'
+         }
+       }}
+     >
+       {children}
+     </Button>
+   ),
+   [onClick]
+ )

Line range hint 134-157: Enhance accessibility for artifact information.

The tooltips and interactive elements could benefit from improved accessibility:

  1. Add descriptive ARIA labels to the interactive elements
  2. Enhance tooltip content with more context
  3. Ensure color contrast meets WCAG guidelines for stat values

Example improvements:

 <BootstrapTooltip
   placement="top"
   title={
     <Typography>
-      <StatColoredWithUnit statKey={mainStatKey} />
+      {`Main Stat: ${mainStatKey}`}
+      <StatColoredWithUnit statKey={mainStatKey} />
     </Typography>
   }
+  aria-label={`View details for ${mainStatKey}`}
   disableInteractive
 >
   <Box lineHeight={0}>
     <StatIcon
       statKey={mainStatKey}
+      aria-hidden="true"
       iconProps={{ style: { padding: '4px' } }}
     />
   </Box>
 </BootstrapTooltip>
libs/gi/ui/src/components/build/BuildCard.tsx (1)

80-87: Consider standardizing button color across components

The button uses color="neutral300" while LoadoutCard uses neutral100. Consider standardizing this for consistency across the application.

libs/gi/ui/src/components/team/TeamDelModal.tsx (1)

Line range hint 47-47: Fix typo in state setter name

The state setter name contains a typo: setDelArry should be setDelArr.

-  const [delArr, setDelArry] = useState(() =>
+  const [delArr, setDelArr] = useState(() =>
libs/gi/ui/src/components/team/TeamCard.tsx (1)

128-140: Consider adding an aria-label to the delete button.

The delete button currently only has an icon, which might not be clear to screen readers.

Apply this diff:

 <Button
   variant="outlined"
   size="small"
   onClick={onShowDel}
   color="error"
+  aria-label="Delete team"
   sx={{
     borderTopLeftRadius: 0,
     borderBottomRightRadius: 0,
     borderBottomLeftRadius: 0,
   }}
 >
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7d9e0fa and ca28bce.

📒 Files selected for processing (9)
  • libs/gi/page-team/src/TeamSetting/TeamComponents.tsx (4 hunks)
  • libs/gi/ui/src/components/artifact/ArtifactCardNano.tsx (1 hunks)
  • libs/gi/ui/src/components/build/BuildCard.tsx (4 hunks)
  • libs/gi/ui/src/components/character/CharacterCard.tsx (3 hunks)
  • libs/gi/ui/src/components/character/editor/LoadoutCard.tsx (2 hunks)
  • libs/gi/ui/src/components/character/editor/LoadoutHeaderContent.tsx (1 hunks)
  • libs/gi/ui/src/components/team/TeamCard.tsx (4 hunks)
  • libs/gi/ui/src/components/team/TeamDelModal.tsx (2 hunks)
  • libs/gi/ui/src/components/weapon/WeaponCardNano.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • libs/gi/ui/src/components/character/editor/LoadoutHeaderContent.tsx
🧰 Additional context used
🪛 Biome (1.9.4)
libs/gi/ui/src/components/team/TeamCard.tsx

[error] 152-160: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

🔇 Additional comments (9)
libs/gi/page-team/src/TeamSetting/TeamComponents.tsx (2)

2-2: LGTM: New imports support element-based styling.

The added color manipulation utilities and element retrieval function align well with the PR's objective of enhancing visual representation.

Also applies to: 20-20


150-150: LGTM: Element key retrieval for styling.

The element key is correctly retrieved using the imported getCharEle utility.

libs/gi/ui/src/components/character/CharacterCard.tsx (1)

37-42: LGTM: Props interface restructuring improves code clarity

The inline props definition simplifies the code while maintaining type safety.

libs/gi/ui/src/components/artifact/ArtifactCardNano.tsx (1)

68-68: LGTM! The added padding improves visual balance.

The addition of vertical padding (py: 2) to the empty state Box component helps maintain consistent height and improves the visual presentation when no artifact is selected.

libs/gi/ui/src/components/character/editor/LoadoutCard.tsx (1)

44-57: LGTM! Button implementation enhances visual clarity

The replacement of CardActionArea with Button effectively achieves the PR's goal of making header elements more visually button-like. The styling choices (neutral100 color, outlined variant) maintain subtlety while improving affordance.

libs/gi/ui/src/components/build/BuildCard.tsx (1)

Line range hint 50-67: Verify spacing with Box wrapper

The Box wrapper might affect the content spacing. Please verify that this doesn't create unwanted padding or margins.

✅ Verification successful

The previous ast-grep pattern might have failed due to syntax. Let's try to gather more context about the Box and CardHeader usage patterns in the codebase to verify the spacing concerns.


Let's try without the file type specification since it wasn't recognized. We'll focus on finding similar patterns to understand the spacing conventions in the codebase.


Box wrapper spacing is consistent with codebase patterns

The Box wrapper's spacing implementation in BuildCard.tsx follows established patterns in the codebase:

  • The CardContent has explicit spacing control with sx={{ pt: 0, pb: 1 }}, which is a common pattern seen across multiple components
  • The Box wrapper without explicit sx props is used similarly in other card components (e.g., in StatFilterCard.tsx, BuildDisplayItem.tsx)
  • The current implementation maintains consistent spacing with other card components in the codebase that use similar Box + Card patterns
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for similar Box wrapper patterns to ensure consistency
ast-grep --pattern 'Box>
  <CardHeader
    $$$
  />'

Length of output: 54


Script:

#!/bin/bash
# Search for Box components wrapping CardHeader with different pattern
rg -U "Box.*\n.*CardHeader" --type tsx

# Search for CardHeader components to compare styling patterns
rg -U "CardHeader.*\n.*sx=\{.*\}" --type tsx

# Search for specific Box+Card styling patterns
rg -U "Box.*sx=\{.*\}.*\n.*Card" --type tsx

Length of output: 217


Script:

#!/bin/bash
# Search for Box components wrapping CardHeader with different pattern
rg -U "Box.*\n.*CardHeader"

# Search for similar Card components to understand spacing patterns
rg -U "CardContent.*sx.*pt:|pb:" -A 2

# Look for other Box wrapper patterns around Card components
rg -U "<Box.*>.*\n.*<Card"

Length of output: 9872

libs/gi/ui/src/components/team/TeamDelModal.tsx (1)

Line range hint 164-180: LGTM! Button implementation maintains consistency

The Button implementation aligns well with the pattern established in other components, maintaining visual consistency across the application.

libs/gi/ui/src/components/weapon/WeaponCardNano.tsx (1)

49-49: LGTM!

The added vertical padding improves the visual spacing around the placeholder weapon type image.

libs/gi/ui/src/components/team/TeamCard.tsx (1)

Line range hint 92-140: LGTM! Button improvements enhance visual clarity.

The replacement of CardActionArea with Button components and the addition of outlined variants make the interactive elements more visually apparent to users.

🧰 Tools
🪛 Biome (1.9.4)

[error] 152-160: Missing key property for this element in iterable.

The order of the items may change, and having a key can help React identify which item was moved.
Check the React documentation.

(lint/correctness/useJsxKeyInIterable)

libs/gi/ui/src/components/team/TeamCard.tsx Show resolved Hide resolved
@frzyc frzyc merged commit a654fad into master Dec 18, 2024
9 checks passed
@frzyc frzyc deleted the loadout_header_btns branch December 18, 2024 03:06
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.

2 participants