Skip to content

Layout bug fixes#127

Merged
gaspergrom merged 2 commits intomainfrom
improvement/layout-bugfixes
Mar 21, 2025
Merged

Layout bug fixes#127
gaspergrom merged 2 commits intomainfrom
improvement/layout-bugfixes

Conversation

@gaspergrom
Copy link
Copy Markdown
Collaborator

@gaspergrom gaspergrom commented Mar 20, 2025

Summary by CodeRabbit

  • New Features

    • Introduced manual "Load more" buttons for collections and project displays, enhancing control over data fetching with increased page sizes.
    • Expanded project information now delivers more detailed insights.
  • Style

    • Updated repository header design and tag appearance for a more polished look.
    • Refined footer layout improves spacing and overall page structure.
  • Chores

    • Improved URL formatting for repository links, ensuring cleaner and consistent identifiers.
    • Added new dependency for enhanced slug generation functionality.

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom requested a review from emlimlf March 20, 2025 14:32
@gaspergrom gaspergrom self-assigned this Mar 20, 2025
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 20, 2025

Walkthrough

This pull request updates the pagination and repository handling across several components. The collection views now use an explicit “Load more” button instead of scroll-based loading, and their page size values have been adjusted. In addition, the project header and repository components now compute and pass repository slugs rather than names. Corresponding changes have been made in the project store, search result component, API endpoints, helper functions, and type definitions to reflect the updated data structure for repositories.

Changes

File(s) Change Summary
frontend/.../collection-details.vue
frontend/.../collection-list.vue
Replaced automatic scroll-based pagination with a manual “Load more” button. Updated pageSize values (from 50 to 60 and 10 to 50, respectively) and added a loadMore method. Removed the scroll monitoring logic and its associated imports.
frontend/.../header.vue
frontend/.../repository-switch.vue
Modified repository display and routing. Introduced a computed repoSlug, updated class bindings for truncation, and changed key/route bindings from using repository name to using its slug/URL.
frontend/.../project.store.ts
frontend/.../search-result.vue
Streamlined repository mapping by removing the extra transformation with getRepoNameFromUrl and updating comparisons from repository name to slug. Adjusted the routing parameters accordingly.
frontend/.../tag/tag.scss
frontend/.../default.vue
Adjusted UI styling: updated transparent tag text color and modified the footer layout container and padding values.
frontend/package.json Added a new dependency: "slugify": "^1.6.6".
frontend/.../api/project/[slug]/index.ts
frontend/.../api/search.ts
frontend/.../helpers/repository.helpers.ts
Modified API responses to format repository data with name, url, and slug. Introduced the helper function getRepoSlugFromName and updated usage of repository information.
frontend/.../types/project.ts
frontend/.../types/search.ts
Updated type definitions for projects and repositories by replacing the repo property with url, adding a slug, and expanding the Project interface with additional fields.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant C as Collection View Component
  participant API as API Endpoint

  U->>C: Clicks "Load More" button
  C->>C: Execute loadMore() (increments page counter)
  C->>API: Request next set of data (using updated page and pageSize)
  API-->>C: Return additional project/collection data
  C->>U: Render and append newly loaded items
Loading

Possibly related PRs

  • Collection details #52: Addresses similar updates to the loadMore functionality and pageSize adjustments in the collection views.
  • Repo switching #44: Involves modifications to the project header and repository handling logic, closely related to the slug-based updates.
  • Search endpoint #68: Focused on changes to repository name extraction with getRepoNameFromUrl, aligning with the updated repository data structure.

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 800424e and 1379860.

📒 Files selected for processing (2)
  • frontend/app/components/modules/collection/views/collection-details.vue (4 hunks)
  • frontend/app/components/modules/collection/views/collection-list.vue (3 hunks)
🔇 Additional comments (8)
frontend/app/components/modules/collection/views/collection-details.vue (4)

51-62: Good implementation of the "Load more" button.

This is a nice improvement over scroll-based loading, as it gives users more explicit control over when to load additional content. The conditional visibility based on available items is appropriate.


76-76: Appropriate component import.

Correctly importing the button component required for the new "Load more" feature.


89-89: Conversion from ref to constant is correct.

Good job converting pageSize from a ref to a constant value as suggested in the previous review.


122-124: Straightforward implementation of loadMore.

The implementation is simple and effective - incrementing the page value will trigger the appropriate data fetching due to the watch on the page variable in the useFetch hook.

frontend/app/components/modules/collection/views/collection-list.vue (4)

89-100: Good implementation of the "Load more" button.

