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 Document Count Display Issue and Loading Progress Bar Size in Pagination #212

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

devleejb
Copy link
Member

@devleejb devleejb commented Jun 25, 2024

What this PR does / why we need it:
This PR addresses several issues mentioned in issue 211 regarding the document count display and loading progress bar in pagination:

  • Fixing the issue where the document count only displays the count of the first page and does not increase when additional pages are loaded.
  • Resolving the problem where additional documents are not shown even when additional pages are loaded.
  • Adjusting the size of the loading progress bar, which is currently too large.
  • Fixing the display issue with the scrollbar, ensuring it appears only on either the document or the entire screen.

Which issue(s) this PR fixes:

Fixes #211

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

Additional documentation:


Checklist:

  • Added relevant tests or not required
  • Didn't break anything

Summary by CodeRabbit

  • New Features

    • Display the total number of documents available in the workspace.
  • Style

    • Adjusted padding for improved layout in the Workspace Layout component.
    • Updated maximum height of stack element for better visual alignment.
    • Centered loader component and adjusted circular progress size for better user experience.

@devleejb devleejb linked an issue Jun 25, 2024 that may be closed by this pull request
Copy link
Contributor

coderabbitai bot commented Jun 25, 2024

Walkthrough

The changes enhance the functionality and presentation of the workspace documents list, both in the backend and frontend. A new totalLength property was added to detail the total count of documents. Frontend styling adjustments improve the layout, and document count display is corrected for paginated views.

Changes

Files Change Summary
backend/src/workspace-documents/types/find-workspace-documents-response.type.ts Added totalLength property to FindWorkspaceDocumentsResponse to represent the total count of documents.
backend/src/workspace-documents/workspace-documents.service.ts Incorporated totalLength variable and modified getDocuments method to return this property along with existing data.
frontend/src/components/layouts/WorkspaceLayout.tsx Adjusted Main component padding properties for improved layout styling.
frontend/src/hooks/api/types/workspaceDocument.d.ts Added totalLength property to GetWorkspaceDocumentListResponse class.
frontend/src/pages/workspace/Index.tsx Fixed document count display and adjusted UI elements for better layout and functionality of document pagination.

Sequence Diagram(s)

sequenceDiagram
    participant Frontend
    participant Backend
    participant Database

    Frontend->>Backend: Request documents (with pagination)
    Backend->>Database: Fetch documents and count total documents
    Database-->>Backend: Return documents list and total documents count
    Backend-->>Frontend: Return documents and total count
    Frontend-->>Frontend: Update UI to show all documents and correct total count
Loading

Assessment against linked issues

Objective Addressed Explanation
Correct total document count display and update with pagination (#211)
Correct size of the loading progress indicator (#211)
Ensure only one scrollbar appears (either document or screen) (#211)

Poem

In the code where logic dwells,
A new property tells,
Count of documents in line,
UI now so fine.
Backend speaks with the base,
Frontend shows the ace,
Pagination wins the race!


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>.
    • 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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @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 as 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.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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

@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

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 3d58f83 and 620cc9a.

Files selected for processing (5)
  • backend/src/workspace-documents/types/find-workspace-documents-response.type.ts (1 hunks)
  • backend/src/workspace-documents/workspace-documents.service.ts (2 hunks)
  • frontend/src/components/layouts/WorkspaceLayout.tsx (1 hunks)
  • frontend/src/hooks/api/types/workspaceDocument.d.ts (1 hunks)
  • frontend/src/pages/workspace/Index.tsx (3 hunks)
Additional comments not posted (8)
frontend/src/hooks/api/types/workspaceDocument.d.ts (1)

5-5: Addition of totalLength property is approved.

This change aligns with the PR objectives to correctly display the total document count as pages are loaded.

backend/src/workspace-documents/types/find-workspace-documents-response.type.ts (1)

14-15: Addition of totalLength property is approved.

Adding the totalLength property to the response type is crucial for front-end functionalities that rely on total document counts, which is a key fix in this PR.

frontend/src/components/layouts/WorkspaceLayout.tsx (1)

15-17: Styling adjustments are approved.

Changing from uniform padding to individual side padding allows for more flexible UI design and is consistent with the PR's aim to adjust UI elements like the progress bar size.

frontend/src/pages/workspace/Index.tsx (3)

50-50: Correct update of document count display.

This change ensures that the total document count reflects all loaded pages, addressing a specific issue reported in the linked issue.


63-63: Adjustment to the stack element's maximum height is approved.

Reducing the maximum height supports better UI layout and interaction, especially with the modified progress bar size.


72-73: Size adjustment of the loading progress bar is approved.

Reducing the size of the progress bar as per PR objectives helps in maintaining a more proportionate UI design.

backend/src/workspace-documents/workspace-documents.service.ts (2)

64-69: Correct implementation of document count logic.

The addition of counting documents based on workspaceId is crucial for accurate pagination and display, aligning perfectly with the PR objectives.


99-99: Proper inclusion of totalLength in response.

Returning totalLength in the service response is essential for the frontend to display accurate document counts, fulfilling a key PR objective.

@devleejb devleejb merged commit 89dc5d5 into main Jun 25, 2024
3 checks passed
@devleejb devleejb deleted the 211-ui-issues-with-pagination-on-codepair-page branch June 25, 2024 15:39
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.

UI issues with pagination on CodePair page
1 participant