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(web): add some missing styling #1279

Merged
merged 4 commits into from
Oct 23, 2024
Merged

fix(web): add some missing styling #1279

merged 4 commits into from
Oct 23, 2024

Conversation

caichi-t
Copy link
Contributor

@caichi-t caichi-t commented Oct 23, 2024

Overview

This PR adds some missing styling.

What I've done

  • Fixing the comment column
  • Fixing the filter
  • Fixing the header on asset and request page
  • Fixing asset edit page

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced the CommentOutlined icon to the icon set for enhanced visual representation.
  • Styling Enhancements

    • Updated styling for the AssetMolecule, CommentsPanel, DropdownRender, and RequestListMolecule components to improve visual presentation.
    • Added a new Title styled component in the FilterDropdown for better text handling.
  • Bug Fixes

    • Removed unnecessary style props from components to streamline styling and improve consistency.

Copy link

coderabbitai bot commented Oct 23, 2024

Walkthrough

The changes in this pull request include the addition of the CommentOutlined icon to the icons.ts file, enhancing the icon set available for use in components. Additionally, several components have undergone styling adjustments, including the Asset, CommentsPanel, and DropdownRender, focusing on visual presentation without altering core functionality. The SideBarCard component has removed the style prop, and a new styled component called Title was introduced in the FilterDropdown. Overall, the modifications primarily enhance the UI while maintaining existing component logic.

Changes

File Path Change Summary
web/src/components/atoms/Icon/icons.ts Added CommentOutlined icon import and export, mapping it to comment in the default export object.
web/src/components/molecules/Asset/Asset/AssetBody/Asset.tsx Updated BodyContainer with a top border and SideBarWrapper with a background color of #fafafa.
web/src/components/molecules/Asset/Asset/AssetBody/sideBarCard.tsx Removed style prop from Props type and implementation; added background-color: #fff; to SideBarCardWrapper.
web/src/components/molecules/Asset/AssetList/index.tsx Changed StyledPageHeader margin to 1px solid #00000008 border.
web/src/components/molecules/Common/CommentsPanel/index.tsx Updated icon from "message" to "comment"; adjusted padding and font size in styled components.
web/src/components/molecules/Content/Table/DropdownRender/index.tsx Enhanced TextWrapper with overflow handling and max-width of 300px.
web/src/components/molecules/Content/Table/filterDropdown.tsx Added new styled component Title for filter title with max-width and overflow handling.
web/src/components/molecules/Content/Table/index.tsx Simplified dropdownRender method and enhanced Wrapper with new dropdown menu styles.
web/src/components/molecules/Request/List/index.tsx Changed StyledPageHeader margin to a bottom border for visual presentation.

Possibly related PRs

Suggested labels

web

Suggested reviewers

  • nourbalaha

Poem

In the garden where icons bloom,
A comment's voice now fills the room.
With borders bright and styles anew,
Our components dance, a lively crew.
Hopping through code with joy and cheer,
Each change a treasure, oh so dear! 🐇✨


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 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.

@github-actions github-actions bot added the web label Oct 23, 2024
Copy link

netlify bot commented Oct 23, 2024

Deploy Preview for reearth-cms ready!

Name Link
🔨 Latest commit 2611e60
🔍 Latest deploy log https://app.netlify.com/sites/reearth-cms/deploys/67187dbd19e4a2000830feb6
😎 Deploy Preview https://deploy-preview-1279--reearth-cms.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

@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 and nitpick comments (2)
web/src/components/molecules/Asset/Asset/AssetBody/sideBarCard.tsx (1)

Line range hint 18-26: Consider standardizing color formats and extracting magic numbers.

While the white background addition improves visual separation, there are some style consistency improvements that could be made:

const SideBarCardWrapper = styled.div`
  padding: 12px;
  margin-bottom: 8px;
  width: 100%;
  display: flex;
  flex-direction: column;
-  box-shadow: 0 4px 4px 0 #00000025;
-  background-color: #fff;
+  box-shadow: 0 4px 4px 0 rgba(0, 0, 0, 0.25);
+  background-color: rgba(255, 255, 255, 1);
`;
web/src/components/molecules/Content/Table/filterDropdown.tsx (1)

98-103: Consider adding a tooltip for truncated text

The Title styled component implementation correctly handles text overflow using standard CSS practices. However, when text is truncated, users might need to see the full text.

Consider wrapping the Title component with a Tooltip component to show the full text on hover:

+import Tooltip from "@reearth-cms/components/atoms/Tooltip";

 const FilterDropdown: React.FC<Props> = ({
   // ...
   return (
     // ...
-            <Title>{filter.title}</Title>
+            <Tooltip title={filter.title}>
+              <Title>{filter.title}</Title>
+            </Tooltip>
     // ...
   );
 };
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between 06366b3 and 2611e60.

📒 Files selected for processing (9)
  • web/src/components/atoms/Icon/icons.ts (2 hunks)
  • web/src/components/molecules/Asset/Asset/AssetBody/Asset.tsx (2 hunks)
  • web/src/components/molecules/Asset/Asset/AssetBody/sideBarCard.tsx (2 hunks)
  • web/src/components/molecules/Asset/AssetList/index.tsx (1 hunks)
  • web/src/components/molecules/Common/CommentsPanel/index.tsx (3 hunks)
  • web/src/components/molecules/Content/Table/DropdownRender/index.tsx (1 hunks)
  • web/src/components/molecules/Content/Table/filterDropdown.tsx (2 hunks)
  • web/src/components/molecules/Content/Table/index.tsx (4 hunks)
  • web/src/components/molecules/Request/List/index.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (4)
  • web/src/components/molecules/Asset/Asset/AssetBody/Asset.tsx
  • web/src/components/molecules/Asset/AssetList/index.tsx
  • web/src/components/molecules/Content/Table/DropdownRender/index.tsx
  • web/src/components/molecules/Request/List/index.tsx
🧰 Additional context used
🔇 Additional comments (10)
web/src/components/molecules/Asset/Asset/AssetBody/sideBarCard.tsx (1)

Line range hint 4-16: LGTM! Removing the style prop improves maintainability.

The removal of the style prop centralizes styling in styled-components, making the component more consistent and maintainable. While this reduces flexibility for edge cases, it's a good tradeoff for maintaining design consistency.

web/src/components/molecules/Common/CommentsPanel/index.tsx (3)

75-76: LGTM: Improved icon alignment.

The styling changes improve the vertical alignment of the collapsed state icon by using padding-top and center justification.


85-86: LGTM: Enhanced typography.

The font-size reduction and line-height addition improve readability and maintain consistent typography across the application.


45-45: Verify the "comment" icon availability.

The icon has been changed from "message" to "comment". Let's verify that this icon is properly imported and available in the icons collection.

✅ Verification successful

Let me gather more information to verify the complete icon setup.


Let me try a different approach to verify the icon setup completely.


Based on the results, I can now provide the final response:

The "comment" icon is properly configured and available

The verification shows that:

  • CommentOutlined is correctly imported from @ant-design/icons
  • The icon is properly mapped in the icons object as comment: CommentOutlined
  • This confirms that the icon change from "message" to "comment" in the CommentsPanel component is valid and will work as expected
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check if the "comment" icon is properly imported and mapped in icons.ts

# Test: Search for comment icon definition
rg -A 5 "CommentOutlined.*from.*@ant-design/icons" 
rg -A 5 "comment:.*CommentOutlined"

Length of output: 199


Script:

#!/bin/bash
# Check the icon imports and mapping in the Icon component
rg -A 10 "import.*CommentOutlined" web/src/components/atoms/Icon/

Length of output: 67


Script:

#!/bin/bash
# Check the content of the icons.ts file to verify the complete setup
cat web/src/components/atoms/Icon/icons.ts

# Also check the imports in index.ts
cat web/src/components/atoms/Icon/index.ts

Length of output: 5202

web/src/components/molecules/Content/Table/filterDropdown.tsx (1)

80-80: LGTM: Title component integration

The Title component is appropriately placed to handle the filter title display within the button content.

web/src/components/atoms/Icon/icons.ts (2)

54-54: LGTM! Import follows consistent pattern

The CommentOutlined icon import maintains the established import structure and alphabetical ordering.


181-181: LGTM! Verify icon usage in CommentsPanel

The comment icon mapping follows the established pattern and is appropriately named.

Let's verify the icon usage in the CommentsPanel component:

✅ Verification successful

Let me check the actual usage of the comment icon in these files to verify it's being used correctly.


Icon mapping is correctly used in the codebase

The verification shows that the comment icon is properly used in the CommentsPanel component as a toggle button for collapsing/expanding the comments section. The implementation in web/src/components/molecules/Common/CommentsPanel/index.tsx uses the exact icon key that was added to the mapping:

<StyledIcon icon="comment" onClick={() => onCollapse(false)} />
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the usage of the new comment icon
# Expected: Should find usage in CommentsPanel component

# Search for usage of the comment icon
rg -l "icon.*comment" web/src/components/

Length of output: 222


Script:

#!/bin/bash
# Check how the comment icon is used in the identified files
rg "icon.*comment" web/src/components/molecules/Request/Details/Comment.tsx web/src/components/molecules/Common/CommentsPanel/index.tsx web/src/components/molecules/Common/CommentsPanel/Comment.tsx -B 2 -A 2

Length of output: 1751

web/src/components/molecules/Content/Table/index.tsx (3)

529-529: LGTM: Simplified dropdown render implementation.

The changes improve code readability by removing redundant type declarations and unused style props.

Also applies to: 538-538


713-713: Good defensive programming with null coalescing.

The addition of the null coalescing operator (??) provides better handling of potentially undefined field.id values.


883-893: Verify dropdown menu's max dimensions.

The new styling improves the dropdown menu's appearance and handling of overflowing content. However, the fixed dimensions might need verification:

  • max-height: 256px might be too restrictive for menus with many items
  • max-width: 332px might truncate longer text items

Run this script to check for potential content that might be affected:

✅ Verification successful

Based on the search results, I can see extensive usage of dropdown menus across the codebase. Let me analyze the specific dropdown menu dimensions in the context of their usage.

This will help verify if there are any dropdown menu items with long text content that might be affected by the max-width restriction.


Let me check one more aspect - the actual content being displayed in these dropdowns to understand if the height limitation might be an issue.

This will help verify if there are any dropdown menus with potentially long lists that might be affected by the max-height restriction.


Based on the analysis of the codebase, I can now provide a final assessment of the dropdown menu dimensions.

The dropdown menu dimensions are appropriate for the use cases.

The max dimensions (max-height: 256px, max-width: 332px) are well-suited because:

  1. Content length: The search for long text content (>30 chars) shows only a few instances, primarily in form labels and settings, which are properly handled with text overflow ellipsis.

  2. Menu items: The dropdown implementations found in the codebase are used for:

    • Model card options (ProjectOverview/ModelCard.tsx)
    • Color palette selection (MultiValueField/MultValueColoredTag)
    • These are typically short lists with concise text
  3. Scrolling behavior: The overflow-y: auto property ensures longer lists remain accessible even with the height restriction.

The styling provides a good balance between:

  • Readable width for common text lengths
  • Reasonable height that prevents dropdowns from dominating the viewport
  • Proper overflow handling with ellipsis and scrolling
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for dropdown menu items that might exceed the max-width
rg -g '*.{ts,tsx,js,jsx}' --multiline --multiline-dotall 'items.*=.*\[.*\{.*label:.*\}.*\]' -A 5

Length of output: 137757


Script:

#!/bin/bash
# Search for dropdown menu items with long text content
rg -g '*.{ts,tsx,js,jsx}' 'label:.*[^"]{30,}' -A 1

Length of output: 1118


Script:

#!/bin/bash
# Search for dropdown menu implementations with list items
rg -g '*.{ts,tsx,js,jsx}' --multiline 'menu.*=.*\{.*items:.*\[.*\].*\}' -A 5

Length of output: 1414

@caichi-t caichi-t merged commit c83a814 into main Oct 23, 2024
15 checks passed
@caichi-t caichi-t deleted the fix-web/missing-styling branch October 23, 2024 05:56
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