-
Notifications
You must be signed in to change notification settings - Fork 73
Feat etp 39/implement export functionality on time and activity page #3954
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 etp 39/implement export functionality on time and activity page #3954
Conversation
- Added export options for CSV, XLSX, and PDF formats in the TimeActivityExportMenu component. - Introduced ExportProgressModal to track and display export progress. - Created utility functions for generating export filenames and handling file extensions. - Developed hooks for managing export progress and data transformation for export. - Implemented PDF generation for time and activity reports, including member-specific and general reports. - Enhanced filtering logic to support export functionality based on user permissions and selected filters. - Optimized performance settings for handling large datasets during export operations.
- Renamed the 'All Times' range to 'Last Year' for better accuracy. - Added a new 'All Times' range that covers a wider span from five years ago to today. - Updated the TimeActivityExportMenu to use effective start and end dates, defaulting to the current month if not provided. - Improved date formatting and calculations for export options, including total hours, earnings, and average activity metrics in the export summary.
… handling - Introduced a new predefined date range option labeled 'This Year' in the TimeActivity date range picker. - Updated the loading state management in the useTimeActivityStats hook to reflect the current loading status dynamically.
…e CSV and XLSX - Removed console log statements in the TimeActivityPDF and useTimesheet hooks for cleaner code and improved performance.
""" WalkthroughThis pull request introduces a comprehensive export system for time and activity data. It adds new React components for export menus, PDF generation, and export progress modals, along with custom hooks for export logic and progress tracking. Supporting utility modules and configuration files are included for handling export formats, batching, and performance monitoring. The date range picker and header components are updated to integrate the new export features. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant TimeActivityHeader
participant TimeActivityExportMenu
participant useTimeActivityExport
participant ExportProgressModal
User->>TimeActivityHeader: Clicks "Export"
TimeActivityHeader->>TimeActivityExportMenu: Renders export menu
User->>TimeActivityExportMenu: Selects export format (PDF/CSV/XLSX)
TimeActivityExportMenu->>useTimeActivityExport: Requests exportable data & summary
useTimeActivityExport-->>TimeActivityExportMenu: Returns transformed data, summary, canExport
TimeActivityExportMenu->>ExportProgressModal: Shows progress modal (if applicable)
ExportProgressModal-->>User: Displays progress, error, or success
Estimated code review effort🎯 4 (Complex) | ⏱️ ~90 minutes Possibly related PRs
Suggested reviewers
Poem
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
yarn install v1.22.22 Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. 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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Please review these files and clean up the unused code. |
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.
Greptile Summary
This PR implements a comprehensive export functionality for the Time and Activity page, focusing on PDF exports with groundwork laid for CSV and XLSX formats. The changes involve creating a new export system with proper permission handling, filter integration, and user feedback mechanisms. Key architectural additions include:
- A new export utilities module for handling file operations and naming
- A custom hook (
useExportProgress
) for tracking export status - A progress modal component for user feedback
- PDF generation components with member-wise grouping capabilities
- An export configuration system supporting different dataset sizes
- Enhanced date range filtering with improved temporal options
Confidence score: 3/5
- This PR has multiple areas that need attention before merging, particularly around type safety and data processing.
- Score reflects concerns about hardcoded mock data (e.g., random activity levels), incomplete CSV/XLSX implementations, and potential memory issues with large datasets.
- Files needing attention:
use-time-activity-export.ts
: Mock activity data needs replacement with real calculationstime-activity-by-member-pdf.tsx
: Type safety improvements neededtime-activity-export-menu.tsx
: Uncomment and implement CSV/XLSX exports
13 files reviewed, 13 comments
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
Outdated
Show resolved
Hide resolved
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: 13
🔭 Outside diff range comments (1)
apps/web/core/lib/config/export-config.ts (1)
1-259
: Remove or deprecate unused exports in export-config.tsThe following exports are never imported or referenced outside
export-config.ts
and should be removed, deprecated, or justified:• ExportConfig
• DEFAULT_EXPORT_CONFIG
• EXPORT_CONFIGS
• estimateMemoryUsage
• getMemoryUsage
• processBatchesKeeping only the exports actually used by
use-time-activity-export.ts
(getOptimalExportConfig, validateExportFeasibility, ExportPerformanceMonitor) will reduce bundle size and maintenance overhead.
🧹 Nitpick comments (5)
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (1)
151-151
: Consider using a more unique identifier for members.Using member names as IDs could cause data grouping issues if multiple members share the same name.
If the data structure allows, consider generating a composite key:
-const memberId = memberName; // Use name as ID since we don't have employee ID in transformed data +// Generate a more unique identifier if possible +const memberId = `${memberName}_${item.date || ''}`.toLowerCase().replace(/\s+/g, '_');Alternatively, consider enhancing the data transformation process to include unique member IDs.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
135-136
: Simplify boolean expression.The ternary operator is unnecessary for boolean conversion.
-isTransformed: data?.[0]?.member ? true : false +isTransformed: !!data?.[0]?.memberapps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (1)
70-76
: Consider using the app's locale for date formatting instead of hardcoding 'en-US'.The date formatting is hardcoded to 'en-US' which might not align with the user's locale preferences. Since you're already using
next-intl
, consider leveraging it for date formatting.- const formatDate = useCallback((date: Date): string => { - return date.toLocaleDateString('en-US', { - day: '2-digit', - month: 'long', - year: 'numeric' - }); - }, []); + const locale = useLocale(); + const formatDate = useCallback((date: Date): string => { + return date.toLocaleDateString(locale, { + day: '2-digit', + month: 'long', + year: 'numeric' + }); + }, [locale]);Don't forget to import
useLocale
fromnext-intl
.apps/web/core/hooks/activities/use-time-activity-export.ts (1)
232-245
: Optimize the exportSummary calculation to avoid unnecessary data transformations.The
transformDataForExport
function is called every timeexportSummary
is recalculated, which could be expensive for large datasets.Consider caching the transformation or only calculating the summary statistics without full transformation:
const exportSummary = useMemo(() => { - const data = transformDataForExport(exportableData); + // Calculate summary without full transformation + let recordCount = 0; + exportableData.forEach(dayData => { + if (dayData.employees) { + dayData.employees.forEach(emp => { + emp.projects?.forEach(proj => { + recordCount += proj.tasks?.length || 1; + }); + }); + } else if (dayData.logs) { + dayData.logs.forEach(log => { + log.employeeLogs?.forEach(empLog => { + recordCount += empLog.tasks?.length || 1; + }); + }); + } + }); + return { - totalRecords: data.length, + totalRecords: recordCount, dateRange: startDate && endDate ? { startDate, endDate } : null, - hasData: data.length > 0 + hasData: recordCount > 0 }; }, [exportableData, transformDataForExport, startDate, endDate]);apps/web/core/lib/config/export-config.ts (1)
220-229
: Add a comment about browser compatibility for memory monitoring.The
performance.memory
API is non-standard and only available in Chrome-based browsers. Consider adding a comment about this limitation./** * Memory usage monitoring + * Note: performance.memory is a non-standard API only available in Chrome-based browsers */ export function getMemoryUsage(): { used: number; total: number } | null {
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/index.ts
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/page-component.tsx
(3 hunks)apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
(3 hunks)apps/web/core/hooks/activities/use-export-progress.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-export.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-stats.ts
(1 hunks)apps/web/core/lib/config/export-config.ts
(1 hunks)apps/web/core/lib/utils/export-utils.ts
(1 hunks)
🧠 Learnings (11)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
Learnt from: CREDO23
PR: ever-co/ever-teams#3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
apps/web/core/hooks/activities/use-time-activity-stats.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/index.ts (1)
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (6)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (3)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (11)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/hooks/activities/use-time-activity-export.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
Learnt from: CREDO23
PR: ever-co/ever-teams#3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
apps/web/core/hooks/activities/use-time-activity-stats.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/index.ts (1)
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (6)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (3)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (11)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/hooks/activities/use-time-activity-export.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: deploy
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (17)
apps/web/core/hooks/activities/use-time-activity-stats.ts (2)
98-98
: LGTM! Loading state propagation improved.The change from hardcoded boolean values to using the
loading
parameter directly ensures consistent loading state propagation to dependent components. This is especially important for the new export functionality where accurate loading states are crucial for UI feedback.Also applies to: 106-106
1-1
: No unused imports or exports in use-time-activity-stats.tsA review of the file shows that every import and export is actively used:
•
useMemo
– used for memoizing computed values
•secondsToTime
– used in the total hours calculation
•ITimesheetCountsStatistics
&ITimeLogGroupedDailyReport
– used in the hook’s props interface
•useAuthenticateUser
– used to obtain the current user
•export interface TimeActivityStats
&export function useTimeActivityStats
– both consumed by downstream codeYou can safely ignore the Knip pipeline warning here. No dead code removal is necessary.
Likely an incorrect or invalid review comment.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
252-281
: Excellent improvements to date range presets.The updates provide much better semantic clarity:
- "This Year" for current calendar year is intuitive
- "Last Year" is more accurate than the previous misleading "All Times" label
- New "All Times" with 5-year scope provides meaningful historical coverage
The implementation correctly uses date-fns functions and the comment explains the rationale well.
apps/web/core/components/pages/time-and-activity/export/index.ts (2)
1-11
: Well-structured barrel file following best practices.The export pattern is clean and follows TypeScript conventions by exporting both components and their corresponding prop types. This centralization makes imports more maintainable across the codebase.
1-1
: No unused exports inexport/index.ts
Verified that all exports—TimeActivityPDF
,TimeActivityByMemberPDF
,TimeActivityExportMenu
, andExportProgressModal
—are imported and used elsewhere in the codebase.•
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
importsTimeActivityExportMenu
•apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
importsTimeActivityPDF
,TimeActivityByMemberPDF
, andExportProgressModal
No changes required.
apps/web/core/components/pages/time-and-activity/page-component.tsx (4)
56-66
: Good expansion of hook destructuring.Adding
currentFilters
to the destructured properties provides necessary context for the export functionality while maintaining clean code structure.
68-68
: Appropriate local state addition.The
dateRange
state enables proper tracking of start/end dates for export functionality while maintaining separation of concerns.
107-113
: Well-implemented callback wrapper.The
handleUpdateDateRange
callback properly maintains both local state and calls the original hook function, ensuring state synchronization across components.
188-197
: Comprehensive props for export integration.The enhanced props provide the
TimeActivityExportMenu
with all necessary context including filtered data, permissions, current filters, and date range. This enables full-featured export functionality.apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (3)
31-36
: Well-defined export-related props.The interface extension properly types all necessary data for export functionality including activity data, user permissions, filters, and date range context.
82-89
: Excellent modular refactor.Replacing the old export UI with the dedicated
TimeActivityExportMenu
component improves:
- Code organization and maintainability
- Single responsibility principle adherence
- Reusability of export functionality
All necessary props are properly passed to provide complete export context.
1-1
: No unused imports detected in TimeActivityHeaderAll imports and exports in
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
are actively used within the file.apps/web/core/lib/utils/export-utils.ts (2)
14-25
: LGTM! Clean implementation with proper fallback.The function correctly maps export formats to file extensions with a sensible default fallback.
30-43
: LGTM! Well-structured filename generation.The function properly handles date range formatting and falls back to current date when no range is provided. The filename pattern is clear and consistent.
apps/web/core/hooks/activities/use-export-progress.ts (1)
20-85
: Well-structured export progress hook!The hook follows React best practices with proper memoization and functional state updates. Good separation of concerns and clear interface.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (1)
17-147
: Excellent modal implementation with comprehensive user feedback!The component handles all export states gracefully with appropriate visual feedback, progress tracking, and helpful tips. Good use of conditional rendering and state-based styling.
apps/web/core/hooks/activities/use-time-activity-export.ts (1)
1-257
: Usage of useTimeActivityExport Verified
useTimeActivityExport
is imported and invoked in
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
- The hook’s return values (
exportableData
,exportSummary
,exportProgress
,resetProgress
) are actively used in that componentNo unused code remains—pipeline warning is a false positive.
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
Outdated
Show resolved
Hide resolved
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: 6
♻️ Duplicate comments (13)
apps/web/core/hooks/activities/use-export-progress.ts (1)
29-37
: Address the unused totalSteps parameter.The
totalSteps
parameter is accepted but not utilized in thestartExport
function. Either implement progress calculation logic using this parameter or remove it if not needed.-const startExport = useCallback((totalSteps: number) => { +const startExport = useCallback(() => { setExportProgress({ isExporting: true, progress: 0, currentStep: 'Preparing data...', error: null, success: false }); }, []);Or implement step-based progress calculation:
const startExport = useCallback((totalSteps: number) => { setExportProgress({ isExporting: true, progress: 0, - currentStep: 'Preparing data...', + currentStep: `Preparing data... (0/${totalSteps})`, error: null, - success: false + success: false, + totalSteps }); }, []);apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (1)
31-36
: Define proper interface for rapportDailyActivity instead of using any[].The
any[]
type reduces type safety. Consider creating a proper interface for the daily activity data structure.+interface DailyActivityReport { + date: string; + employees?: Array<{ + employee: { + id: string; + fullName: string; + billRateValue?: number; + }; + projects: Array<{ + project: { name: string }; + tasks: Array<{ + title: string; + duration: number; + }>; + }>; + }>; + logs?: Array<{ + project: { name: string }; + employeeLogs: Array<{ + employee: { + id: string; + fullName: string; + billRateValue?: number; + }; + sum: number; + activity: number; + tasks?: Array<{ + task: { title: string }; + duration: number; + }>; + }>; + }>; +} export interface TimeActivityHeaderProps { // ... other props ... - rapportDailyActivity?: any[]; + rapportDailyActivity?: DailyActivityReport[]; // ... other props ... }apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (2)
133-133
: Define proper interface for data array items instead of using any[].The
any[]
type reduces type safety and makes the code harder to maintain.+interface TimeActivityData { + member: string; + project: string; + task: string; + trackedHours: string; + earnings: string; + activityLevel: string; + date?: string; +} export interface TimeActivityByMemberPDFProps { - data: any[]; + data: TimeActivityData[]; title: string; startDate: string; endDate: string; }
176-178
: Round minutes to prevent floating point precision issues in hour calculations.The minute calculation could produce floating point precision errors.
const hoursMatch = item.trackedHours?.match(/(\d+)h\s*(\d+)m/); -const hours = hoursMatch ? parseInt(hoursMatch[1]) + parseInt(hoursMatch[2]) / 60 : 0; +const hours = hoursMatch ? parseInt(hoursMatch[1]) + Math.round(parseInt(hoursMatch[2]) / 60 * 100) / 100 : 0;Also applies to: 238-238
apps/web/core/hooks/activities/use-time-activity-export.ts (1)
129-129
: Using Math.random() for activity level is dangerous - should use actual activity data from the source.The activity level should be based on real data, not random values.
- const activityLevel = `${Math.floor(Math.random() * 100)}%`; + // Get actual activity level from data or use 0 as fallback + const activityLevel = `${taskData.activity || employeeData.activity || 0}%`;apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (5)
223-224
: Static page count in footer.Footer always shows 'Page 1 of 1' regardless of actual content or potential pagination.
For accuracy, either:
- Remove the page count if not implementing pagination
- Implement actual page counting for large datasets
111-111
: Define proper TypeScript interface for data prop.Using
any[]
lacks type safety. Define a specific interface for the data structure.- data: any[]; + data: Array<{ + date: string; + member: string; + project: string; + task: string; + trackedHours: string; + earnings: string; + activityLevel: string; + }>;
132-136
: Remove console.log before production.Debug logging should be removed from production code.
- console.log('🔍 PDF Component - Receiving transformed data:', { - dataLength: data?.length || 0, - sampleData: data?.[0], - isTransformed: data?.[0]?.member ? true : false - }); + // Data should already be transformed to the format: + // [{ date, member, project, task, trackedHours, earnings, activityLevel }]
152-152
: Add locale parameter to toLocaleDateString.Without a locale parameter, date formatting may vary across different systems.
- <Text style={styles.subtitle}>Generated on: {new Date().toLocaleDateString()}</Text> + <Text style={styles.subtitle}>Generated on: {new Date().toLocaleDateString('en-US')}</Text>
210-210
: Data truncation without user notification.The hard limit of 50 records may truncate data without warning the user.
Consider either:
- Adding a visual indicator when data is truncated
- Implementing pagination
- Showing a message like "Showing first 50 of X records"
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (2)
23-23
: Define proper TypeScript interface for rapportDailyActivity.Using
any[]
lacks type safety.Define a specific interface for the activity data structure to ensure type safety throughout the component.
95-105
: CSV export is not implemented.The CSV export option is visible in the UI but the actual implementation is commented out. This will confuse users.
Either:
- Implement the CSV export functionality
- Disable/hide the CSV menu item until implemented
- Show a "Coming Soon" message
apps/web/core/lib/config/export-config.ts (1)
207-207
: Replace console.log with proper logging mechanism.Debug logging should use a proper logging service or be configurable.
- console.log('Export Performance Metrics:', { + // Use a proper logging service or make it configurable + logger.debug('Export Performance Metrics:', {Or make logging optional:
logMetrics(logger?: (message: string, data: any) => void): void { const metrics = this.getMetrics(); const logData = { totalTime: `${metrics.totalTime.toFixed(2)}ms`, checkpoints: Object.entries(metrics.checkpoints).map(([name, time]) => ({ name, time: `${time.toFixed(2)}ms` })) }; if (logger) { logger('Export Performance Metrics:', logData); } }
🧹 Nitpick comments (5)
apps/web/core/lib/utils/export-utils.ts (1)
14-25
: Simplify the file extension mapping logic.The switch statement is unnecessarily verbose since it directly returns the format value for most cases.
-export function getFileExtension(format: 'csv' | 'xlsx' | 'pdf'): string { - switch (format) { - case 'csv': - return 'csv'; - case 'xlsx': - return 'xlsx'; - case 'pdf': - return 'pdf'; - default: - return 'txt'; - } -} +export function getFileExtension(format: 'csv' | 'xlsx' | 'pdf'): string { + const validFormats: Record<string, string> = { + csv: 'csv', + xlsx: 'xlsx', + pdf: 'pdf' + }; + return validFormats[format] || 'txt'; +}apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (1)
141-199
: Consider adding type safety to the grouped data structure.The grouped data structure uses
any
types extensively, which could be improved for better type safety.- const grouped: { [key: string]: any } = {}; + interface GroupedMemberData { + name: string; + projects: { [key: string]: { + name: string; + tasks: Array<{ + title: string; + hours: string; + earnings: string; + activityLevel: string; + date?: string; + }>; + totalHours: number; + totalEarnings: number; + }}; + totalHours: number; + totalEarnings: number; + totalTasks: number; + } + const grouped: { [key: string]: GroupedMemberData } = {};apps/web/core/hooks/activities/use-time-activity-export.ts (1)
41-256
: Well-implemented export hook with comprehensive data handling.The hook properly handles:
- Permission-based data filtering
- Multiple data structure formats
- Performance monitoring
- Export feasibility validation
Consider adding error boundaries for the data transformation to handle unexpected data formats gracefully.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
135-135
: Simplify boolean expression.The ternary operator is unnecessary for boolean values.
- isTransformed: data?.[0]?.member ? true : false + isTransformed: !!data?.[0]?.memberapps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (1)
161-271
: Extract complex transformation logic into separate functions.The data transformation logic is deeply nested and complex, making it hard to maintain and test.
Consider extracting the transformation logic into smaller, testable functions:
function transformDayData(dayData: any): ExportRow[] { const rows: ExportRow[] = []; if (!dayData.logs) return rows; dayData.logs.forEach((projectLog: ProjectLog) => { const projectRows = transformProjectLog(projectLog, dayData.date || ''); rows.push(...projectRows); }); return rows; } function transformProjectLog(projectLog: ProjectLog, date: string): ExportRow[] { const rows: ExportRow[] = []; const projectName = projectLog.project?.name || 'No Project'; projectLog.employeeLogs?.forEach(employeeLog => { const employeeRows = transformEmployeeLog(employeeLog, date, projectName); rows.push(...employeeRows); }); return rows; } function transformEmployeeLog( employeeLog: EmployeeLog, date: string, projectName: string ): ExportRow[] { const memberName = employeeLog.employee?.fullName || employeeLog.employee?.user?.name || 'Unknown Member'; if (employeeLog.tasks && employeeLog.tasks.length > 0) { return employeeLog.tasks.map(task => transformTaskLog(task, date, memberName, projectName, employeeLog) ); } return [transformGeneralWork(employeeLog, date, memberName, projectName)]; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/index.ts
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/page-component.tsx
(3 hunks)apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
(3 hunks)apps/web/core/hooks/activities/use-export-progress.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-export.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-stats.ts
(1 hunks)apps/web/core/lib/config/export-config.ts
(1 hunks)apps/web/core/lib/utils/export-utils.ts
(1 hunks)
🧠 Learnings (9)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (11)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (4)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (5)
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-time-activity-export.ts (2)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
🧬 Code Graph Analysis (1)
apps/web/core/components/pages/time-and-activity/page-component.tsx (2)
apps/web/core/hooks/activities/use-report-activity.ts (2)
useReportActivity
(70-350)GroupByType
(68-68)apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
🧰 Additional context used
🧠 Learnings (9)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (11)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (4)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (5)
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-time-activity-export.ts (2)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
🧬 Code Graph Analysis (1)
apps/web/core/components/pages/time-and-activity/page-component.tsx (2)
apps/web/core/hooks/activities/use-report-activity.ts (2)
useReportActivity
(70-350)GroupByType
(68-68)apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: deploy
🔇 Additional comments (13)
apps/web/core/lib/utils/export-utils.ts (2)
1-44
: Acknowledge pipeline failure for progressive migration approach.The Knip unused code detection is expected during progressive migration where infrastructure is added before implementation. This aligns with the team's established pattern for feature rollouts.
30-43
: LGTM! Solid filename generation logic.The function properly handles optional date range parameters and provides sensible fallbacks. The ISO date format ensures consistent, sortable filenames.
apps/web/core/hooks/activities/use-export-progress.ts (1)
1-85
: Acknowledge pipeline failure for progressive migration approach.The Knip unused code detection is expected as this hook supports the export infrastructure being progressively rolled out.
apps/web/core/hooks/activities/use-time-activity-stats.ts (2)
1-111
: Acknowledge pipeline failure during export feature integration.The unused code detection is expected as this hook supports the broader export functionality being implemented across multiple components.
98-107
: LGTM! Improved loading state consistency.Replacing hardcoded boolean values with the dynamic
loading
parameter provides more accurate loading state representation across the hook's lifecycle.apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
252-281
: LGTM! Excellent semantic improvements to date ranges.The changes provide much clearer and more intuitive date range options:
- "This Year" vs "Last Year" distinction is more user-friendly
- New "All Times" spanning 5 years provides comprehensive historical data access
- Improved labeling eliminates confusion about what "All Times" previously covered
The date range logic is correct and follows consistent patterns with other predefined ranges.
apps/web/core/components/pages/time-and-activity/export/index.ts (2)
1-11
: Acknowledge pipeline failure for progressive feature rollout.The unused code detection is expected as these export components are being progressively integrated into the time and activity reporting system.
1-11
: LGTM! Clean barrel export pattern.Good practice exporting both components and their TypeScript prop types for proper type safety and developer experience.
apps/web/core/components/pages/time-and-activity/page-component.tsx (2)
56-66
: LGTM!The expanded destructuring correctly includes
currentFilters
from the hook, which is needed for the export functionality.
106-113
: LGTM!The callback correctly synchronizes both local and report state for date range updates, ensuring UI consistency.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (2)
11-11
: LGTM!The import is correctly added and used in the component for the export functionality.
82-89
: LGTM!The export menu integration is clean and properly encapsulates the export functionality in a dedicated component.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (1)
1-147
: LGTM! Well-implemented export progress modal.The component is well-structured with:
- Clear state management and conditional rendering
- Proper TypeScript typing
- Good UX with progress indicators and helpful tips
- Comprehensive error handling with retry capability
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/page-component.tsx
Outdated
Show resolved
Hide resolved
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: 7
♻️ Duplicate comments (14)
apps/web/core/hooks/activities/use-export-progress.ts (1)
29-37
: Remove unusedtotalSteps
parameter.The
totalSteps
parameter is accepted but not used in thestartExport
function. Either use it to initialize progress calculations or remove it if not needed.apps/web/core/lib/config/export-config.ts (1)
207-207
: Replace console.log with proper logging mechanism.Use a proper logging service instead of console.log for production code.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (1)
31-36
: Avoid using 'any[]' type - consider creating a proper interface for rapportDailyActivity.The
any[]
type reduces type safety. Define a proper interface based on the actual data structure.// Export-related props - rapportDailyActivity?: any[]; + rapportDailyActivity?: RapportDailyActivity[]; isManage?: boolean; currentFilters?: FilterState; startDate?: Date; endDate?: Date;Add the interface definition at the top of the file:
interface RapportDailyActivity { date: string; employees?: Array<{ employee: TEmployee; projects: Array<{ project: TOrganizationProject; tasks: Array<{ title: string; duration: number; // Add other properties as needed }>; }>; }>; logs?: Array<{ project: TOrganizationProject; employeeLogs: Array<{ employee: TEmployee; sum: number; activity: number; tasks?: Array<{ task: TTask; duration: number; }>; }>; }>; }apps/web/core/hooks/activities/use-time-activity-export.ts (1)
129-129
: Using Math.random() for activity level is dangerous - should use actual activity data from the source.This creates inconsistent and inaccurate export data. The logs structure correctly uses actual activity data (line 169).
// Activity level - const activityLevel = `${Math.floor(Math.random() * 100)}%`; + const activityLevel = `${taskData.activity || 0}%`;apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (3)
133-133
: Define proper interface for data array items instead of using any[]Define a specific interface for the data structure:
+interface TimeActivityDataRow { + date: string; + member: string; + project: string; + task: string; + trackedHours: string; + earnings: string; + activityLevel: string; +} + export interface TimeActivityByMemberPDFProps { - data: any[]; + data: TimeActivityDataRow[]; title: string; startDate: string; endDate: string; }
177-177
: Round minutes to prevent floating point precision issues in hour calculationsApply this fix to prevent floating point precision issues:
-const hours = hoursMatch ? parseInt(hoursMatch[1]) + parseInt(hoursMatch[2]) / 60 : 0; +const hours = hoursMatch ? parseInt(hoursMatch[1]) + Math.round(parseInt(hoursMatch[2]) * 100 / 60) / 100 : 0;
238-238
: Round minutes calculation to avoid floating point display issuesApply this fix:
-{Math.floor(member.totalHours)}h {Math.floor((member.totalHours % 1) * 60)}m +{Math.floor(member.totalHours)}h {Math.round((member.totalHours % 1) * 60)}mapps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (2)
23-23
: Use proper TypeScript interface instead of any[] for rapportDailyActivityDefine a proper interface for the daily activity data structure to improve type safety.
95-105
: CSV export implementation is commented out but UI option is enabledEither implement the CSV export or disable the menu item:
// Handle CSV export const handleCSVExport = useCallback(async () => { if (!hasData) { console.warn('No data available for export'); - // TODO: Show toast notification + toast.error('No data available for export'); return; } setCurrentExportType('csv'); setShowProgressModal(true); - // await exportToCSV(exportOptions); + // TODO: Implement CSV export + toast.error('CSV export is not yet implemented'); + setShowProgressModal(false); }, [hasData, exportOptions]);apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (5)
223-224
: Footer shows 'Page 1 of 1' but there's no actual page count implementationEither implement proper pagination or remove the page count to avoid confusion.
111-111
: Type 'any[]' for data prop lacks proper type definitionDefine a specific interface for the data structure:
export interface TimeActivityPDFProps { - data: any[]; + data: Array<{ + date: string; + member: string; + project: string; + task: string; + trackedHours: string; + earnings: string; + activityLevel: string; + }>; title: string;
132-136
: Remove console.log and simplify boolean expressionRemove the console.log statement and simplify the ternary:
const transformedData = React.useMemo(() => { - console.log('🔍 PDF Component - Receiving transformed data:', { - dataLength: data?.length || 0, - sampleData: data?.[0], - isTransformed: data?.[0]?.member ? true : false - }); - // Data should already be transformed to the format: // [{ date, member, project, task, trackedHours, earnings, activityLevel }] return data || []; }, [data]);
152-152
: toLocaleDateString() needs locale parameter for consistent formattingAdd locale parameter:
-<Text style={styles.subtitle}>Generated on: {new Date().toLocaleDateString()}</Text> +<Text style={styles.subtitle}>Generated on: {new Date().toLocaleDateString('en-US')}</Text>
210-220
: Hard limit of 50 records may truncate data without user warningAdd a note when data is truncated:
{/* Table Rows */} {transformedData.slice(0, 50).map((row, index) => ( <View key={index} style={styles.tableRow}> // ... row content </View> ))} +{transformedData.length > 50 && ( + <Text style={[styles.tableCell, { textAlign: 'center', fontStyle: 'italic', marginTop: 10 }]}> + ... and {transformedData.length - 50} more records + </Text> +)}
🧹 Nitpick comments (3)
apps/web/core/lib/config/export-config.ts (1)
149-151
: Improve memory usage estimation accuracy.The default
avgRecordSizeKB
of 1KB may not accurately reflect actual record sizes for time and activity data, which could include nested objects and metadata. Consider implementing dynamic size estimation or providing more realistic defaults.-export function estimateMemoryUsage(recordCount: number, avgRecordSizeKB: number = 1): number { +export function estimateMemoryUsage(recordCount: number, avgRecordSizeKB: number = 2.5): number {apps/web/core/components/pages/time-and-activity/page-component.tsx (1)
188-197
: Consider removing the type cast for currentFilters.The type cast
as FilterState
might hide potential type mismatches. IfcurrentFilters
fromuseReportActivity
already has the correct type, the cast is unnecessary. If not, consider fixing the type at the source.rapportDailyActivity={rapportDailyActivity} isManage={isManage || false} - currentFilters={currentFilters as FilterState} + currentFilters={currentFilters} startDate={dateRange.startDate} endDate={dateRange.endDate}apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (1)
1-147
: Well-implemented export progress modal!The component provides excellent user feedback with clear visual states and helpful information. Consider adding ARIA labels for better accessibility:
return ( - <Modal isOpen={isOpen} closeModal={onClose} className="max-w-md"> + <Modal isOpen={isOpen} closeModal={onClose} className="max-w-md" aria-label="Export Progress"> <div className="p-6"> {/* Header */} <div className="flex gap-3 items-center mb-4"> {getProgressIcon()} <div> <h3 className="text-lg font-semibold text-gray-900 dark:text-gray-100">{getTitle()}</h3> <p className="text-sm text-gray-600 dark:text-gray-400">{getDescription()}</p> </div> </div> {/* Progress Bar */} {(exportProgress.isExporting || exportProgress.success) && ( <div className="mb-4"> <div className="flex justify-between mb-2 text-sm text-gray-600 dark:text-gray-400"> <span>Progress</span> <span>{exportProgress.progress}%</span> </div> - <div className="w-full h-2 bg-gray-200 rounded-full dark:bg-gray-700"> + <div className="w-full h-2 bg-gray-200 rounded-full dark:bg-gray-700" role="progressbar" aria-valuenow={exportProgress.progress} aria-valuemin={0} aria-valuemax={100}> <div className={`h-2 rounded-full transition-all duration-300 ${getProgressColor()}`} style={{ width: `${exportProgress.progress}%` }} /> </div> </div> )}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (13)
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/index.ts
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/page-component.tsx
(3 hunks)apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
(3 hunks)apps/web/core/hooks/activities/use-export-progress.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-export.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-stats.ts
(1 hunks)apps/web/core/lib/config/export-config.ts
(1 hunks)apps/web/core/lib/utils/export-utils.ts
(1 hunks)
🧠 Learnings (11)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/hooks/activities/use-time-activity-stats.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/export/index.ts (1)
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (4)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-time-activity-export.ts (2)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (10)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (5)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
🧬 Code Graph Analysis (2)
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (2)
apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (1)
TimeActivityExportMenu
(32-356)
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (10)
apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)apps/web/core/hooks/activities/use-report-activity.ts (1)
GroupByType
(68-68)apps/web/app/[locale]/next-intl.d.ts (1)
useTranslations
(24-24)apps/web/core/hooks/activities/use-time-activity-export.ts (1)
useTimeActivityExport
(41-256)apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (1)
TimeActivityByMemberPDF
(139-286)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
TimeActivityPDF
(129-228)packages/ui/src/components/dropdown-menu.tsx (4)
DropdownMenu
(204-204)DropdownMenuTrigger
(206-206)DropdownMenuContent
(207-207)DropdownMenuItem
(210-210)packages/ui/src/components/button.tsx (1)
Button
(49-49)apps/web/core/components/common/skeleton/export-pdf-skeleton.tsx (1)
ExportPDFSkeleton
(3-12)apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (1)
ExportProgressModal
(17-147)
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
🧰 Additional context used
🧠 Learnings (11)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/hooks/activities/use-time-activity-stats.ts (1)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (1)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
apps/web/core/components/pages/time-and-activity/export/index.ts (1)
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (4)
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
apps/web/core/components/pages/time-and-activity/page-component.tsx (9)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/hooks/activities/use-time-activity-export.ts (2)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
apps/web/core/hooks/activities/use-export-progress.ts (2)
Learnt from: NdekoCode
PR: #3887
File: apps/web/core/query/keys/index.ts:41-58
Timestamp: 2025-06-07T04:31:16.865Z
Learning: The team uses a progressive migration approach for React Query implementation, where query key infrastructure is added first before implementing the hooks/services that use them. This results in intentionally unused code during intermediate migration states.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (10)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3392
File: apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx:42-51
Timestamp: 2024-12-05T09:04:08.049Z
Learning: In the GroupBySelect
component (apps/web/app/[locale]/reports/weekly-limit/components/group-by-select.tsx
), only one option can be selected at a time; two options cannot be selected simultaneously.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3328
File: apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx:66-78
Timestamp: 2024-11-13T05:17:33.527Z
Learning: In the UserTeamActivity
component (apps/web/lib/features/team/user-team-card/user-team-card-activity.tsx
), the overflow-hidden
class is intentionally applied only to the first Tab.Panel
because the hidden overflow is needed when the sub-component has not yet been made visible. Applying overflow-hidden
to the other Tab.Panel
components is not required.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (5)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (2)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: NdekoCode
PR: #3234
File: apps/web/components/pages/team/tasks/TaskTable.tsx:9-13
Timestamp: 2024-11-06T17:10:06.239Z
Learning: In the TaskTable
component (apps/web/components/pages/team/tasks/TaskTable.tsx
), we do not need to add error handling for task fetching when using useTeamTasks()
.
🧬 Code Graph Analysis (2)
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (2)
apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (1)
TimeActivityExportMenu
(32-356)
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (10)
apps/web/core/types/interfaces/timesheet/time-limit-report.ts (1)
FilterState
(37-42)apps/web/core/hooks/activities/use-report-activity.ts (1)
GroupByType
(68-68)apps/web/app/[locale]/next-intl.d.ts (1)
useTranslations
(24-24)apps/web/core/hooks/activities/use-time-activity-export.ts (1)
useTimeActivityExport
(41-256)apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx (1)
TimeActivityByMemberPDF
(139-286)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx (1)
TimeActivityPDF
(129-228)packages/ui/src/components/dropdown-menu.tsx (4)
DropdownMenu
(204-204)DropdownMenuTrigger
(206-206)DropdownMenuContent
(207-207)DropdownMenuItem
(210-210)packages/ui/src/components/button.tsx (1)
Button
(49-49)apps/web/core/components/common/skeleton/export-pdf-skeleton.tsx (1)
ExportPDFSkeleton
(3-12)apps/web/core/components/pages/time-and-activity/export/export-progress-modal.tsx (1)
ExportProgressModal
(17-147)
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-stats.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/export/index.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/hooks/activities/use-export-progress.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/utils/export-utils.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
🪛 Biome (1.9.4)
apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
[error] 135-136: Unnecessary use of boolean literals in conditional expression.
Simplify your code by directly assigning the result without using a ternary operator.
If your goal is negation, you may use the logical NOT (!) or double NOT (!!) operator for clearer and concise code.
Check for more details about NOT operator.
Unsafe fix: Remove the conditional expression with
(lint/complexity/noUselessTernary)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: deploy
🔇 Additional comments (19)
apps/web/core/hooks/activities/use-export-progress.ts (1)
1-86
: Unused code warning expected during progressive migration.The Knip warning about unused code is expected given this is part of a progressive migration approach where infrastructure is added before implementation.
apps/web/core/lib/config/export-config.ts (1)
1-259
: Unused code warning expected during progressive migration.The Knip warning is expected as this configuration system is part of the progressive migration approach where infrastructure is added before full implementation.
apps/web/core/hooks/activities/use-time-activity-stats.ts (3)
98-98
: Good improvement to loading state consistency.Directly using the
loading
parameter instead of hardcodingtrue
ensures the loading state accurately reflects the current state.
106-106
: Consistent loading state management.The change to use
loading
parameter directly improves state consistency across both loading and loaded states.
1-112
: Unused code warning expected during progressive migration.The Knip warning is expected as this is part of the progressive migration approach mentioned in the learnings.
apps/web/core/components/pages/time-and-activity/date-range-picker-time-activity.tsx (3)
252-260
: Good addition of "This Year" range.Adding the current year range provides users with a commonly needed date filter option.
262-270
: Accurate renaming from "All Times" to "Last Year".The rename better describes what the range actually represents - the full previous calendar year.
272-281
: Enhanced "All Times" range with wider coverage.The 5-year span provides more comprehensive historical data access while remaining practical for most use cases.
apps/web/core/components/pages/time-and-activity/export/index.ts (2)
1-12
: Clean barrel export structure.The index file provides a well-organized central export point for all export-related components and types, following standard patterns.
1-12
: Unused code warning expected during progressive migration.The Knip warning is expected as these exports are part of the progressive migration where components are added before full integration.
apps/web/core/components/pages/time-and-activity/page-component.tsx (3)
56-66
: LGTM!The addition of
currentFilters
to the destructured properties is necessary for the export functionality.
68-68
: LGTM!The local date range state is properly typed with optional Date properties.
107-114
: LGTM!The callback properly manages both local and parent state updates with correct memoization.
apps/web/core/components/pages/time-and-activity/time-activity-header.tsx (2)
11-11
: LGTM!The import correctly brings in the new export menu component.
82-89
: LGTM!The export menu component is properly integrated with all required props.
Note: The pipeline failure about unused code might be related to removed imports. Ensure all imports are being used.
apps/web/core/lib/utils/export-utils.ts (1)
30-43
: LGTM! Clean implementation of export utilities.The filename generation logic is well-implemented with proper date formatting and fallbacks.
Note: The pipeline error might be due to the commented import in
use-time-activity-export.ts
(line 5). Consider removing the commented import if it's not needed.apps/web/core/hooks/activities/use-time-activity-export.ts (3)
52-85
: Excellent permission-based filtering!The implementation properly restricts data access for non-managers and handles both data structure formats correctly.
88-223
: Well-structured data transformation with performance optimization!The implementation effectively handles both data structures, includes performance monitoring, and validates export feasibility. Good defensive programming with fallback values.
226-256
: LGTM! Comprehensive hook API.The hook provides all necessary data and utilities for export functionality, with good UX consideration by allowing exports even with empty data.
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
Outdated
Show resolved
Hide resolved
Please review these files and clean up the unused code. |
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: 2
♻️ Duplicate comments (6)
apps/web/core/hooks/activities/use-time-activity-export.ts (2)
5-5
: Remove the commented import to fix pipeline failure.The commented import is causing the pipeline failure and should be removed.
-// import { generateExportFilename } from '@/core/lib/utils/export-utils';
88-224
: Replaceany
types with proper interfaces in the transformation function.The extensive use of
any
types makes the code error-prone and reduces type safety. Define proper interfaces for the data structures to improve maintainability.apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (2)
262-291
: Avoid parsing formatted strings back to numbers.The code formats hours/earnings as strings and then parses them back using regex. This is inefficient and error-prone. Keep the raw numeric values alongside the formatted strings.
127-146
: Complete the CSV and XLSX export implementations.The export handlers only show the progress modal but don't actually perform the export. The actual export calls are commented out.
apps/web/core/lib/config/export-config.ts (2)
1-1
: Address unused code warning.Several exports in this file are unused and causing pipeline failures. Either remove unused exports, add comments explaining their future use, or integrate them into the export implementation.
234-258
: Enhance batch processing with error handling.The batch processing utility lacks error handling for individual batch failures. Consider adding error recovery mechanisms to handle partial failures gracefully.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (8)
apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
(1 hunks)apps/web/core/components/pages/time-and-activity/page-component.tsx
(3 hunks)apps/web/core/hooks/activities/use-export-progress.ts
(1 hunks)apps/web/core/hooks/activities/use-time-activity-export.ts
(1 hunks)apps/web/core/hooks/activities/use-timesheet.ts
(0 hunks)apps/web/core/lib/config/export-config.ts
(1 hunks)
🧠 Learnings (3)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/hooks/activities/use-time-activity-export.ts (7)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: NdekoCode
PR: #3199
File: apps/web/components/app-sidebar.tsx:49-55
Timestamp: 2024-10-28T17:16:03.609Z
Learning: In apps/web/components/app-sidebar.tsx
, hardcoded sample user data is intentionally included and should not be removed.
Learnt from: syns2191
PR: #3409
File: .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts:21-22
Timestamp: 2024-12-11T01:37:45.660Z
Learning: When adding TERM_OF_SERVICE
and PRIVACY_POLICY
in DesktopServerWebEnvironmentContent
in .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts
, fallback values using the ||
operator are not necessary.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (10)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:29-29
Timestamp: 2024-10-28T17:22:19.947Z
Learning: In apps/web/app/stores/team-tasks.ts
, tasks should be sorted alphabetically, not by createdAt
date.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
💤 Files with no reviewable changes (1)
- apps/web/core/hooks/activities/use-timesheet.ts
✅ Files skipped from review due to trivial changes (1)
- apps/web/core/hooks/activities/use-export-progress.ts
🚧 Files skipped from review as they are similar to previous changes (3)
- apps/web/core/components/pages/time-and-activity/page-component.tsx
- apps/web/core/components/pages/time-and-activity/export/time-activity-pdf.tsx
- apps/web/core/components/pages/time-and-activity/export/time-activity-by-member-pdf.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/hooks/activities/use-time-activity-export.ts (7)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: NdekoCode
PR: #3199
File: apps/web/components/app-sidebar.tsx:49-55
Timestamp: 2024-10-28T17:16:03.609Z
Learning: In apps/web/components/app-sidebar.tsx
, hardcoded sample user data is intentionally included and should not be removed.
Learnt from: syns2191
PR: #3409
File: .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts:21-22
Timestamp: 2024-12-11T01:37:45.660Z
Learning: When adding TERM_OF_SERVICE
and PRIVACY_POLICY
in DesktopServerWebEnvironmentContent
in .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts
, fallback values using the ||
operator are not necessary.
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (10)
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the FilterTaskActionMenu
component will be implemented in a future PR.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: Innocent-Akim
PR: #3208
File: apps/web/app/[locale]/timesheet/components/TimesheetFilter.tsx:30-35
Timestamp: 2024-10-30T16:31:01.294Z
Learning: In the TimesheetFilter
component, the Add Time
button does not need to use the AddManualTimeModal
component, as per the user's decision.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:14-19
Timestamp: 2024-10-25T15:16:53.869Z
Learning: In apps/web/components/ui/sidebar.tsx
, cookie configuration enhancements including secure
and httpOnly
flags, and making cookie name and max age configurable via environment variables, have already been implemented in previous commits.
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: CREDO23
PR: #3626
File: apps/web/app/[locale]/projects/components/page-component.tsx:119-119
Timestamp: 2025-02-28T09:17:46.802Z
Learning: In the projects page component, filtering of projects based on the active team has been moved out of the useEffect hook that fetches organization projects, and is now handled in the pagination logic instead.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:29-29
Timestamp: 2024-10-28T17:22:19.947Z
Learning: In apps/web/app/stores/team-tasks.ts
, tasks should be sorted alphabetically, not by createdAt
date.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
apps/web/core/lib/config/export-config.ts
[error] 1-1: Unused code detected in this file.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: deploy
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (13)
apps/web/core/hooks/activities/use-time-activity-export.ts (3)
52-85
: Well-implemented permission-based data filtering.The filtering logic correctly handles user permissions, restricting non-managers to their own data while allowing managers to see all data. The defensive programming approach that handles both "employees" and "logs" data structures is commendable.
95-101
: Excellent performance monitoring and validation approach.The implementation properly validates export feasibility upfront and includes performance monitoring with checkpoints. This proactive approach helps prevent performance issues and provides valuable debugging information.
227-230
: Verify the export behavior with no data.The logic allows export attempts even when there's no data. Please confirm this is intentional for showing appropriate user messages, or if it should prevent export attempts when no data is available.
// Current logic allows export even with no data return exportableData.length > 0 || rapportDailyActivity.length > 0; // Always allow export attemptapps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx (6)
33-62
: Well-defined TypeScript interfaces improve type safety.The addition of
ExportRow
,ProjectLog
,EmployeeLog
, andTaskLog
interfaces significantly improves type safety compared to usingany
types throughout the codebase. This addresses many of the type safety concerns.
63-82
: Clean component structure with proper state management.The component props are well-defined with sensible defaults, and the state management for export progress and type tracking is appropriately structured. The integration with the
useTimeActivityExport
hook is properly implemented.
113-124
: Fix the dependency array to use effective dates.The
useMemo
dependency array usesstartDate
andendDate
, but the memo itself useseffectiveStartDate
andeffectiveEndDate
. This could lead to stale data.- [effectiveStartDate, effectiveEndDate, currentFilters] + [effectiveStartDate, effectiveEndDate, currentFilters]Wait, looking at the code more carefully, the dependency array is actually correct. The memo uses
effectiveStartDate
andeffectiveEndDate
and the dependency array also lists them correctly.
190-261
: Robust data transformation with proper type safety.The PDF data transformation logic effectively handles different data structures (with and without specific tasks) and now uses proper TypeScript interfaces. The logic for calculating hours, earnings, and activity levels is comprehensive and handles edge cases well.
328-330
: Proper filename generation with correct dependencies.The filename generation correctly uses the utility function and has the proper dependency array with
effectiveStartDate
andeffectiveEndDate
.
332-384
: Well-structured UI with appropriate loading states and feature flags.The UI implementation properly uses Suspense for PDF loading, appropriately disables incomplete CSV/XLSX features, and correctly integrates the export progress modal. The dropdown structure and event handling are well-implemented.
apps/web/core/lib/config/export-config.ts (4)
6-95
: Excellent configuration structure with comprehensive settings.The
ExportConfig
interface andDEFAULT_EXPORT_CONFIG
are well-designed with logical grouping of settings for performance, memory management, file limits, and format-specific configurations. The default values appear well-tuned for optimal performance.
98-144
: Smart performance optimization with size-based configurations.The size-based configuration approach with
EXPORT_CONFIGS
andgetOptimalExportConfig
demonstrates excellent performance awareness. The scaling from small to enterprise configurations with appropriate batch sizes and memory limits is well-designed.
146-215
: Robust validation and performance monitoring utilities.The
validateExportFeasibility
function andExportPerformanceMonitor
class demonstrate excellent engineering practices with proper memory estimation, validation logic, and performance tracking with checkpoints.
217-229
: Proper memory monitoring with safe browser environment checks.The
getMemoryUsage
function correctly checks for browser environment and memory API availability with appropriate fallbacks. The unit conversion to MB makes the values more readable.
…rt for improved data handling - Updated TimeActivityExportMenu to utilize new DailyActivityReport type, simplifying data structure handling. - Introduced type guards for distinguishing between new and legacy data structures in useTimeActivityExport. - Removed custom interfaces in favor of existing types, streamlining the codebase and improving maintainability.
Please review these files and clean up the unused code. |
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: 0
♻️ Duplicate comments (3)
apps/web/core/hooks/activities/use-time-activity-export.ts (3)
5-9
: Remove the commented import line to fix pipeline failure.The commented import is causing the "unused code" pipeline failure and should be removed since it's not being used anywhere in the code.
-// import { generateExportFilename } from '@/core/lib/utils/export-utils';
154-156
: Fix the incorrect random activity level generation and string concatenation.The activity level is being randomly generated instead of using actual data, and there's improper string concatenation that will result in "[object Object]" being appended.
- // TODO: Get actual activity level from data or use 0 as fallback - const activityLevel = `${Math.floor(Math.random() * 100)}% ${employeeData}`; // + // Get actual activity level from data or use 0 as fallback + const activityLevel = `${employeeData.activity || 0}%`;
113-249
: Replace extensiveany
types with proper interfaces.The transformation function uses many
any
types which reduces type safety and maintainability. Define proper TypeScript interfaces for the data structures:interface DayData { date: string; employees?: EmployeeData[]; logs?: ProjectLog[]; } interface EmployeeData { employee: { fullName?: string; user?: { name: string }; billRateValue?: number; userId?: string; id?: string; }; projects?: ProjectData[]; activity?: number; } interface ProjectData { project: { name: string }; tasks?: TaskData[]; } interface TaskData { title: string; duration: number; activity?: number; }Then update the function signature:
-const transformDataForExport = useCallback((data: any[]): ExportData[] => { +const transformDataForExport = useCallback((data: DayData[]): ExportData[] => {
🧹 Nitpick comments (1)
apps/web/core/hooks/activities/use-time-activity-export.ts (1)
38-64
: Consider improving type safety for the interfaces.While the interfaces are well-structured, there are opportunities to improve type safety:
- The
rapportDailyActivity
prop could use the defined union type instead of optional generic- Consider making required fields explicit vs optional
export interface UseTimeActivityExportProps { - rapportDailyActivity?: DailyActivityReport[]; + rapportDailyActivity: DailyActivityReport[]; isManage?: boolean; currentFilters?: FilterState; startDate?: Date; endDate?: Date; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
(1 hunks)apps/web/core/hooks/activities/use-time-activity-export.ts
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- apps/web/core/components/pages/time-and-activity/export/time-activity-export-menu.tsx
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: Innocent-Akim
PR: ever-co/ever-teams#3208
File: apps/web/app/[locale]/timesheet/components/FrequencySelect.tsx:67-79
Timestamp: 2024-10-30T16:25:19.910Z
Learning: The date range selection functionality for the date range options in the `FilterTaskActionMenu` component will be implemented in a future PR.
apps/web/core/hooks/activities/use-time-activity-export.ts (8)
Learnt from: CREDO23
PR: #3353
File: apps/web/lib/features/task/task-input.tsx:812-815
Timestamp: 2024-11-20T19:56:12.313Z
Learning: In apps/web/lib/features/task/task-input.tsx
, prefer using useRef
over useState
for assignees
in the AssigneesSelect
component to prevent re-renders on change.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:45.111Z
Learning: In apps/web/components/ui/sidebar.tsx
, modifications to the keyboard shortcut implementation within React.useEffect
can cause build errors. The current implementation has been validated by shadcn-ui and should remain unchanged.
Learnt from: CREDO23
PR: #3185
File: apps/web/lib/settings/task-statuses-form.tsx:187-199
Timestamp: 2024-11-07T14:04:24.336Z
Learning: In apps/web/lib/settings/task-statuses-form.tsx
, when generating colors in the getRandomColor
function, prefer to keep generating them randomly to have more than five colors, even if it might affect color accessibility.
Learnt from: NdekoCode
PR: #3199
File: apps/web/app/stores/team-tasks.ts:39-40
Timestamp: 2024-10-28T17:23:01.110Z
Learning: The favoriteTasksAtom
in apps/web/app/stores/team-tasks.ts
is important for future implementations and should not be removed, even if it appears unused currently.
Learnt from: NdekoCode
PR: #3189
File: apps/web/components/ui/sidebar.tsx:77-87
Timestamp: 2024-10-25T15:15:35.107Z
Learning: In apps/web/components/ui/sidebar.tsx
, keyboard shortcut accessibility has already been reviewed and approved by shadcn-ui; further suggestions in this area are unnecessary.
Learnt from: NdekoCode
PR: #3199
File: apps/web/components/app-sidebar.tsx:49-55
Timestamp: 2024-10-28T17:16:03.609Z
Learning: In apps/web/components/app-sidebar.tsx
, hardcoded sample user data is intentionally included and should not be removed.
Learnt from: syns2191
PR: #3409
File: .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts:21-22
Timestamp: 2024-12-11T01:37:45.660Z
Learning: When adding TERM_OF_SERVICE
and PRIVACY_POLICY
in DesktopServerWebEnvironmentContent
in .scripts/electron-desktop-environment/concrete-environment-content/desktop-server-web-environment-content.ts
, fallback values using the ||
operator are not necessary.
Learnt from: CREDO23
PR: #3360
File: apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx:346-354
Timestamp: 2024-11-25T18:49:15.126Z
Learning: In apps/web/components/pages/task/details-section/blocks/task-secondary-info.tsx
, within the ProjectDropDown
component, both parent and child state should be synchronized for better UI updates, even in controlled mode. The onChange
function carries the parent state, and setSelected
maintains the selected state in the child component.
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/activities/use-time-activity-export.ts
[error] 1-1: Unused code detected in this file.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: deploy
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
apps/web/core/hooks/activities/use-time-activity-export.ts (6)
22-36
: Well-designed type guards and union type.The
DailyActivityReport
union type and corresponding type guard functions provide excellent type safety for handling both legacy and new data structures. The implementation correctly uses TypeScript's type narrowing capabilities.
84-110
: Permission-based filtering logic is well implemented.The data filtering based on user permissions correctly handles both data structures and appropriately restricts non-managers to their own data. The type guard usage ensures type safety during the filtering process.
114-126
: Excellent performance monitoring implementation.The integration of
ExportPerformanceMonitor
with validation and configuration provides robust performance tracking and export feasibility checks. The checkpoint system will help identify bottlenecks during data transformation.
252-255
: Review the export permission logic.The current logic
exportableData.length > 0 || rapportDailyActivity.length > 0
will always returntrue
when there's any source data, even if the user has no permission to see it. Consider if this is the intended behavior:-return exportableData.length > 0 || rapportDailyActivity.length > 0; // Always allow export attempt +return exportableData.length > 0; // Only allow export if user has accessible dataVerify if users should be able to attempt exports even when they have no accessible data, or if the export should be disabled in such cases.
258-271
: Efficient memoized export summary calculation.The export summary implementation correctly uses memoization and provides essential metadata for the export process. The conditional date range handling is appropriate for cases where dates might not be provided.
273-282
: Comprehensive hook return interface.The returned object provides all necessary utilities for export functionality, including data transformation, progress tracking, and permission checks. The interface design supports the export UI components effectively.
…and redirection handling - Introduced useOrganizationTeams hook to manage team loading state. - Updated loading logic to ensure both user and team data are fully loaded before proceeding with authorization checks. - Added state management for redirection to improve user experience during access control checks. - Enhanced loading indicators to provide feedback during data fetching and redirection processes.
Please review these files and clean up the unused code. |
- Updated the calculation of hourly rate to handle potential undefined values more gracefully. - Revised the activity level calculation to utilize actual data from employeeData, providing a more accurate representation. - Cleaned up comments for clarity and consistency in the codebase.
Please review these files and clean up the unused code. |
* build(deps): bump axios from 1.10.0 to 1.11.0 Bumps [axios](https://github.com/axios/axios) from 1.10.0 to 1.11.0. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](axios/axios@v1.10.0...v1.11.0) --- updated-dependencies: - dependency-name: axios dependency-version: 1.11.0 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> * Merge pull request #3956 from ever-co/ETP-55-task-add-role-selection-admin-employee-when-sending-invitations [Feature] Add role selection admin / employee / manager when sending invitations * Feat etp 39/implement export functionality on time and activity page (#3954) * [Feature] Implement export functionality for time and activity reports - Added export options for CSV, XLSX, and PDF formats in the TimeActivityExportMenu component. - Introduced ExportProgressModal to track and display export progress. - Created utility functions for generating export filenames and handling file extensions. - Developed hooks for managing export progress and data transformation for export. - Implemented PDF generation for time and activity reports, including member-specific and general reports. - Enhanced filtering logic to support export functionality based on user permissions and selected filters. - Optimized performance settings for handling large datasets during export operations. * Enhance date range options in TimeActivity components - Renamed the 'All Times' range to 'Last Year' for better accuracy. - Added a new 'All Times' range that covers a wider span from five years ago to today. - Updated the TimeActivityExportMenu to use effective start and end dates, defaulting to the current month if not provided. - Improved date formatting and calculations for export options, including total hours, earnings, and average activity metrics in the export summary. * refactor(web): 'This Year' date range option and update loading state handling - Introduced a new predefined date range option labeled 'This Year' in the TimeActivity date range picker. - Updated the loading state management in the useTimeActivityStats hook to reflect the current loading status dynamically. * refactor(web): Updated the TimeActivityExportMenu component to disable CSV and XLSX - Removed console log statements in the TimeActivityPDF and useTimesheet hooks for cleaner code and improved performance. * fix: bots suggestions * refactor(web): Enhance TimeActivityExportMenu and useTimeActivityExport for improved data handling - Updated TimeActivityExportMenu to utilize new DailyActivityReport type, simplifying data structure handling. - Introduced type guards for distinguishing between new and legacy data structures in useTimeActivityExport. - Removed custom interfaces in favor of existing types, streamlining the codebase and improving maintainability. * refactor(web): Enhance MustBeAManager component for improved loading and redirection handling - Introduced useOrganizationTeams hook to manage team loading state. - Updated loading logic to ensure both user and team data are fully loaded before proceeding with authorization checks. - Added state management for redirection to improve user experience during access control checks. - Enhanced loading indicators to provide feedback during data fetching and redirection processes. * refactor(web): Improve useTimeActivityExport for better data handling - Updated the calculation of hourly rate to handle potential undefined values more gracefully. - Revised the activity level calculation to utilize actual data from employeeData, providing a more accurate representation. - Cleaned up comments for clarity and consistency in the codebase. * Fix/etp 61 member card dropdown shows restricted actions to unauthorized users (#3960) * fix(Web): user team card menu logic to correctly identify team creator role for member removal action * refactor(web): improve user team card menu logic to filter active menu items * feat(web): add ManagerIcon and CreatorIcon components; update UserInfo to display role icons * [Feature] Show rejected expired and other non accepted invitations in the pending list with clear status indicators (#3959) * map / add invitation status displays constants * add status badge on user invite card * update getTeamInvitation to fetch all invitations * show only invitations that are not accepted * clean up * add ai bot suggestions * invalidate team invitation data on mutation success * fix(web): Enhance progress bar color logic and improve task estimation handling - Added a neutral state color for the progress bar when no estimation exists. - Updated the task estimation calculation to return 0 when no estimation data is available, improving clarity in task statistics. - Adjusted layout in TeamOutstandingNotifications component for better spacing. * refactor(web): update styling for task filters and date range components - Adjusted class names in TaskFilter and TaskStatusFilter components for improved layout and consistency. - Modified height properties for dropdowns and date picker to enhance visual alignment. - Ensured proper spacing and margins for better user experience across task filtering UI. * [Optimization] Optimize team members update handlers | removeFromTeam , makeManager , unmakeManager (#3955) * refactor: optimize team role management and remove duplicated logic * add ai bot sugggestions * update yarn lock * Merge pull request #3963 from ever-co/fix-ETP-67-bug-web-add-manual-time-modal-unexpected-closure-poor-ux Fix etp 67 bug web add manual time modal unexpected closure poor ux * Merge pull request #3958 from ever-co/ETP-57-bug-pending-invitations-list-is-hidden-when-theres-only-one-team-member [Fix bug] Show pending invitations even when the team has only one member * Feat etp 68 task web performance optimization for user profile task component (#3966) * refactor(web): optimize user profile task component and pagination logic - Enhanced the UserProfileTask component by introducing a new TaskList subcomponent to reduce re-renders and improve performance. - Implemented memoization techniques to optimize task filtering and badge class name calculations. - Updated the useScrollPagination hook to handle item initialization and scrolling more efficiently, ensuring smoother user experience during pagination. * refactor(web): enhance user profile task component with virtualization and memoization - Introduced advanced memoization techniques for task filtering to optimize performance. - Implemented TanStack Virtual for efficient rendering of large task lists, improving responsiveness. - Updated the UserProfileTask component to support virtualization and dynamic task updates. - Added a new useMemoizedCache hook for better cache management in task filtering operations. * refactor(web): enhance task filtering and virtualization for improved performance - Optimized task filtering logic with intelligent caching and memoization techniques. - Implemented window-based virtualization for large task lists to enhance rendering performance. - Updated UserProfileTask and UserTeamCard components to support new virtualization features. - Enhanced useTaskVirtualization hook to automatically choose between container and window virtualization based on task count. * fix(web): update scrolling indicator styling in user profile tasks component - Adjusted the height property of the scrolling indicator for better visual consistency. - Maintained existing styles while enhancing the overall appearance in dark mode. * refactor(web): introduce constant for virtualization threshold in user team card - Added ITEMS_LENGTH_TO_VIRTUALIZED constant to define the threshold for enabling virtualization in task lists. - Updated UserTeamCard component to utilize the new constant for improved maintainability and clarity in virtualization logic. * fix(web): improve daily plans loading state handling and task filtering - Updated DailyPlanTaskInfoCell to adjust task info cell width for better layout. - Enhanced UserProfilePlans component to implement loading state logic, ensuring daily plans display correctly during data fetching. - Fixed synchronization issue in useDailyPlan hook by changing the dependency to prevent premature empty state. - Improved task filtering logic in useTaskFilter to correctly extract tasks from daily plans, enabling full functionality in the task filter system. * feat(web): enhance daily plan header with delete functionality and layout improvements - Integrated delete plan functionality into the PlanHeader component for better user experience. - Updated layout logic to conditionally display the delete button based on user permissions and plan mode. - Refactored task time calculations for improved readability and performance. - Enhanced task filtering and display logic in the FutureTasks and OutstandingFilterDate components to align with new header features. * refactor(web): optimize task rendering in OutstandingFilterDate component - Introduced useMemo and useCallback for improved performance in the OutstandingFilterDate component. - Created optimized style objects and rendering functions to reduce unnecessary re-renders. - Simplified task rendering logic by extracting it into a dedicated function, enhancing code readability and maintainability. - Adjusted styles in the SelectComponent for better layout consistency. * style(web): update task content width in daily plan components - Added taskContentClassName to AllPlans, FutureTasks, and PastTasks components to standardize task content width. - Enhanced layout consistency across daily plan components for improved user experience. * style(web): enhance layout consistency in daily plan components - Updated taskContentClassName in AllPlans, FutureTasks, and PastTasks components for standardized card width. - Improved layout consistency across daily plan components to enhance user experience. - Refactored UserTeamActivity component for better alignment and spacing in the activity display. * feat(web): implement virtualization for user tasks in UserWorkedTaskTab - Enhanced UserWorkedTaskTab component to support virtualization for improved performance with large task lists. - Introduced VirtualizedList component to handle rendering of tasks efficiently, reducing re-renders and optimizing memory usage. - Added logic to conditionally use virtualization based on task count, improving user experience during task navigation. - Updated task rendering logic to maintain layout consistency while leveraging virtualization features. * feat(web): enhance virtualization performance in UserWorkedTaskTab and VirtualizedList - Updated UserWorkedTaskTab to improve task rendering with a larger buffer size and enhanced scrolling indicator for better user experience. - Refactored VirtualizedList to utilize dynamic configuration for cache size and overscan multiplier, optimizing performance for varying list sizes. - Introduced adaptive buffer zones that respond to scroll speed, reducing white space and improving visual continuity during scrolling. - Preserved original spacing structure in rendered items to maintain layout consistency across components. * feat(web): implement shared virtualization cache and enhance VirtualizedList performance - Introduced a shared virtualization cache to improve performance across multiple instances of VirtualizedList, allowing for efficient data retrieval and rendering. - Enhanced VirtualizedList to support dynamic pagination for large datasets, optimizing rendering based on item count and scroll direction. - Implemented debounced cache warming and improved buffer zone calculations to reduce visual artifacts during scrolling. - Updated virtualization configuration to adaptively manage cache size and overscan multiplier, enhancing user experience with large lists. * feat(web): enhance task rendering and introduce lazy loading in UserWorkedTaskTab - Updated UserWorkedTaskTab to utilize LazyTaskCard for improved performance and reduced initial load time. - Implemented memoization techniques with useCallback and useMemo to optimize rendering and prevent unnecessary re-renders. - Added LazyUserWorkedTaskTab for dynamic import of user tasks, enhancing user experience with lazy loading. - Introduced TaskCardBlockSKeleton for consistent loading states across task components. - Refactored VirtualizedList to support flexible renderItem signatures, improving compatibility with various item rendering functions. * feat(web): add UserTeamActivity component with lazy loading and skeleton support - Introduced LazyUserTeamActivity for dynamic import, enhancing performance by reducing initial load time. - Added UserTeamActivitySkeleton for consistent loading states while the component is being fetched. - Updated UserTeamCard to utilize LazyUserTeamActivity, improving user experience with lazy loading. - Refactored imports in user-team-card-activity to streamline component usage. * feat(web): refactor component imports for optimized loading and performance - Added new optimized components for lazy loading, consolidating imports for better performance across various pages. - Replaced direct dynamic imports with centralized imports from optimized-components, enhancing code maintainability. - Introduced new Tabs component for improved tabbed navigation in UserTeamActivity, streamlining the user interface. - Updated package.json to include @radix-ui/react-tabs for tab functionality. * chore(deps): update @radix-ui/react-tabs to version 1.1.12 in yarn.lock * feat(web): refactor component imports for optimized loading and performance - Consolidated dynamic imports into centralized optimized components for improved performance across various pages. - Replaced direct dynamic imports with imports from optimized-components, enhancing code maintainability and reducing initial load times. - Updated multiple components including calendar, dashboard, kanban, reports, and settings to utilize the new optimized imports. - Improved user experience by ensuring consistent loading states through skeleton components. * style(web): enhance styling in daily plan components for improved layout - Updated AccordionContent styles in AllPlans, FutureTasks, OutstandingFilterDate, and PastTasks components to include consistent padding and background color. - Improved visual consistency across daily plan components, enhancing overall user experience. * fix: spelling errors * feat(web): refactor page-component for optimized lazy loading and component imports - Updated page-component to utilize lazy loading for various team-related components, enhancing performance and reducing initial load times. - Consolidated imports from optimized-components, improving code maintainability and ensuring consistent loading states with skeleton components. - Removed deprecated optimized-components file to streamline the codebase. * feat(web): enhance drag-and-drop functionality in OutstandingFilterDate component - Introduced local state management with useState and useEffect to handle drag-and-drop operations more effectively. - Updated rendering logic to utilize the new local state for improved performance and consistency. - Ensured that the accordion component only opens the first item, aligning behavior with other tabs for a better user experience. * feat(web): enhance shared virtualization cache with cleanup and error handling - Added a cleanup interval to manage expired cache entries and prevent memory leaks. - Implemented a destroy method to clear resources when no instances are left. - Introduced error handling during instance registration and unregistration to improve robustness. - Added cleanup on page unload to ensure proper resource management. * fix: bots suggestions * feat(web): introduce OptimizedTaskAccordion component for enhanced task display - Added OptimizedTaskAccordion to display tasks in an accordion format, showing the first five tasks directly and the remaining tasks in a collapsible section. - Implemented intelligent caching and virtualization for improved performance with large task lists. - Updated UserWorkedTaskTab to utilize the new OptimizedTaskAccordion for better organization of tasks. - Enhanced README documentation to include details about the new component and its features. * feat(web): implement optimized activity tabs for improved performance - Introduced new components for optimized activity tabs: OptimizedScreenshotsTab, OptimizedAppsTab, OptimizedVisitedSitesTab, and OptimizedTasksTab, leveraging intelligent caching to enhance performance during tab switches. - Updated UserTeamActivity to utilize the new optimized tabs, replacing legacy components for better organization and efficiency. - Created a custom hook, useOptimizedActivityTabs, to manage caching and data retrieval for tasks, screenshots, apps, and visited sites. - Enhanced caching strategies in use-time-daily-activity and use-time-slots hooks for improved data management and reduced recalculation on tab switches. * refactor(web): improve task filtering and caching mechanisms - Updated task filtering logic in UserProfileTask to enhance readability. - Modified useTaskFilterCache to utilize specific task types for better type safety. - Refactored useEnhancedVirtualization to prevent memory leaks by caching only data, not React components, and optimized cache cleanup to avoid infinite re-renders. - Introduced helper functions for cache management in useEnhancedVirtualization, improving performance and usability. * fix(web): update EmptyPlans logic to prevent display when active tasks are present - Enhanced EmptyPlans component to accept an optional title prop for custom messages. - Modified task list logic to prevent showing EmptyPlans when there are active tasks, improving user experience and reducing confusion in task-related tabs. * refactor(web): enhance virtualization and error handling in task components (#3970) - Updated OptimizedTaskAccordion to improve task rendering and virtualization performance. - Modified VirtualizedList to include safety checks for virtual items, preventing runtime errors. - Implemented better error handling and validation in useTanStackVirtual and useEnhancedVirtualization hooks to ensure robust performance with large datasets. - Adjusted virtualization settings to optimize rendering and scrolling behavior, enhancing user experience. * [Feature] Support invitation-based onboarding for users without a workspace (#3961) * Add all necessary keys for i18 * fix auth layout * add registration form for invitee without wrkspc * fix build issues * add invitation expired message card * add workspace not found message card * add for validation & form submit handler * show conditionally the message card or complete registration form * redirect user to home page or create new workspace * update the invite callback URL -> accept-invite * support validateByCode & validateByToken query keys for invitations api calls * update invite schamas * redirect user to home page after accepting the invite * update user schema * add accept invite skelethon * add conditionnally tenantId and organizationId to the body * update i18 keys for invitation registration form * update i18 files * set password input auto complete to 'off' * add user email in the payload when accepting the invite * add a workspace loader after accept invite was successfull * clean up the accept invite page component * add on success callback for accept invitation mutation * fix spelling errors * fix build issues * update invite schemas * build(deps): bump linkifyjs from 4.3.1 to 4.3.2 (#3967) Bumps [linkifyjs](https://github.com/nfrasser/linkifyjs/tree/HEAD/packages/linkifyjs) from 4.3.1 to 4.3.2. - [Release notes](https://github.com/nfrasser/linkifyjs/releases) - [Changelog](https://github.com/nfrasser/linkifyjs/blob/main/CHANGELOG.md) - [Commits](https://github.com/nfrasser/linkifyjs/commits/v4.3.2/packages/linkifyjs) --- updated-dependencies: - dependency-name: linkifyjs dependency-version: 4.3.2 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump form-data from 4.0.2 to 4.0.4 in /apps/mobile (#3968) Bumps [form-data](https://github.com/form-data/form-data) from 4.0.2 to 4.0.4. - [Release notes](https://github.com/form-data/form-data/releases) - [Changelog](https://github.com/form-data/form-data/blob/master/CHANGELOG.md) - [Commits](form-data/form-data@v4.0.2...v4.0.4) --- updated-dependencies: - dependency-name: form-data dependency-version: 4.0.4 dependency-type: indirect ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * [Fix bug] Fix UI update for subscribed components after task mutation (#3969) * fix(tasks): update UI after task mutation * return the cache data shape after computing new cache data * fix task estimate update after mutation * fix types * fix build isses * add ai bot suggestions --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Thierry CH. <thierrybakera12@gmail.com> Co-authored-by: Arick Bulakali <85836702+NdekoCode@users.noreply.github.com> Co-authored-by: NdekoCode <arickbulakali@gmail.com>
Implement export functionality on time and activity page
Implement complete export functionality for the Time and Activity page with support for PDF formats. This addresses the broken export system and adds proper permission handling, filter integration, and user feedback.
Type of change
How Has This Been Tested?
Checklist
Changes Made
Core Export System
Data Processing & Transformation
rapportDailyActivity
employees
andlogs
data structuresUser Interface Improvements
PDF Export Enhancements
Date Range Picker Improvements
Technical Improvements
Previous screenshots
Screen.Recording.2025-07-13.at.11.35.16.mov
The export functionality was broken:
Current screenshots
Screen.Recording.2025-07-22.at.12.13.14.mov
Export functionality now works completely:
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Enhancements
Chores