This implementation is consistent with the approach in collection-details.vue, providing a unified user experience across different collection views. The conditional rendering logic is appropriate.


119-119: Appropriate component import.

Correctly importing the button component required for the new "Load more" feature.


126-126: Significant increase in pageSize value.

You've increased the pageSize from 10 to 50, which is a 5x increase. This will reduce the number of API calls needed but might impact initial load time. Ensure this doesn't negatively affect performance, especially on slower connections.


161-163: Straightforward implementation of loadMore.

The implementation is simple and effective - incrementing the page value will trigger the appropriate data fetching due to the watch on the page variable in the useFetch hook.


🪧 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.
  • @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
Copy Markdown

@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 (1)
frontend/server/helpers/repository.helpers.ts (1)

29-29: New utility function to convert repository names to slugs

The implementation correctly handles repository name conversion to URL-friendly slugs by replacing slashes with hyphens and applying lowercase transformation.

Consider adding a null/undefined check to make the function more robust:

-export const getRepoSlugFromName = (name: string): string => slugify(name.replace(/\//g, '-'), {lower: true})
+export const getRepoSlugFromName = (name: string): string => {
+  if (!name) return '';
+  return slugify(name.replace(/\//g, '-'), {lower: true});
+}
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between c0ef17f and 800424e.

⛔ Files ignored due to path filters (1)
  • frontend/pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (14)
  • frontend/app/components/modules/collection/views/collection-details.vue (4 hunks)
  • frontend/app/components/modules/collection/views/collection-list.vue (3 hunks)
  • frontend/app/components/modules/project/components/shared/header.vue (4 hunks)
  • frontend/app/components/modules/project/components/shared/header/repository-switch.vue (1 hunks)
  • frontend/app/components/modules/project/store/project.store.ts (1 hunks)
  • frontend/app/components/shared/layout/search/search-result.vue (1 hunks)
  • frontend/app/components/uikit/tag/tag.scss (1 hunks)
  • frontend/app/layouts/default.vue (1 hunks)
  • frontend/package.json (1 hunks)
  • frontend/server/api/project/[slug]/index.ts (3 hunks)
  • frontend/server/api/search.ts (2 hunks)
  • frontend/server/helpers/repository.helpers.ts (2 hunks)
  • frontend/types/project.ts (1 hunks)
  • frontend/types/search.ts (1 hunks)
🧰 Additional context used
🧬 Code Definitions (2)
frontend/app/components/modules/project/store/project.store.ts (1)
frontend/types/project.ts (1) (1)
  • ProjectRepository (1-5)
frontend/server/api/search.ts (1)
frontend/server/helpers/repository.helpers.ts (2) (2)
  • getRepoNameFromUrl (3-27)
  • getRepoSlugFromName (29-29)
🔇 Additional comments (33)
frontend/package.json (1)

32-32: Added new dependency slugify

The addition of the slugify package is appropriate for generating URL-friendly strings from repository names.

frontend/types/search.ts (1)

13-13: Added name property to SearchRepository interface

This addition properly aligns the repository data structure with the changes in the API and UI components that now handle both repository names and slugs.

frontend/app/components/uikit/tag/tag.scss (1)

36-36: Enhanced transparent tag styling with text color

The addition of text-neutral-500 to the transparent tag variant ensures consistent text coloring, which improves the visual hierarchy.

frontend/server/helpers/repository.helpers.ts (1)

1-2: Added slugify import

Correctly imported the slugify package to support the new functionality.

frontend/app/layouts/default.vue (1)

7-11: Footer layout improvement

The addition of a container for the footer improves the layout consistency with the rest of the application, while the padding adjustments provide better spacing, especially on different screen sizes.

frontend/app/components/modules/project/components/shared/header/repository-switch.vue (2)

44-45: Repository identification updates

Good change from using repository name to using the slug for routing. This is more reliable as slugs are URL-friendly and consistent identifiers.


50-50: Consistent repository selection

This maintains consistency with the routing changes by using the repository slug for selection comparison instead of the name.

frontend/app/components/modules/collection/views/collection-details.vue (4)

51-62: Improved loading mechanism with explicit button

Replacing automatic scroll-based loading with a manual "Load more" button improves user experience by giving users more control over when to load additional content.


76-76: Added button component import

Appropriate import for the newly added Load more button.


89-89: Increased page size

Increased page size from 50 to 60, which will show more projects at once before requiring users to load more.


122-124: Simple load more implementation

Clear and straightforward implementation of the load more functionality that increments the page number.

frontend/server/api/search.ts (2)

3-3: Added repository helper function imports

Properly importing the necessary helper functions for repository name and slug extraction.


62-67: Improved repository data handling

The changes implement better handling of repository data by:

  1. Extracting the repository name from URL using a dedicated helper function
  2. Generating a consistent slug from the name
  3. Storing both name and slug in the repository object

This approach ensures consistent formatting and representation of repository information across the application.

frontend/app/components/modules/project/store/project.store.ts (2)

44-44: Good simplification of the projectRepos computed property.

The change removes unnecessary mapping and directly returns the repositories array, making the code more maintainable.


47-48: Repository selection now uses slug instead of name.

This change aligns with the ProjectRepository interface that includes a slug property and makes the routing more consistent throughout the application.

frontend/server/api/project/[slug]/index.ts (4)

2-3: Good addition of necessary imports.

Adding the ProjectTinybird type and getRepoSlugFromName helper improves type safety and enables the new repository slug functionality.


24-26: Documentation updates match implementation changes.

The documentation now correctly describes the updated repository object structure that includes name, url, and slug properties.


35-35: Improved type safety with ProjectTinybird.

Using the more specific ProjectTinybird type improves type safety for the API response.


41-54: Enhanced repository structure with name and slug properties.

This transformation improves the repository data structure by explicitly computing and including both name and slug properties, which are used for display and routing respectively.

frontend/app/components/shared/layout/search/search-result.vue (1)

69-71: Simplified repository iteration and routing.

The changes remove the need for an intermediate computed property by using props.repositories directly and correctly use the repository.slug for routing, making the code more maintainable.

frontend/app/components/modules/collection/views/collection-list.vue (4)

89-100: Added explicit "Load more" button for better UX.

Replacing scroll-based pagination with an explicit button gives users more control over when to load additional content and improves clarity.


119-119: Added required button component import.

Correctly added the import for the newly used LfxButton component.


126-126: Increased page size for more efficient loading.

Increasing the page size from 10 to 50 reduces the number of network requests needed when browsing collections, which improves performance.


161-163: Added loadMore function for manual pagination.

This function properly increments the page value to fetch the next set of collections when the user clicks the "Load more" button.

frontend/app/components/modules/project/components/shared/header.vue (6)

28-31: Improved responsive title handling with truncation

The conditional class binding for the h1 element adds proper truncation when a repository is selected, which prevents layout shifts and improves the UI when repository names are long.


50-52: Enhanced repository name display with better styling

The updated styling with text color and truncation provides better visual hierarchy and prevents long repository names from breaking the layout.


53-56: Improved visual distinction for "All repositories" label

The styling change for the fallback span provides better visual distinction between the active repository and the default "All repositories" text.


139-144: Using slug instead of name for repository identification

The change from :repo="repoName" to :repo="repoSlug" properly aligns with URL-based navigation patterns, which is important for consistent routing.


150-151: Added necessary imports for state management and types

The addition of imports for storeToRefs, project types, and the ProjectStore provides better type safety and enables access to the centralized project state.

Also applies to: 166-166


174-180: Enhanced repository identification using slugs

The changes to repository handling are well-implemented:

  1. Accessing repositories from the centralized store
  2. Finding repositories by slug instead of name (better for URL-based navigation)
  3. Computing a clean display name by extracting the last segment of the full name
  4. Directly accessing the slug from route parameters

This approach provides better consistency across the application's routing.

frontend/types/project.ts (3)

1-5: Improved ProjectRepository interface with URL and slug support

The changes to the ProjectRepository interface are well-structured:

  1. Changing repo to url better describes the property's purpose
  2. Adding a slug property supports URL-friendly identifiers for repositories

This is a good improvement for URL-based navigation and API consistency.


7-16: Enhanced Project interface with comprehensive properties

The Project interface has been significantly expanded with essential properties:

  • Basic identifiers (id, name, slug)
  • Display properties (description, logo)
  • Metrics (contributorCount, organizationCount)
  • Related data (repositories)

This provides a more complete and structured representation of project data, which will benefit components that consume this data.


18-27: Well-structured ProjectTinybird interface

The ProjectTinybird interface maintains consistency with the main Project interface structure while using a simplified repositories representation (string array). This allows for lighter-weight data transfer when full repository details aren't needed.

Copy link
Copy Markdown
Collaborator

@emlimlf emlimlf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was just a minor comment, otherwise all good

Signed-off-by: Gašper Grom <gasper.grom@gmail.com>
@gaspergrom gaspergrom merged commit 3924acc into main Mar 21, 2025
3 checks passed
@gaspergrom gaspergrom deleted the improvement/layout-bugfixes branch March 21, 2025 10:58
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