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

[Simple Homepage] Activity view - Recent Spaces + mobile support #7116

Merged
merged 5 commits into from
Nov 4, 2024

Conversation

bobbykolev
Copy link
Contributor

@bobbykolev bobbykolev commented Oct 31, 2024

#7054

  • The Recent spaces/journeys were simplified. Now the new JoruneyTile is used. There was a redundant hydration request for every space (removed).
  • The layout was reworked to support smaller resolutions.

I'll leave the extension of JourneyTile to support a spaceLevel icon in front, for a separate task.

Summary by CodeRabbit

  • New Features

    • Enhanced user interface translations for improved clarity and user experience.
    • Added mobile responsiveness to dashboard components for better accessibility on various devices.
    • Introduced a new RecentSpaceProfile fragment to enrich space information in queries.
  • Bug Fixes

    • Simplified and clarified messaging in various sections, including home and memberships.
  • Chores

    • Removed outdated components that were no longer in use, streamlining the codebase.

Copy link

coderabbitai bot commented Oct 31, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes in this pull request include significant updates to the translation.en.json file, enhancing user interface translations. Additionally, mobile responsiveness features were added to the DashboardActivity.tsx file, and the RecentJourneyCard.tsx and RecentJourneyHydrator.tsx components were removed. The RecentJourneysList.tsx component was modified to improve layout and responsiveness, while the GraphQL queries for recent spaces were updated to include new profile fragments.

Changes

File Path Change Summary
src/core/i18n/en/translation.en.json Updated with new keys and modifications to existing ones across multiple sections, including "home," "footer," "community," and "navigation."
src/main/topLevelPages/myDashboard/DashboardWithMemberships/DashboardActivity.tsx Added mobile responsiveness features using useMediaQuery, modifying layout calculations based on screen size.
src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyCard.tsx Component removed. Previously displayed a card for recent journeys with responsive layout and visual elements.
src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyHydrator.tsx Component removed. Previously hydrated recent journey data based on a journey ID, utilizing various hooks and types.
src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneysList.tsx Modified to replace removed components with JourneyTile, added mobile responsiveness, and reorganized rendering logic for journey items.
src/main/topLevelPages/myDashboard/recentSpaces/RecentSpace.graphql Query removed. Previously retrieved information about a specific space based on spaceId.
src/main/topLevelPages/myDashboard/recentSpaces/RecentSpaces.graphql Added a new fragment RecentSpaceProfile to the RecentSpaces query for enhanced profile data retrieval.

Possibly related PRs

Suggested labels

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

@bobbykolev
Copy link
Contributor Author

@coderabbitai review. Please, skip redundant comments related to error handling (we have global error handling).

Copy link

coderabbitai bot commented Oct 31, 2024

@bobbykolev: Understood, I will skip redundant comments related to error handling as you have global error handling in place. I will review the changes.


✏️ Learnings added
Learnt from: bobbykolev
URL: https://github.com/alkem-io/client-web/pull/7116

Timestamp: 2024-10-31T15:13:21.201Z
Learning: This project uses global error handling, so when reviewing code, skip redundant comments related to error handling.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

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: 4

🧹 Outside diff range and nitpick comments (2)
src/core/i18n/en/translation.en.json (2)

Line range hint 1-2199: Consider adding documentation for translation patterns.

While the translations follow consistent patterns, consider adding a comment block at the top of the file documenting:

  • Variable interpolation using {{variable}} syntax
  • Pluralization using _plural suffix
  • HTML tag handling in translations
    This would help maintainers follow the established patterns.

Line range hint 1-2199: Consider externalizing URLs from translation strings.

URLs are currently hardcoded in translation strings (e.g., "https://welcome.alkem.io/..."). Consider:

  1. Moving URLs to a separate configuration file
  2. Using URL keys in translation strings
  3. Interpolating URLs during runtime

This would make it easier to:

  • Update URLs across the application
  • Support different environments (staging, production)
  • Maintain URL consistency

Example approach:

{
  "urls": {
    "welcome": "https://welcome.alkem.io",
    "blog": "{{welcome}}/blog/",
    "contact": "{{welcome}}/contact/"
  },
  "pages": {
    "home": {
      "sections": {
        "tipsAndTricks": {
          "findMoreUrl": "{{urls.blog}}"
        }
      }
    }
  }
}
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a148d07 and 0fe2588.

⛔ Files ignored due to path filters (2)
  • src/core/apollo/generated/apollo-hooks.ts is excluded by !**/generated/**
  • src/core/apollo/generated/graphql-schema.ts is excluded by !**/generated/**
📒 Files selected for processing (7)
  • src/core/i18n/en/translation.en.json (1 hunks)
  • src/main/topLevelPages/myDashboard/DashboardWithMemberships/DashboardActivity.tsx (1 hunks)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyCard.tsx (0 hunks)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyHydrator.tsx (0 hunks)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneysList.tsx (1 hunks)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentSpace.graphql (0 hunks)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentSpaces.graphql (1 hunks)
💤 Files with no reviewable changes (3)
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyCard.tsx
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneyHydrator.tsx
  • src/main/topLevelPages/myDashboard/recentSpaces/RecentSpace.graphql
🧰 Additional context used
📓 Path-based instructions (4)
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/main/topLevelPages/myDashboard/DashboardWithMemberships/DashboardActivity.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/main/topLevelPages/myDashboard/recentSpaces/RecentJourneysList.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/main/topLevelPages/myDashboard/recentSpaces/RecentSpaces.graphql (1)

Pattern src/**/*.{graphql,gql}: Review the GraphQL schema and queries for best practices, potential bugs, and adherence to the project's GraphQL standards.
Ensure that the schema is well-defined and queries are optimized.
Check for security vulnerabilities.

