Skip to content

Conversation

Innocent-Akim
Copy link
Contributor

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

Description

#3260
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

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

Summary by CodeRabbit

  • New Features

    • Dashboard grouping now persists across sessions, retaining your preferred selection.
    • Default grouping options dynamically reflect your settings.
    • Expanded grouping options now include "Application".
    • New ProductivityApplicationTable component displays productivity data based on activity reports.
    • New ActivityBar component visually represents activity percentages with tooltips.
  • Bug Fixes

    • Report loading is more reliable with improved error handling and retry logic.
  • Refactor

    • Productivity views have been updated with clearer "Activity" labels for enhanced data presentation.
    • Enhanced type safety and error handling in data fetching processes.
    • Improved structure and readability of employee productivity data handling.

Copy link
Contributor

coderabbitai bot commented Feb 25, 2025

Walkthrough

The changes update how the application manages and persists the grouping state. A new hook, useLocalStorageState, replaces React.useState to persist the groupByType value. Components such as DashboardHeader and GroupBySelect have been updated to accept and forward a new groupByType prop. Additionally, the productivity table now uses enhanced type definitions and error handling, and the report fetching hook (useReportActivity) has been improved with expanded type options, validation, and retry logic.

Changes

File(s) Change Summary
apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx Replaced React.useState with useLocalStorageState for groupByType, passed groupByType to DashboardHeader, and adjusted layout padding. Added a new case for 'application' in the switch statement.
apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx Added an optional groupByType prop to the interface and updated the Select component to use it as the default value.
apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx Updated interfaces (IActivityItem, IEmployee, added IUserImage, IUser, and IDateGroup), modified header labels, refactored grouping logic with try-catch, and passed the new projectName to the row component.
apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx Added an optional groupByType prop to DashboardHeaderProps and passed it to the GroupBySelect component.
apps/web/app/hooks/features/useReportActivity.ts Expanded the GroupByType to include 'application', enhanced response validation, added retries with exponential backoff, and improved error handling in the fetchReport function.
apps/web/app/[locale]/dashboard/app-url/components/index.tsx Introduced a new file that exports multiple components for centralized access.
apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx Introduced a new component to display productivity data, handling loading states and processing data for display.
apps/web/app/[locale]/dashboard/app-url/components/productivity-application/activity-bar.tsx Introduced a new component for displaying a progress bar with tooltip functionality.

Possibly related PRs

  • [Feat]: Activity Report Implementation #3607: The changes in the main PR are related to the addition of the groupByType prop in the DashboardHeader component, which is also modified in the retrieved PR to accept the same prop, indicating a direct connection in their implementations.
  • [Feat]: Improve timesheet and Activity reporting #3590: The changes in the main PR are related to the addition of the groupByType prop in the DashboardHeader component, which connects to the updates made in the GroupBySelect component in the retrieved PR that also involves the groupByType prop.
  • Feat(productivity): improve report functionality and performance #3618: The changes in the main PR are related to those in the retrieved PR as both involve modifications to the groupByType prop and its usage in the DashboardHeader and GroupBySelect components, which are interconnected in the application's state management.

Suggested labels

UI/UX

Suggested reviewers

  • evereq
  • Cedric921

Poem

I'm a little rabbit with code so fine,
Hopping through changes, line by line.
Persistent state now hops and stays,
While fetch retries in clever ways.
In our garden of code, changes bloom bright—
A joyful twitch of my delight! 🐰

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx

