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

[Feat]: Implement productivity table for app usage statistics #3606

Merged
merged 4 commits into from
Feb 11, 2025

Conversation

Innocent-Akim
Copy link
Contributor

@Innocent-Akim Innocent-Akim commented Feb 11, 2025

  • Add ProductivityTable component with member, project, and app usage data
  • Integrate table with shadcn UI components and custom styling
  • Add loading states with skeleton UI
  • Update layout with Card container and proper spacing
  • Make table responsive with proper dark mode support

#3263
#3264
#3262

Description

Please include a summary of the changes and the related issues.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation update

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented on my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings

Previous screenshots

Please add here videos or images of the previous status

Current screenshots

Screenshot 2025-02-11 at 9 40 33 PM

Please add here videos or images of the current (new) status

Summary by CodeRabbit

  • New Features

    • Introduced the ProductivityTable component to display productivity data in a structured table format.
    • Added a ProductivityChart with day labels for enhanced clarity of productivity metrics.
  • Refactor

    • Improved layout consistency and typography, updating header text to a bolder style for stronger visual emphasis.

- Add ProductivityTable component with member, project, and app usage data
- Integrate table with shadcn UI components and custom styling
- Add loading states with skeleton UI
- Update layout with Card container and proper spacing
- Make table responsive with proper dark mode support
Copy link
Contributor

coderabbitai bot commented Feb 11, 2025

Warning

Rate limit exceeded

@Innocent-Akim has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 6 minutes and 21 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between c9a4369 and 51f9912.

📒 Files selected for processing (1)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (1 hunks)

Walkthrough

This pull request introduces new productivity components and updates existing ones on the dashboard. The changes add a new ProductivityTable component to display productivity data, enhance the ProductivityChart component with a day-extraction function for labeling, and update the header style in ProductivityHeader. Minor formatting adjustments and ESLint directive additions are applied for consistent code styling, while core data logic remains unchanged.

Changes

File(s) Change Summary
apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx Integrated new ProductivityTable component within AppUrls function and updated formatting and indentation.
apps/web/app/[locale]/dashboard/app-url/components/ProductivityChart.tsx
apps/web/app/[locale]/dashboard/app-url/components/ProductivityHeader.tsx
In ProductivityChart, added getDateNumber to extract day labels and reorganized JSX; in ProductivityHeader, changed header class from font-semibold to font-bold.
apps/web/app/[locale]/dashboard/app-url/components/ProductivityTable.tsx New component that renders a productivity table with conditional skeleton loaders and dynamic data mapping.
apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx Added an ESLint directive to disable warnings for unused variables; no functional changes.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant AppUrls as AppUrls Page
    participant Layout as MainLayout
    participant ProdTable as ProductivityTable
    User->>AppUrls: Navigate to page
    AppUrls->>Layout: Render layout container
    Layout->>ProdTable: Render ProductivityTable component
Loading
sequenceDiagram
    participant Chart as ProductivityChart
    participant Data as Data Array
    participant Util as getDateNumber Function
    Chart->>Data: Iterate over productivity data
    Data->>Util: Extract day from date string
    Util-->>Chart: Return day number
    Chart->>Chart: Render bars and corresponding day labels
Loading

Possibly related PRs

Suggested labels

feature, WEB, UI/UX, Ever Teams, Improvement

Suggested reviewers

  • evereq

Poem

I'm a rabbit with a code-filled beat,
Hopping through changes, light and neat.
New tables and charts in a digital glen,
Formatting refined, again and again.
I nibble through bugs with a joyful treat,
Celebrating code with a bunny beat!
🐰✨


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 generate docstrings to generate docstrings for this PR. (Beta)
  • @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
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: 7

🧹 Nitpick comments (2)
apps/web/app/[locale]/dashboard/app-url/components/ProductivityChart.tsx (2)

15-17: Add date validation and consider using date-fns.

The getDateNumber function should handle invalid dates and could benefit from using a date utility library like date-fns for more robust date handling.

-const getDateNumber = (dateString: string) => {
-    return new Date(dateString).getDate();
-};
+import { getDate, isValid, parseISO } from 'date-fns';
+
+const getDateNumber = (dateString: string) => {
+    const date = parseISO(dateString);
+    if (!isValid(date)) {
+        return '-';
+    }
+    return getDate(date);
+};

20-54: Consider memoizing the date labels.

The layout structure looks good, but the date labels could be memoized to avoid unnecessary recalculations on re-renders.

+const dateLabels = useMemo(
+    () => data.map((day) => ({
+        key: `label-${day.date}`,
+        label: getDateNumber(day.date)
+    })),
+    [data]
+);

return (
    <div className="flex flex-col gap-2">
        {/* ... bars ... */}
        <div className="flex gap-[2px] w-full justify-between px-1">
-            {data.map((day) => (
+            {dateLabels.map(({ key, label }) => (
                <div
-                    key={`label-${day.date}`}
+                    key={key}
                    className="flex-1 text-xs text-center text-gray-500"
                >
-                    {getDateNumber(day.date)}
+                    {label}
                </div>
            ))}
        </div>
    </div>
);
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 368e3d9 and bd0b8c8.

📒 Files selected for processing (5)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityChart.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityHeader.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityTable.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityHeader.tsx
  • apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: deploy

@Innocent-Akim Innocent-Akim self-assigned this Feb 11, 2025
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: 2

♻️ Duplicate comments (2)
apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (2)

78-78: ⚠️ Potential issue

Remove console.log statement.

Remove debugging console.log statement from production code.

-console.log('=====>', groupBy);

129-131: ⚠️ Potential issue

Add error handling to ProductivityTable.

The ProductivityTable component is rendered without error handling. Consider adding error handling and loading state.

<Container fullWidth={fullWidth} className={cn('flex flex-col gap-8 !px-4 py-6 w-full')}>
-  <ProductivityTable />
+  <ProductivityTable
+    isLoading={isLoading}
+    error={error}
+    data={monthData}
+  />
</Container>
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between bd0b8c8 and c9a4369.

📒 Files selected for processing (2)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityTable.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/[locale]/dashboard/app-url/components/ProductivityTable.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: deploy
🔇 Additional comments (1)
apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (1)

19-19: LGTM! Clean imports and type definitions.

The imports are well-organized, and the ProductivityData interface is properly defined with all required fields.

Also applies to: 21-26

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants