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: admin activation metrics #1080
base: main
Are you sure you want to change the base?
Conversation
ephraimduncan
commented
Apr 5, 2024
•
edited
edited
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
Important Review SkippedAuto reviews are limited to the following labels: coderabbit. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent update enhances the admin stats page by introducing new components and functions for in-depth user statistics and document interaction analysis. It focuses on better data fetching, visualization through charts, and a more intuitive layout. Notably, two new chart components provide insights into monthly user growth and document activities, leveraging the Recharts library for visual representation. Additionally, backend enhancements support these frontend improvements, and a new CSS variable adds to the theme's versatility. Changes
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
🚨 @dephraiim has 5 pull requests awaiting review. Please consider reviewing them when possible. 🚨 |
apps/web/src/app/(dashboard)/admin/stats/user-with-document-cummulative.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/app/(dashboard)/admin/stats/user-with-document-cummulative.tsx
Outdated
Show resolved
Hide resolved
🚨 @ephraimduncan has 5 pull requests awaiting review. Please consider reviewing them when possible. 🚨 |
There was a problem hiding this 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
Review Status
Configuration used: CodeRabbit UI
Files selected for processing (5)
- apps/web/src/app/(dashboard)/admin/stats/page.tsx (4 hunks)
- apps/web/src/app/(dashboard)/admin/stats/user-with-document-cummulative.tsx (1 hunks)
- apps/web/src/app/(dashboard)/admin/stats/user-with-document.tsx (1 hunks)
- packages/lib/server-only/admin/get-users-stats.ts (2 hunks)
- packages/ui/styles/theme.css (2 hunks)
Additional comments not posted (8)
apps/web/src/app/(dashboard)/admin/stats/user-with-document.tsx (1)
14-20
: Consider usingmap
directly ondata
without reversing it first.Reversing the data array before mapping over it might not be necessary if the chart library or the chart itself can handle the order of data points. If the reverse order is required for visual representation, consider if this can be achieved through chart configuration options instead.
apps/web/src/app/(dashboard)/admin/stats/user-with-document-cummulative.tsx (2)
17-25
: Ensure consistent date formatting and data handling.The approach to formatting dates and handling data is consistent with the previous file. However, consider centralizing this logic if similar patterns are used across multiple components to improve maintainability and reduce code duplication.
31-31
: Clarify chart title for cumulative data.The title "Total Activity (Cummulative)" could be more descriptive to clearly indicate what the cumulative metric represents. Consider specifying whether it's cumulative over time, users, documents, etc., to provide clearer context to the administrators.
packages/lib/server-only/admin/get-users-stats.ts (2)
22-33
: Optimize database query for fetching monthly document statistics.The current implementation fetches the count of users with at least one document in the past month. Consider optimizing the query to account for scalability and performance, especially with a growing dataset. Utilizing indexed fields and possibly caching results could improve performance.
69-89
: Validate date formatting and aggregation logic.The SQL query for
getUserWithSignedDocumentMonthlyGrowth
uses complex window functions and date truncation. Verify the correctness of the date formatting and aggregation logic, especially the cumulative counts, to ensure accurate statistics are generated.packages/ui/styles/theme.css (1)
48-48
: Validate the usage of the new--gold
CSS variable.Ensure that the new
--gold
CSS variable is used consistently across the admin stats page and that it aligns with the overall design system of the application. Consider documenting its intended use cases to maintain design consistency.apps/web/src/app/(dashboard)/admin/stats/page.tsx (2)
17-45
: Ensure efficient data fetching and error handling.The parallel data fetching with
Promise.all
is efficient, but ensure that error handling is implemented for each asynchronous operation. Consider usingtry...catch
blocks or chaining.catch()
to handle potential errors gracefully and provide feedback to the administrator.
110-112
: Verify data passed to chart components.Confirm that the
MONTHLY_USERS_SIGNED
data passed to bothUserWithDocumentChart
andUserWithDocumentCummulativeChart
components is correctly formatted and contains the expected data structure for accurate chart rendering.
apps/web/src/app/(dashboard)/admin/stats/user-with-document.tsx
Outdated
Show resolved
Hide resolved
apps/web/src/app/(dashboard)/admin/stats/user-with-document.tsx
Outdated
Show resolved
Hide resolved
renamed for clarity |