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

Client web/7012 add search input in subspaces list view #7251

Merged

Conversation

reactoholic
Copy link
Contributor

@reactoholic reactoholic commented Nov 25, 2024

Add search input in Subspaces list view

  • Replace the Subspaces list view title with search input
  • Remove the search input in the Subspaces content grid
  • Implement logic in the Subspaces list view search
  • Replace list view items icons with Subspaces card banners

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced a search placeholder for subspaces: "Find Subspaces...".
    • Added a search field in the Child Journey View to filter displayed entities dynamically.
  • Improvements

    • Enhanced visual representation of list items with avatars.
    • Clarified messaging for empty entity lists to improve user guidance.
  • Bug Fixes

    • Removed the MultipleSelect component from the JourneyFilter, streamlining the filtering process.

…con with subspace card banner, remove ther search in the main subspaces area

Signed-off-by: reactoholic <petar.georgiev.kolev@gmail.com>
@reactoholic reactoholic added client UX Enhanced user experience labels Nov 25, 2024
@reactoholic reactoholic requested a review from ccanos November 25, 2024 12:34
@reactoholic reactoholic self-assigned this Nov 25, 2024
Copy link

coderabbitai bot commented Nov 25, 2024

Walkthrough

This pull request includes updates to several components within the Alkemio platform. The translation.en.json file has been modified to add a new search placeholder and clarify existing messages. The LinksList component has been enhanced with a new avatar feature for list items. The JourneyFilter component has removed the MultipleSelect interface, streamlining the filtering process. Lastly, the ChildJourneyView component now includes a search field for filtering child entities, utilizing a new state variable and an updated interface.

Changes

File Path Change Summary
src/core/i18n/en/translation.en.json - Added key: "searchPlaceholder": "Find Subspaces..."
- Updated message: "empty-list": "There are no {{entities}} yet."
src/core/ui/list/LinksList.tsx - Added import for Avatar component.
- Updated Item interface to include cardBanner?: string;.
- Modified rendering logic to include Avatar in ListItem.
src/domain/journey/common/JourneyFilter/JourneyFilter.tsx - Removed MultipleSelect component and handleChange function, retaining filtering logic.
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx - Added state variable filter for search input.
- Updated BaseChildEntity interface to include optional cardBanner?: { uri: string; } property.
- Introduced SearchField for filtering displayed child entities.

Possibly related PRs

Suggested labels

translations

Suggested reviewers

  • ccanos

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.

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.

@reactoholic reactoholic linked an issue Nov 25, 2024 that may be closed by this pull request
4 tasks
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: 3

🧹 Outside diff range and nitpick comments (2)
src/core/ui/list/LinksList.tsx (1)

63-63: Improve accessibility and error handling

  1. The aria-label is hardcoded to "Subspace avatar". Consider using the item's title for better accessibility.
  2. Add error handling for failed image loads.
-           <Avatar variant="rounded" alt="subspace avatar" src={item.cardBanner} aria-label="Subspace avatar" />
+           <Avatar 
+             variant="rounded" 
+             alt={`${item.title} avatar`} 
+             src={item.cardBanner} 
+             aria-label={`${item.title} avatar`}
+             onError={(e) => {
+               // Set default image or hide avatar on error
+               e.currentTarget.style.display = 'none';
+             }} 
+           />
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (1)

76-77: Consider performance and maintainability improvements

While the implementation is functional, consider these improvements:

  1. Extract the magic number 3 as a named constant for better maintainability
  2. Memoize the onChange handler with useCallback to prevent unnecessary re-renders
+ const MIN_ENTITIES_FOR_SEARCH = 3;
+ const handleFilterChange = useCallback((event: React.ChangeEvent<HTMLInputElement>) => {
+   setFilter(event.target.value);
+ }, []);

- {childEntities.length > 3 && (
+ {childEntities.length > MIN_ENTITIES_FOR_SEARCH && (
    <SearchField
      value={filter}
      placeholder={t('pages.generic.sections.subentities.searchPlaceholder')}
-     onChange={event => setFilter(event.target.value)}
+     onChange={handleFilterChange}
    />
  )}

Also applies to: 94-100

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 14c64ed and 64b4fa0.

📒 Files selected for processing (4)
  • src/core/i18n/en/translation.en.json (1 hunks)
  • src/core/ui/list/LinksList.tsx (3 hunks)
  • src/domain/journey/common/JourneyFilter/JourneyFilter.tsx (0 hunks)
  • src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (5 hunks)
💤 Files with no reviewable changes (1)
  • src/domain/journey/common/JourneyFilter/JourneyFilter.tsx
🧰 Additional context used
📓 Path-based instructions (3)
src/core/i18n/en/translation.en.json (1)

Pattern src/**/*.json: Review the JSON files for correct syntax and structure.
Ensure that the configuration and data are accurate and follow the project's standards.
Check for sensitive data exposure and ensure that the data is properly validated.

src/core/ui/list/LinksList.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
🔇 Additional comments (4)
src/core/ui/list/LinksList.tsx (1)

16-16: LGTM: Import statement follows project conventions

The Avatar import uses the correct absolute path pattern with the @/ alias.

src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (2)

2-2: LGTM: Import statements are properly organized

The new imports are correctly added and align with the component's enhanced functionality.

Also applies to: 27-28


39-41: LGTM: Interface extension is well-typed

The cardBanner property is properly typed and appropriately marked as optional.

src/core/i18n/en/translation.en.json (1)

1790-1791: LGTM! The translation keys are well-formed and support the PR objectives.

The new translation keys are properly structured, use consistent capitalization, and employ correct placeholder syntax. They effectively support the UI changes for the Subspaces list view search functionality.

src/core/ui/list/LinksList.tsx Show resolved Hide resolved
src/core/ui/list/LinksList.tsx Outdated Show resolved Hide resolved
Signed-off-by: reactoholic <petar.georgiev.kolev@gmail.com>
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: 1

🧹 Outside diff range and nitpick comments (1)
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (1)

108-114: Consider adding ARIA label for better accessibility

While the implementation is good, consider adding an aria-label to improve accessibility for screen readers.

 <SearchField
   value={filter}
   placeholder={t('pages.generic.sections.subentities.searchPlaceholder')}
+  aria-label={t('pages.generic.sections.subentities.searchPlaceholder')}
   onChange={event => setFilter(event.target.value)}
 />
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 64b4fa0 and 28e6cb9.

📒 Files selected for processing (2)
  • src/core/ui/list/LinksList.tsx (4 hunks)
  • src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (5 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/ui/list/LinksList.tsx
🧰 Additional context used
📓 Path-based instructions (1)
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (1)

Pattern src/**/*.{ts,tsx,js}: Review the React.js/TypeScript/JavaScript code for best practices and potential bugs.
Ensure that the code adheres to TypeScript's typing system and modern standards.
Ensure sufficient error handling and logging is present.
Check for common security vulnerabilities such as:

  • SQL Injection
  • XSS (Cross-Site Scripting)
  • CSRF (Cross-Site Request Forgery)
  • Insecure dependencies
  • Sensitive data exposure
🔇 Additional comments (2)
src/domain/journey/common/tabs/Subentities/ChildJourneyView.tsx (2)

39-41: LGTM: Interface update aligns with PR objectives

The addition of the optional cardBanner property to BaseChildEntity interface is well-typed and correctly implements the requirement to replace icons with card banners.


81-93: LGTM: Well-optimized filtering implementation

The filtering logic is well-implemented with:

  • Proper memoization to prevent unnecessary recalculations
  • Case-insensitive search for better user experience
  • Correct fallback handling for missing card banners

@ccanos
Copy link
Contributor

ccanos commented Nov 25, 2024

Approved but created a small refactor task for the near future #7253

@ccanos ccanos merged commit 80f95d0 into develop Nov 25, 2024
3 checks passed
@ccanos ccanos deleted the client-web/7012_add-search-input-in-subspaces-list-view branch November 25, 2024 13:38
@coderabbitai coderabbitai bot mentioned this pull request Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client UX Enhanced user experience
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Space > Subspaces tab > "List view" block
2 participants