Oops! Something went wrong! :(

ESLint: 8.46.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/web/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx

Oops! Something went wrong! :(

ESLint: 8.46.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/web/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

apps/web/app/[locale]/dashboard/app-url/components/index.tsx

Oops! Something went wrong! :(

ESLint: 8.46.0

ESLint couldn't find the config "next/core-web-vitals" to extend from. Please check that the name of the config is correct.

The config "next/core-web-vitals" was referenced from the config file in "/apps/web/.eslintrc.json".

If you still have problems, please stop by https://eslint.org/chat/help to chat with the team.

  • 5 others

Tip

CodeRabbit's docstrings feature is now available as part of our Pro Plan! Simply use the command @coderabbitai generate docstrings to have CodeRabbit automatically generate docstrings for your pull request. We would love to hear your feedback on Discord.


📜 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 aa33a54 and 80d86bb.

📒 Files selected for processing (8)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (4 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/index.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/activity-bar.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx (3 hunks)
  • apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx (3 hunks)
  • apps/web/app/hooks/features/useReportActivity.ts (6 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • apps/web/app/[locale]/dashboard/app-url/components/index.tsx
  • apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/activity-bar.tsx
  • apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: deploy
🔇 Additional comments (14)
apps/web/app/hooks/features/useReportActivity.ts (5)

70-70: Type extension enhances app URL activity grouping.

The addition of 'application' to the GroupByType type aligns with the PR objective for implementing app URL activity grouping.


148-178: Improved error handling and type safety.

The enhanced validation and error handling in the fetchReport function is a solid improvement:

  • Added type validation for the response object
  • Added warning logs for non-array data
  • Better error reporting

These improvements make the code more robust and maintainable.


190-191: Re-throwing errors enables retry logic.

Re-throwing the error after setting data to an empty array is an excellent addition that allows the retry logic to handle the failure.


295-320: Implement exponential backoff with retries.

The retry logic with exponential backoff is well-implemented. However, the spelling checker flags "backoff" (line 314). This could cause a pipeline failure as noted in a previous review.

To fix this issue, you should either:

  1. Change the comment spelling to "back-off"
  2. Add "backoff" to your cspell dictionary
#!/bin/bash
# Check if the word "backoff" is already in any cspell configuration
grep -r '"backoff"' --include="*.json" .

268-268: Appropriate handling of 'application' group type.

The function correctly maps the 'application' groupByType to 'date' when fetching activity data, maintaining compatibility with the backend API while extending UI functionality.

apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (5)

21-22: Enhanced imports for improved component organization.

Good organization of imports, especially consolidating the productivity component imports using the index barrel file.


38-38: State persistence using local storage.

Replacing React.useState with useLocalStorageState is an excellent improvement that persists the groupByType value across page reloads, enhancing the user experience.


117-117: Proper prop passing for consistent state management.

Passing the groupByType prop to DashboardHeader ensures consistent state management and enables proper functionality in the header component.


121-121: Layout improvement with added padding.

The addition of left padding (pl-8) improves the visual layout of the component.


146-149: Support for application-based activity grouping.

The addition of the 'application' case enables proper rendering of the ProductivityApplicationTable component, completing the implementation of the app URL activity grouping feature.

apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx (4)

13-13: Terminology update for consistency.

Changing "Application" to "Activity" in the table header improves clarity and maintains consistency with the rest of the UI.


46-91: Enhanced type definitions improve code robustness.

The addition of detailed interfaces (IUserImage, IUser, IEmployee, IActivityItem, IDateGroup) greatly improves type safety and code documentation. This makes the component more maintainable and reduces potential runtime errors.


276-328: Improved error handling with proper validation.

The enhanced error handling with try-catch blocks and data validation checks is an excellent improvement. The code now properly handles:

  • Non-array data
  • Missing or invalid employee data
  • Missing or invalid date groups
  • Missing activities

This makes the component much more robust against unexpected data formats.


190-206: Enhanced project name rendering.

The updated ActivityRow component now displays the projectName property with proper fallback to 'No project', improving the user experience by providing more contextual information.

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
  • @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.

@Innocent-Akim Innocent-Akim self-assigned this Feb 25, 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: 1

🧹 Nitpick comments (8)
apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx (1)

24-24: Commented-out application option.

The "application" option is no longer available to users, but it's still here as a comment. Confirm whether it's planned for future usage or consider removing it to keep the codebase clean.

apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (1)

122-122: Added left padding (pl-8).

Visually aligns the content in the card’s header area. Verify that this spacing meets design specifications for smaller screens if responsiveness is a concern.

apps/web/app/hooks/features/useReportActivity.ts (1)

178-178: Helpful console warning.

Alerting non-array data is crucial for debugging. Consider turning it into an error if this case should never happen in production.

apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx (5)

16-18: Consider displaying seconds in the duration.
Currently, the formatDuration function omits leftover seconds. If you want to showcase a finer time granularity, you could add another segment for seconds.


29-35: Using a fixed locale might limit i18n support.
Depending on requirements, you may consider using the user’s preferred locale to format dates rather than hardcoding 'en-US'.


39-42: Specify the radix in parseInt for clarity.
To avoid unexpected behavior in some environments, it’s best practice to explicitly use base 10:

- const duration = parseInt(activity.duration || '0');
+ const duration = parseInt(activity.duration || '0', 10);

70-81: Consider storing numeric durations directly.
Defining duration as a string requires parsing in multiple places. Switching to a numeric field could simplify logic and help avoid conversion errors.


258-330: Enhance type safety and error handling for data grouping.

  • Casting employeeData and project/activity to unknown | any reduces type safety. Consider stricter type checks or type guards to avoid potential runtime errors.
  • You could unify console logs (warn/error) and decide whether to notify the user differently if grouping fails.
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between b3c6787 and a65007f.

📒 Files selected for processing (5)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (3 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx (2 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx (3 hunks)
  • apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx (3 hunks)
  • apps/web/app/hooks/features/useReportActivity.ts (5 hunks)
🧰 Additional context used
🪛 GitHub Check: Cspell
apps/web/app/hooks/features/useReportActivity.ts

[warning] 318-318:
Unknown word (backoff)

🪛 GitHub Actions: Check Spelling and Typos with cspell
apps/web/app/hooks/features/useReportActivity.ts

[warning] 318-318: Unknown word (backoff)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: deploy
🔇 Additional comments (35)
apps/web/app/[locale]/dashboard/team-dashboard/[teamId]/components/dashboard-header.tsx (2)

18-20: Nicely introduced optional groupByType prop.

Declaring groupByType as optional is fine, but ensure you handle the undefined case gracefully if no value is passed.


30-43: Good integration with GroupBySelect.

Passing groupByType to GroupBySelect ensures a consistent grouping state. This approach allows for a clear separation of concerns and is easy to maintain.

apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx (3)

8-8: Optional groupByType prop looks good.

Keeping this prop optional enables broader flexibility if a default grouping is needed in certain contexts.


11-11: Updated function signature aligns well with the new interface.

Invoking groupByType within the component is straightforward and should enhance clarity when reading the code.


13-13: Dynamic default selection.

Replacing the hardcoded "date" with groupByType improves consistency across the app, particularly when state is persisted or changed elsewhere.

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

23-23: New import for useLocalStorageState.

Great choice for persistent state management, ensuring groupByType is retained across sessions.


39-39: Replaced local state with localStorage-based state.

This enhances user experience by persisting the group setting. The code is straightforward and readable.

apps/web/app/hooks/features/useReportActivity.ts (6)

70-70: Extended GroupByType with 'application'.

This addition is consistent with the rest of the code. Ensure your UI and usage logic handle this new option to avoid unimplemented paths.


148-148: Improved documentation.

Providing clear comments about error handling and type safety makes the function’s purpose easier to understand.


160-160: Setting data to an empty array when user or props are missing.

Safeguarding against null references or incomplete data is good practice. This fallback helps avoid runtime errors.


168-172: Response validation step is beneficial.

By explicitly confirming response is an object, you reduce the chance of hard-to-diagnose errors downstream. This proactive check is commendable.


190-191: Re-throwing errors enables retry logic.

This design pattern ensures upper layers can handle retries or alternative flows. Good for overall resilience.


296-299: Retry logic variables successfully introduced.

Defining maxRetries and retryCount is a clear approach for controlling the number of fetch attempts.

apps/web/app/[locale]/dashboard/app-url/components/productivity-employee/ProductivityEmployeeTable.tsx (22)

12-12: Looks good!
No concerns with the updated table header text.


22-26: All good here!
This logic for generating initials is concise and handles empty split segments gracefully.


45-50: No issues found.
This interface is straightforward and sufficiently descriptive.


52-59: Well-defined user interface!
It covers the typical user fields without any evident omissions.


63-68: All good.
The additional fields (isActive, isTrackingEnabled) look appropriate for tracking employee status.


82-90: Interface looks comprehensive.
Enumeration of IDateGroup fields is straightforward and clear.


92-94: Props interface is fine.
Having data? and isLoading? with proper typing is clear and flexible.


97-133: Skeleton loading component is well-structured.
This block is well-suited to show repetitive placeholders.


136-141: Employee avatar implementation looks good.
Using getInitials for fallback is a nice touch.


146-147: No issues.
A simple placeholder for a project logo.


151-171: ActivityBar is clear and user-friendly.
The tooltip highlights usage percentages effectively.


175-184: Interface for ActivityRowProps is properly typed.
No potential pitfalls detected.


187-234: ActivityRow component logic is consistent.
Props are well-integrated with the existing formatting utilities.


239-251: MemoizedActivityRow usage is appropriate.
Memoization helps optimize rendering for repeated activity entries.


253-253: Matches the typed props.
Returning ActivityRow inline is concise and maintainable.


335-336: Empty state logic is straightforward.
Displays a friendly placeholder when there’s no data.


348-348: Table header rendering is clear.
No issues with mapping the constant headers.


355-357: Date sorting for descending order is correct.
Straightforward approach using new Date(b).getTime() - new Date(a).getTime().


365-367: Displays the employee’s full name effectively.
One-liner is easy to manage.


369-374: Total time calculation is integrated neatly.
Good use of formatDuration to show overall time.


380-380: Iteration over dates is well-structured.
Makes for a clean, nested rendering approach.


387-387: Simple boolean check for isFirstOfDay.
No issues found.

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

🧹 Nitpick comments (1)
apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx (1)

61-81: Effective data transformation logic.

The data grouping logic effectively transforms the raw activity data into a structure organized by applications. However, there's a type issue with the employee property:

The employee: any type in the record could be replaced with a more specific type to improve type safety. Consider defining an interface for the employee structure or using the appropriate existing type.

- employee: any
+ employee: IEmployeeWithUser // or the appropriate interface
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6abebbf and aa33a54.

📒 Files selected for processing (6)
  • apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (4 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/index.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx (1 hunks)
  • apps/web/app/[locale]/dashboard/app-url/components/productivity-application/activity-bar.tsx (1 hunks)
  • apps/web/app/hooks/features/useReportActivity.ts (6 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/app/[locale]/dashboard/app-url/components/index.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/web/app/[locale]/dashboard/app-url/components/GroupBySelect.tsx
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: deploy
🔇 Additional comments (14)
apps/web/app/[locale]/dashboard/app-url/components/productivity-application/activity-bar.tsx (1)

1-35: Well-structured visual component for displaying activity percentages.

The ActivityBar component is well implemented with good separation of concerns. It correctly parses and rounds the percentage value, and includes helpful tooltips to provide additional context on hover.

Some noteworthy aspects:

  • Good use of TypeScript interface for prop typing
  • Appropriate rounding of percentage values
  • Proper component naming with displayName for debugging
apps/web/app/hooks/features/useReportActivity.ts (4)

70-70: Enhanced grouping options with the new 'application' type.

The GroupByType has been properly extended to include 'application' as a new value, which enables the application grouping functionality.


148-195: Improved error handling and response validation.

The fetchReport function has been enhanced with proper response validation and error handling. The code now checks if the response is a valid object and logs warnings when the data is not an array.

I also notice the error is re-thrown after setting empty data, which enables the new retry logic to work properly.


268-268: Proper handling for the new 'application' group type.

The function correctly maps 'application' grouping to 'date' when making the API call, ensuring compatibility with the backend while enabling new frontend functionality.


295-320: Improved data fetching with retry logic and exponential backoff.

The implementation of retry logic with exponential backoff is well-executed. This makes the application more resilient to temporary network issues.

Note: The term "backoff" has been flagged in previous reviews. While the implementation is correct, you might want to consider fixing the spelling to avoid CI issues.

#!/bin/bash
# Check if "backoff" is in the cspell dictionary to avoid CI failures
grep -r "backoff" .cspell.json || echo "Consider adding 'backoff' to the cspell dictionary"
apps/web/app/[locale]/dashboard/app-url/[teamId]/page.tsx (5)

21-22: Good organization of imports with the new components.

The imports have been properly organized, adding the new useLocalStorageState hook and grouping the productivity table components.


38-38: Improved state persistence with local storage.

Replacing React.useState with useLocalStorageState is a good enhancement that will persist the user's grouping preference across sessions. The key 'group-by-type' is descriptive and the default value 'date' is sensible.


117-117: Properly forwarding group state to child components.

The groupByType state is now correctly passed to the DashboardHeader component, allowing it to reflect the current grouping state.


121-121: Minor UI enhancement with padding.

Added left padding improves the layout spacing in the header section.


148-149: Support for the new application grouping view.

The switch statement has been properly extended to handle the 'application' case, rendering the new ProductivityApplicationTable component when this grouping is selected.

apps/web/app/[locale]/dashboard/app-url/components/productivity-application/ProductivityApplicationTable.tsx (4)

1-16: Well-organized imports and component setup.

The imports are properly organized and include all necessary UI components and type definitions.


17-59: Good handling of loading and empty states.

The component correctly handles loading states with a skeleton UI and displays helpful messages when no data is available. The translations are properly integrated for internationalization support.


82-159: Well-structured table rendering with clear organization.

The table implementation is well-structured, with clear separation between application headers and their related activities. The visual representation with avatars and progress bars provides a good user experience.


161-166: Useful helper function for duration formatting.

The formatDuration function is well implemented, handling both string and number inputs and properly formatting the output as hours and minutes.

@evereq
Copy link
Member

evereq commented Feb 26, 2025

@Innocent-Akim can you fix merge conflicts?

- Add application grouping type to activity reports
- Improve data structure with proper TypeScript interfaces
- Enhance error handling and data validation in ProductivityEmployeeTable
- Add local storage persistence for group-by selection
- Update UI components for better code organization and readability
- Fix date formatting and duration calculations
- Improve dark mode compatibility
- Add proper type definitions for employee and activity data
- Format code according to project style guidelines
- Add automatic data fetching on component mount
- Enhance data validation in ProductivityEmployeeTable
- Improve error handling and logging
- Add fallbacks for missing data fields
- Optimize useEffect dependencies in useReportActivity hook
- Add explicit unknown | any type annotations for dateGroup and project parameters
- Enhance type safety in array mapping and filtering operations
- Add type guards for project and activity objects
- Maintain data processing functionality while improving type checking
- Implement application-based grouping in productivity table
- Add proper project name display with fallback options
- Fix TypeScript type issues in activity data handling
- Clean up unused imports and improve code organization
@Innocent-Akim Innocent-Akim force-pushed the feat/apps-url-activity-grouping branch from aa33a54 to 80d86bb Compare February 26, 2025 09:08
@Innocent-Akim Innocent-Akim requested review from evereq and removed request for evereq February 26, 2025 09:12
@evereq evereq merged commit 5d32521 into develop Feb 26, 2025
12 checks passed
@evereq evereq deleted the feat/apps-url-activity-grouping branch February 26, 2025 16:46
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.

[Feature] Apps & URLs Dashboard | Filter the Apps & URLs Dashboard
2 participants