🔇 Additional comments (8)
src/main/topLevelPages/myDashboard/recentSpaces/RecentSpaces.graphql (2)

6-8: LGTM! Efficient profile data fetching.

The inclusion of the profile field with fragment spread optimizes data fetching by including all necessary fields in a single query, eliminating the need for separate hydration requests.


15-22: Verify the VisualUri fragment dependency.

The fragment definition looks good and includes all necessary fields for the profile. However, let's verify the existence and implementation of the referenced VisualUri fragment.

✅ Verification successful

VisualUri fragment dependency is properly implemented

The VisualUri fragment is correctly defined in src/domain/common/visual/graphql/visualUri.graphql with all necessary fields (id, uri, name) and is properly referenced in the RecentSpaceProfile fragment.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the existence and implementation of VisualUri fragment
# Expected: Find the fragment definition in the codebase

# Search for VisualUri fragment definition
ast-grep --pattern 'fragment VisualUri on $_ {
  $$$
}'

# Alternatively, search using ripgrep
rg 'fragment\s+VisualUri\s+on'

Length of output: 247


Script:

#!/bin/bash
# Let's check the implementation of VisualUri fragment
cat src/domain/common/visual/graphql/visualUri.graphql

Length of output: 107

src/main/topLevelPages/myDashboard/recentSpaces/RecentJourneysList.tsx (3)

34-34: 🛠️ Refactor suggestion

Remove redundant slice operation.

The slice operation is unnecessary since the query already limits the results using the limit parameter.

- {data?.me.mySpaces.slice(0, visibleSpaces).map(result => (
+ {data?.me.mySpaces.map(result => (

Likely invalid or redundant comment.


38-44: Verify journey object structure completeness.

The journey object seems to contain only basic profile information. Verify if this matches the expected JourneyTile props interface and if additional properties are required.

✅ Verification successful

Journey object structure is complete and correct

The provided journey object structure matches the expected JourneyTileProps interface exactly. From the interface definition found in src/domain/journey/common/JourneyTile/JourneyTile.tsx, the journey prop requires only:

  • profile.displayName (string)
  • profile.url (string)
  • profile.cardBanner (Visual, optional)

All these properties are correctly included in the implementation.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for JourneyTile usage patterns
ast-grep --pattern 'JourneyTile $props={$_}'

Length of output: 130


Script:

#!/bin/bash
# Search for JourneyTile component definition and its props interface
ast-grep --pattern 'interface JourneyTileProps {
  $$$
}'

# Also search for JourneyTile component usage with journey prop
ast-grep --pattern '<JourneyTile journey={$_}'

# Backup search using ripgrep
rg "JourneyTile.*journey" -A 5

Length of output: 6475


25-25: Remove TODO comment after verification.

The comment suggests that the logic for calculating the limit needs verification. This should be resolved before merging.

✅ Verification successful

The limit calculation logic is correct and can be verified

The visibleSpaces calculation (columns / 2 - 1) is used consistently with the responsive layout logic where cardColumns is calculated as columns / 2 for mobile and columns / 4 for desktop. The limit is appropriately used to fetch the exact number of spaces needed for the grid layout. You can safely remove the TODO comment.

  • The calculation ensures proper grid alignment with the responsive layout
  • Similar pattern is used in other space-related views (SpaceExplorerView.tsx, ExploreSpacesView.tsx) where visible spaces are limited based on layout requirements
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Search for any related limit calculations in space queries
rg -A 5 "limit.*space" --type ts

Length of output: 130


Script:

#!/bin/bash
# Search for limit calculations in the component and related files
rg -g "*.{ts,tsx}" -A 5 "limit.*visibleSpaces"

# Search for visibleSpaces calculations
rg -g "*.{ts,tsx}" -A 5 "visibleSpaces.*columns"

# Look for JourneyTile usage patterns
ast-grep --pattern 'const visibleSpaces = $_'

Length of output: 1782

src/main/topLevelPages/myDashboard/DashboardWithMemberships/DashboardActivity.tsx (1)

29-35: Layout changes look good!

The responsive layout implementation using blockColumns is clean and effectively handles both mobile and desktop views. The structure maintains consistency across different screen sizes.

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

2199-2199: LGTM! Clear and consistent translation text.

The translation text "Explore all your Spaces" is clear, action-oriented, and follows the established pattern for similar "see more" actions throughout the application.


Line range hint 1-2199: LGTM! Well-structured JSON.

The JSON structure is valid and follows proper nesting conventions, making it maintainable and easy to navigate.

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