Skip to content

Conversation

NdekoCode
Copy link
Collaborator

@NdekoCode NdekoCode commented Jun 20, 2025

Fix invitation data render

  • Refactored TeamMembers, TeamMembersView, and related components to improve performance through memoization and optimized data handling.
  • Updated type definitions for better type safety, replacing IOrganizationTeamEmployee with TOrganizationTeamEmployee.
  • Improved sorting and filtering logic for team members, ensuring efficient rendering and data management.
  • Streamlined invitation handling in useTeamInvitations hook, integrating React Query for better state management and data fetching.
  • Refactored UserProfileTask to use memo for performance optimization.
  • Updated type definitions for better type safety, replacing IOrganizationTeamEmployee with TOrganizationTeamEmployee.
  • Refactored the logic for displaying empty messages based on the active filter in TeamMembersBlockView.
  • Improved code maintainability by consolidating message definitions into a single object.
  • Introduced useTimerButton hook to manage task timer functionality, including starting and stopping timers based on task status.
  • Updated class names and styles in TeamMembersView, UserTeamCardSkeleton, and UserInviteCard components for better layout and visual consistency.

Type of Change

  • Bug fix (fixes a problem)
  • New feature (adds functionality)
  • Breaking change (requires changes elsewhere)
  • Documentation update

✅ Checklist

Please confirm you did the following before asking for review:

  • My code follows the project coding style
  • I reviewed my own code and added comments where needed
  • I tested my changes locally
  • I updated or created related documentation if needed
  • No new warnings or errors are introduced

Summary by CodeRabbit

  • New Features

    • Introduced a new hook for managing timer functionality on task cards.
    • Added new type definitions for task cards and user invitation parameters.
  • Refactor

    • Optimized team invitation management by integrating React Query for data fetching and mutations.
    • Enhanced typing, memoization, and modularity across team member and task-related components.
    • Improved performance and code clarity in team member views and filtering logic.
  • Style

    • Standardized and reordered CSS class names for consistent styling and layout.
    • Updated component heights and spacing for better visual alignment.
  • Bug Fixes

    • Improved error messaging when attempting to start a timer on closed tasks.
    • Enhanced safety when handling potentially undefined invitation emails.
  • Chores

    • Updated and expanded TypeScript interfaces for improved type safety and clarity.

- Refactored `TeamMembers`, `TeamMembersView`, and related components to improve performance through memoization and optimized data handling.
- Updated type definitions for better type safety, replacing `IOrganizationTeamEmployee` with `TOrganizationTeamEmployee`.
- Improved sorting and filtering logic for team members, ensuring efficient rendering and data management.
- Enhanced UI components with consistent styling and improved accessibility.
- Streamlined invitation handling in `useTeamInvitations` hook, integrating React Query for better state management and data fetching.
- Added new types for user invitations to enhance security and performance.
- Refactored `UserProfileTask` to use `memo` for performance optimization.
- Updated `TaskCard` to utilize `activeTeamState` for improved data handling and added memoization for `isTrackingEnabled`.
- Enhanced component structure and styling for better readability and consistency.
- Adjusted class names for improved layout and alignment across various elements.
- Refactored the logic for displaying empty messages based on the active filter in `TeamMembersBlockView`.
- Replaced the switch statement with a memoized object to enhance readability and performance.
- Improved code maintainability by consolidating message definitions into a single object.
- Introduced `useTimerButton` hook to manage task timer functionality, including starting and stopping timers based on task status.
- Implemented loading state management and active task status tracking.
- Enhanced team member updates when a timer is started, ensuring accurate task assignment and organization data handling.
- Created new type definitions for task card interfaces to improve type safety and component integration.
- Updated class names and styles in `TeamMembersView`, `UserTeamCardSkeleton`, and `UserInviteCard` components for better layout and visual consistency.
- Simplified flexbox properties to enhance alignment and spacing across various elements.
- Adjusted padding and margin values to improve overall component appearance and responsiveness.
- Updated height classes from `h-[50px]` to `h-12` for consistency in `InputField`, `TimesheetSkeleton`, and other components.
- Adjusted flexbox properties and class names in `TeamsDropDown`, `UserTeamCard`, and `TaskItem` for improved alignment and spacing.
- Enhanced overall component styling for better visual coherence and responsiveness.
…performance

- Replaced `TeamMember` interface with `TOrganizationTeamEmployee` for better type consistency across `TeamMembers` and related components.
- Optimized sorting and filtering functions to utilize the new type, enhancing performance and readability.
- Removed unused import of `useOrganizationTeams` in `task-card.tsx` to streamline dependencies.
@NdekoCode NdekoCode self-assigned this Jun 20, 2025
Copy link
Contributor

coderabbitai bot commented Jun 20, 2025

Walkthrough

This set of changes primarily focuses on UI consistency, type safety, and performance optimizations. It standardizes Tailwind CSS class ordering and sizing across various components, introduces improved TypeScript typings, and memoizes several React components for better rendering efficiency. Some data-fetching and mutation logic is refactored to use React Query for improved state management.

Changes

Files/Groups Change Summary
apps/web/app/[locale]/page-component.tsx, apps/web/core/components/..., ... (multiple UI files) Reordered Tailwind CSS utility classes for flex, spacing, and alignment; replaced fixed heights (h-[50px]) with h-12 for consistent sizing in inputs, buttons, avatars, and containers. Minor padding, margin, and gap adjustments for layout consistency.
apps/web/core/components/pages/teams/team/team-members.tsx Refactored TeamMembers and TeamMembersView components: introduced TypeScript interfaces for props, consolidated filtering and sorting logic with useMemo, replaced useCallback hooks, memoized components, and introduced a configuration-driven view rendering approach. Improved modularity and reduced unnecessary re-renders.
apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx Wrapped component in React.memo, changed prop types to specific schema types, simplified empty message logic with a memoized lookup, updated JSX for minor class order and element changes.
apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx Memoized component, updated prop types for stronger typing, removed local state for member ordering, updated drag-and-drop logic to operate on props, and adjusted layout structure for flexbox and spacing.
apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx Memoized component, updated prop types to use TOrganizationTeamEmployee, improved column typing, and adjusted memoization dependencies.
apps/web/core/components/pages/profile/user-profile-tasks.tsx, team-members-header.tsx, ... Memoized UserProfileTask component, reordered class names for layout consistency, updated some height and gap values.
apps/web/core/components/tasks/task-card.tsx Replaced useOrganizationTeams with activeTeamState and useAuthenticateUser for team/user data; memoized isTrackingEnabled, added explicit toast error for timer on closed tasks, reordered class names, and simplified member assignment logic.
apps/web/core/hooks/organizations/teams/use-team-invitations.ts Refactored hook to use React Query for fetching and mutating team invitations, replaced Jotai state and manual cache invalidation, improved parameter memoization, and removed internal toast error handling.
apps/web/core/hooks/tasks/use-timer-button.ts Added new hook useTimerButton to encapsulate timer logic for tasks, including loading state, timer control, and updating team employee data.
apps/web/core/types/interfaces/task/task-card.ts Added new TypeScript types and interfaces for task card props and filtering, improving type safety and clarity.
apps/web/core/types/interfaces/user/invite.ts Added InviteUserParams and TeamInvitationsQueryParams interfaces for more specific typing of invite-related parameters.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TeamMembers
    participant TeamMembersView
    participant ViewComponent (Cards/Blocks/Table)
    User->>TeamMembers: Render with props
    TeamMembers->>TeamMembersView: Pass filtered/sorted members, view type
    TeamMembersView->>ViewComponent: Render selected view with members
Loading
sequenceDiagram
    participant Component
    participant useTeamInvitations
    participant ReactQuery
    participant JotaiState

    Component->>useTeamInvitations: Call hook
    useTeamInvitations->>ReactQuery: Fetch invitations (tenant/org/team)
    ReactQuery-->>useTeamInvitations: Return data
    useTeamInvitations->>JotaiState: Sync invitations for backward compatibility
    useTeamInvitations-->>Component: Return data, mutation functions
    Component->>useTeamInvitations: Call mutation (invite/remove/resend)
    useTeamInvitations->>ReactQuery: Mutate and invalidate queries
Loading

Possibly related PRs

  • ever-co/ever-teams#3374: Also modifies the TaskInput component's styling and class order, directly relating to similar UI consistency changes in this PR.
  • ever-co/ever-teams#3693: Refactors and memoizes TeamMembers and TeamMembersView components, closely related to the current PR's optimizations and memoization of the same components.

Suggested labels

UI/UX, WEB, Improvement, Ever Teams

Suggested reviewers

  • evereq
  • Innocent-Akim
  • CREDO23

Poem

A rabbit hopped through fields of code,
Tidying classes, lightening the load.
Memoized views, types shining bright,
Tailwind in order, everything right.
With React Query, invites now flow—
Oh, what a garden for teamwork to grow!
🐇✨

Warning

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

🔧 ESLint

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

yarn install v1.22.22
[1/4] Resolving packages...
(node:18592) [DEP0169] DeprecationWarning: url.parse() behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for url.parse() vulnerabilities.
(Use node --trace-deprecation ... to show where the warning was created)
error Couldn't find package "@ever-teams/eslint-config@" required by "@ever-teams/types@" on the "npm" registry.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between ad9f1e7 and 57f10b1.

📒 Files selected for processing (8)
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members.tsx (2 hunks)
  • apps/web/core/components/tasks/kanban.tsx (6 hunks)
  • apps/web/core/components/tasks/task-card.tsx (17 hunks)
  • apps/web/core/hooks/tasks/use-timer-button.ts (1 hunks)
  • apps/web/core/types/interfaces/task/task-card.ts (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • apps/web/core/components/tasks/kanban.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx
  • apps/web/core/hooks/tasks/use-timer-button.ts
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx
  • apps/web/core/types/interfaces/task/task-card.ts
  • apps/web/core/components/tasks/task-card.tsx
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: deploy
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (5)
apps/web/core/components/pages/teams/team/team-members.tsx (5)

37-60: Excellent refactoring of constants and utility functions.

The extraction of constants and utility functions outside the component is a great performance optimization. The TIMER_STATUS_PRIORITY mapping with numeric values provides clear sorting logic, and the as const assertion ensures type safety.


62-119: Well-implemented performance optimizations.

The component refactoring with memoization and consolidated data processing is excellent. The processedMembers useMemo efficiently handles filtering, sorting, and current user identification in a single pass, while blockViewMembers provides optimized filtering for block view.


146-213: Excellent configuration-based refactoring.

The TeamMembersView component refactoring with configuration-based view selection is well-implemented. The approach eliminates code duplication, provides proper fallbacks, and handles transitions conditionally based on configuration. The memoization and early returns optimize performance effectively.


215-215: Good practice adding displayName for debugging.

Adding displayName to memoized components is excellent for debugging and development tools.


17-17: Verify the correctness of TaskCardProps import.

The TaskCardProps import appears to be task-related, but this component handles team members. This type might be incorrect for the view component configuration.

#!/bin/bash
# Description: Verify if TaskCardProps is the correct type for team member view components
# Expected: Find the actual prop types used by TeamMembersCardView, TeamMembersTableView, and TeamMembersBlockView

echo "Checking prop types for team member view components..."

# Check TeamMembersCardView props
ast-grep --pattern 'interface $_ {
  $$$
}' apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx

# Check TeamMembersTableView props  
ast-grep --pattern 'interface $_ {
  $$$
}' apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx

# Check TeamMembersBlockView props
ast-grep --pattern 'interface $_ {
  $$$
}' apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx

# Also check what TaskCardProps contains
ast-grep --pattern 'interface TaskCardProps {
  $$$
}' apps/web/core/types/interfaces/task/task-card.ts
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate Unit Tests
  • Create PR with Unit Tests
  • Post Copyable Unit Tests in Comment
  • Commit Unit Tests in branch fix/invitation-data-render

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai auto-generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

⚠️ Unused code detected in the following changed files:

  • apps/web/core/components/duplicated-components/_input.tsx
  • apps/web/core/components/pages/timesheet/table-time-sheet.tsx
  • apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx
  • apps/web/core/components/tasks/task-card.tsx
  • apps/web/core/components/teams/invite/user-invite-card.tsx
  • apps/web/core/hooks/tasks/use-timer-button.ts
  • apps/web/core/types/interfaces/task/task-card.ts
  • apps/web/core/types/interfaces/user/invite.ts

Please review these files and clean up the unused code.

@NdekoCode NdekoCode marked this pull request as ready for review June 20, 2025 06:27
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Major refactoring of team members and invitation handling components with focus on performance optimization and type safety improvements.

  • Introduced new useTimerButton hook in core/hooks/tasks/use-timer-button.ts for centralized timer management, though it needs improvements in error handling and setTimeout usage
  • Improved invitation handling with new interfaces in core/types/interfaces/user/invite.ts and better React Query integration in useTeamInvitations hook
  • Fixed critical TypeScript configuration issue in tsconfig.json where a file extension was incorrectly specified as '.tx' instead of '.ts'
  • Standardized component heights across the application from arbitrary h-[50px] to Tailwind's h-12 for better design system consistency
  • Added proper TypeScript interface definitions in new task-card.ts for stronger type safety in task card components

25 files reviewed, 24 comments
Edit PR Review Bot Settings | Greptile

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (4)
apps/web/core/hooks/tasks/use-timer-button.ts (2)

1-1: Fix the incorrect file path in comment.

The comment shows core/hooks/task-card/useTimerButton.ts but the actual file path is core/hooks/tasks/use-timer-button.ts.

-// core/hooks/task-card/useTimerButton.ts
+// core/hooks/tasks/use-timer-button.ts

47-47: Explain the magic number timeout.

The 100ms timeout needs explanation for why this delay is necessary.

-	setTimeout(startTimer, 100);
+	// Small delay to ensure state updates are processed before starting timer
+	setTimeout(startTimer, 100);
apps/web/core/hooks/organizations/teams/use-team-invitations.ts (1)

91-118: Consider adding error handling for mutations

While the optimistic updates are good, consider adding onError handlers to revert changes when mutations fail:

 const inviteUserMutation = useMutation({
   mutationFn: async (params: InviteUserParams) => {
     return await inviteService.inviteByEmails(
       {
         email: params.email,
         name: params.name,
         organizationId: params.organizationId,
         teamId: params.teamId
       },
       params.tenantId
     );
   },
   onSuccess: (data) => {
     // Optimistic update of the cache
     const items = data.items || [];
     setTeamInvitations((prev) => [...prev, ...items]);

     // Invalidation of the cache for refetch
     queryClient.invalidateQueries({
       queryKey: queryKeys.users.invitations.team(
         user?.tenantId || '',
         user?.employee?.organizationId || '',
         activeTeamId || ''
       )
     });
-  }
+  },
+  onError: (error) => {
+    toast.error('Failed to send invitation', {
+      description: error.message
+    });
+    // Consider reverting optimistic updates if needed
+  }
 });

Also applies to: 120-154

apps/web/core/components/pages/teams/team/team-members.tsx (1)

48-52: Minor optimization: Remove redundant nullish coalescing

The ?? 0 fallback is redundant since undefined is already mapped to 0 in TIMER_STATUS_PRIORITY.

-const sortByWorkStatus = (a: TOrganizationTeamEmployee, b: TOrganizationTeamEmployee): number => {
-	const priorityA = TIMER_STATUS_PRIORITY[a.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] ?? 0;
-	const priorityB = TIMER_STATUS_PRIORITY[b.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] ?? 0;
-	return priorityB - priorityA;
-};
+const sortByWorkStatus = (a: TOrganizationTeamEmployee, b: TOrganizationTeamEmployee): number => {
+	const priorityA = TIMER_STATUS_PRIORITY[a.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] || 0;
+	const priorityB = TIMER_STATUS_PRIORITY[b.timerStatus as keyof typeof TIMER_STATUS_PRIORITY] || 0;
+	return priorityB - priorityA;
+};
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between dcd46a0 and ad9f1e7.

📒 Files selected for processing (26)
  • apps/web/app/[locale]/page-component.tsx (2 hunks)
  • apps/web/core/components/activities/timesheet-skeleton.tsx (1 hunks)
  • apps/web/core/components/duplicated-components/_input.tsx (6 hunks)
  • apps/web/core/components/duplicated-components/teams-dropdown.tsx (7 hunks)
  • apps/web/core/components/features/daily-plan/add-task-estimation-hours-modal.tsx (1 hunks)
  • apps/web/core/components/pages/profile/user-profile-tasks.tsx (4 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/team-members-header.tsx (4 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/user-team-card/index.tsx (7 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/user-team-card/user-info.tsx (2 hunks)
  • apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx (1 hunks)
  • apps/web/core/components/pages/teams/team/team-members.tsx (2 hunks)
  • apps/web/core/components/pages/timesheet/table-time-sheet.tsx (1 hunks)
  • apps/web/core/components/pages/timesheet/timesheet-card.tsx (1 hunks)
  • apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx (4 hunks)
  • apps/web/core/components/tasks/task-card.tsx (16 hunks)
  • apps/web/core/components/tasks/task-input.tsx (6 hunks)
  • apps/web/core/components/tasks/task-items.tsx (6 hunks)
  • apps/web/core/components/teams/invite/user-invite-card.tsx (9 hunks)
  • apps/web/core/components/teams/team-outstanding-notifications.tsx (4 hunks)
  • apps/web/core/hooks/organizations/teams/use-team-invitations.ts (2 hunks)
  • apps/web/core/hooks/tasks/use-timer-button.ts (1 hunks)
  • apps/web/core/types/interfaces/task/task-card.ts (1 hunks)
  • apps/web/core/types/interfaces/user/invite.ts (1 hunks)
  • apps/web/tsconfig.json (1 hunks)
🧰 Additional context used
🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/components/pages/timesheet/table-time-sheet.tsx

[error] 1-1: Unused code detected in this file.

apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx

[error] 1-1: Unused code detected in this file.

apps/web/core/types/interfaces/user/invite.ts

[error] 1-1: Unused code detected in this file.

apps/web/core/hooks/tasks/use-timer-button.ts

[error] 1-1: Unused code detected in this file.

apps/web/core/components/duplicated-components/_input.tsx

[error] 1-1: Unused code detected in this file.

apps/web/core/components/teams/invite/user-invite-card.tsx

[error] 1-1: Unused code detected in this file.

apps/web/core/types/interfaces/task/task-card.ts

[error] 1-1: Unused code detected in this file.

apps/web/core/components/tasks/task-card.tsx

[error] 1-1: Unused code detected in this file.

🪛 Biome (1.9.4)
apps/web/core/components/tasks/task-card.tsx

[error] 98-100: 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 (1)
  • GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (43)
apps/web/core/components/features/daily-plan/add-task-estimation-hours-modal.tsx (1)

708-708: LGTM! Good consistency improvement.

Replacing the arbitrary height value with Tailwind's standard utility class improves consistency across the codebase.

apps/web/app/[locale]/page-component.tsx (1)

73-73: LGTM! CSS class ordering improvement.

The reordering of Tailwind CSS classes enhances code consistency and maintainability without affecting functionality.

Also applies to: 79-79

apps/web/core/components/tasks/task-items.tsx (1)

51-51: LGTM! Consistent CSS class ordering.

The reordering of CSS classes throughout the component improves code consistency and readability without affecting functionality.

Also applies to: 76-76, 101-101, 145-145, 153-153, 168-169, 192-192

apps/web/core/components/teams/team-outstanding-notifications.tsx (1)

26-26: LGTM! Improved spacing and CSS consistency.

The spacing adjustments and CSS class reordering enhance the visual layout and maintain consistency with the broader styling improvements across the codebase.

Also applies to: 87-87, 95-95, 99-99, 194-194, 210-210

apps/web/core/components/duplicated-components/_input.tsx (3)

129-129: Note the height reduction from 50px to 44px.

The change from h-[50px] to h-11 reduces the input height by 6 pixels (50px → 44px). Ensure this height reduction aligns with your design system and doesn't negatively impact usability.


150-158: Class reordering improves consistency.

The Tailwind class reordering follows a consistent pattern and improves readability without affecting functionality.


219-226: TimeInputField styling improvements look good.

The class adjustments maintain the component's functionality while improving styling consistency.

apps/web/core/components/pages/timesheet/timesheet-card.tsx (1)

124-124: Height standardization aligns with design system.

The change from h-[50px] to h-12 (48px) maintains the accordion trigger's visual consistency while standardizing component heights across the application.

apps/web/core/components/activities/timesheet-skeleton.tsx (1)

10-10: Skeleton height standardization maintains consistency.

The height change from h-[50px] to h-12 aligns the skeleton component with the standardized height system being implemented across the application.

apps/web/core/components/pages/timesheet/table-time-sheet.tsx (1)

192-192: AccordionTrigger height standardization improves consistency.

The change from h-[50px] to h-12 standardizes the accordion trigger height with other timesheet components, maintaining visual consistency across the application.

apps/web/core/components/pages/teams/team/team-members-views/user-team-card/user-info.tsx (1)

43-43: Avatar container height standardization with aspect ratio consideration.

The height changes from h-[50px] to h-12 (48px) standardize the component height while maintaining the 50px width. This creates a 50px × 48px container instead of square 50px × 50px. The minimal aspect ratio change should not significantly impact the avatar display.

Also applies to: 55-55

apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx (2)

104-104: LGTM! Consistent height class standardization.

The replacement of h-[50px] with h-12 improves consistency with Tailwind's spacing scale. Note that h-12 equals 48px, which is a 2px reduction from the previous 50px height. This should be intentional for better visual harmony.

Also applies to: 144-144, 275-275, 321-321


1-1: I’ll verify each imported symbol’s actual usage (excluding its import statement):

#!/bin/bash
FILE="apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx"
symbols=(
  Modal statusColor AnimatedEmptyState TimesheetCardDetail
  TranslationHooks useTranslations TimesheetDetailMode
  Accordion AccordionContent AccordionItem AccordionTrigger
  cn useTimesheet Badge EmployeeAvatar ProjectLogo
  groupBy TaskNameInfoDisplay TotalTimeDisplay ITimeLog
)

for sym in "${symbols[@]}"; do
  echo "=== $sym ==="
  # Find all occurrences except the import line
  grep -n "$sym" "$FILE" | grep -v "^1:" || echo "No usage beyond import"
done
apps/web/core/components/pages/teams/team/team-members-views/user-team-card/index.tsx (2)

111-111: Verify the spacing change from space-x-2 to gap-1.

The change from space-x-2 (8px horizontal spacing) to gap-1 (4px gap) alters both the spacing amount and behavior. Ensure this change maintains the intended visual layout.


172-172: LGTM! CSS class reordering for consistency.

The reordering of CSS classes improves code consistency without affecting the visual output or functionality.

Also applies to: 208-208, 215-215, 257-257, 278-278, 297-297, 311-311, 316-316

apps/web/core/components/pages/teams/team/team-members-views/user-team-table/team-members-table-view.tsx (3)

10-11: LGTM! Improved imports for type safety and performance.

Adding TOrganizationTeamEmployee and memo imports supports the component's type safety and performance optimizations.


13-24: Excellent type safety and performance improvements.

Wrapping the component with React.memo prevents unnecessary re-renders, and replacing any types with TOrganizationTeamEmployee provides better type safety and developer experience.


27-68: LGTM! Column definitions properly memoized.

The useMemo for columns with an empty dependency array is appropriate since the column structure is static. This prevents recreating the columns array on every render.

apps/web/core/types/interfaces/user/invite.ts (3)

69-72: LGTM! Enhanced type safety for user invitations.

The InviteUserParams interface properly extends IInviteRequest with the required tenantId field, improving security and multi-tenancy support.


74-79: LGTM! Well-structured interface for team invitation queries.

The TeamInvitationsQueryParams interface provides clear typing for team invitation query parameters with all necessary fields.


1-1: Address the pipeline failure regarding unused interfaces.

The Knip analysis detected unused code. Verify that the new interfaces InviteUserParams and TeamInvitationsQueryParams are properly imported and used in the codebase.

#!/bin/bash
# Description: Check usage of the new interfaces in the codebase
# Expected: Find references to InviteUserParams and TeamInvitationsQueryParams

echo "Checking usage of InviteUserParams:"
rg -A 3 "InviteUserParams" --type ts

echo -e "\nChecking usage of TeamInvitationsQueryParams:"
rg -A 3 "TeamInvitationsQueryParams" --type ts
apps/web/core/components/pages/profile/user-profile-tasks.tsx (3)

6-6: LGTM! Added memo import for performance optimization.

Including memo in the React imports enables the component memoization for better performance.


25-25: Excellent performance optimization with React.memo.

Converting the component to use React.memo prevents unnecessary re-renders when props haven't changed, improving performance. The component interface and functionality remain unchanged.

Also applies to: 138-138


59-59: LGTM! CSS class reordering for consistency.

The minor reordering of CSS classes improves code consistency without affecting the visual output.

Also applies to: 64-64

apps/web/core/hooks/tasks/use-timer-button.ts (1)

1-60: ```shell
#!/bin/bash

Description: Search for imports and invocations of useTimerButton across .ts and .tsx files

echo "Searching for useTimerButton imports and usages..."
rg -n "useTimerButton" --glob ".ts" --glob ".tsx"


</details>
<details>
<summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-header.tsx (1)</summary>

`8-49`: **LGTM! Styling improvements enhance consistency.**

The CSS class reorderings and height adjustments improve code consistency and follow Tailwind CSS best practices. The changes from fixed heights to Tailwind height utilities (`h-12`) are particularly good for maintainability.

</details>
<details>
<summary>apps/web/core/components/duplicated-components/teams-dropdown.tsx (2)</summary>

`10-10`: **Good addition of clsxm utility.**

Adding the `clsxm` utility import enables better conditional className handling and is used appropriately in the component.

---

`21-95`: **LGTM! Consistent styling improvements.**

The CSS class reorderings, height standardization to Tailwind utilities, and proper use of `clsxm` for conditional classes improve code maintainability and consistency.

</details>
<details>
<summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-block-view.tsx (3)</summary>

`17-17`: **Excellent use of React.memo for performance optimization.**

Converting the component to use `React.memo` will prevent unnecessary re-renders when props haven't changed, improving performance.

---

`8-13`: **Good type consistency improvement.**

Updating from generic interface types to the specific `TOrganizationTeamEmployee` schema type improves type safety and consistency across the codebase.

---

`21-30`: **Clean refactor of empty message logic.**

The refactor from a switch statement to a memoized object lookup is more readable and maintainable. The memoization prevents unnecessary re-creation of the object on each render.

</details>
<details>
<summary>apps/web/core/components/teams/invite/user-invite-card.tsx (3)</summary>

`205-205`: **Excellent safety improvement for email handling.**

Adding null coalescing (`invitation.email ?? ''`) prevents potential runtime errors if the email property is undefined. This is a good defensive programming practice.

---

`30-248`: **LGTM! Consistent styling improvements.**

The CSS class reorderings, padding adjustments, and layout refinements improve visual consistency and code maintainability while preserving functionality.

---

`1-275`: ```shell
#!/bin/bash
# Re-run usage search without file type filters
echo "Searching for InvitedCard usages..."
rg -w "InvitedCard" -A2 --glob "*.ts*" .

echo "Searching for RemoveUserInviteMenu usages..."
rg -w "RemoveUserInviteMenu" -A2 --glob "*.ts*" .

echo "Searching for InviteUserTeamCard usages..."
rg -w "InviteUserTeamCard" -A2 --glob "*.ts*" .
apps/web/core/types/interfaces/task/task-card.ts (1)

1-39: ```shell
#!/bin/bash
echo "Searching for imports of FilterTabs, TaskCardGlobal, TaskCardProps in .ts/.tsx files..."
rg -g '.ts' -g '.tsx' "import.{.(FilterTabs|TaskCardGlobal|TaskCardProps).*from.*task-card"

echo -e "\nSearching for any usage of FilterTabs outside task-card.ts..."
rg -g '.ts' -g '.tsx' "FilterTabs" --glob '!apps/web/core/types/interfaces/task/task-card.ts'

echo -e "\nSearching for any usage of TaskCardGlobal outside task-card.ts..."
rg -g '.ts' -g '.tsx' "TaskCardGlobal" --glob '!apps/web/core/types/interfaces/task/task-card.ts'

echo -e "\nSearching for any usage of TaskCardProps outside task-card.ts..."
rg -g '.ts' -g '.tsx' "TaskCardProps" --glob '!apps/web/core/types/interfaces/task/task-card.ts'


</details>
<details>
<summary>apps/web/core/components/pages/teams/team/team-members-views/team-members-card-view.tsx (1)</summary>

`17-18`: **Good performance optimization with React.memo**

The addition of `React.memo` wrapper is a good optimization that will prevent unnecessary re-renders when props haven't changed.

</details>
<details>
<summary>apps/web/core/components/tasks/task-input.tsx (1)</summary>

`346-346`: **CSS class reordering for consistency**

These changes are purely cosmetic, reordering Tailwind CSS classes for better consistency across the codebase.




Also applies to: 519-519, 670-670, 753-755, 793-793, 836-836, 851-851, 859-859, 867-867, 886-886, 917-918, 940-941

</details>
<details>
<summary>apps/web/core/components/tasks/task-card.tsx (1)</summary>

`1-949`: ```bash
#!/usr/bin/env bash
set -e

file="apps/web/core/components/tasks/task-card.tsx"

# Extract exported function and component names
exports=$(grep -E '^export (function|const|class) ' "$file" \
  | sed -E 's/export (function|const|class) ([^ (:{]+).*/\2/')

if [[ -z "$exports" ]]; then
  echo "No exports found in $file."
  exit 0
fi

echo "Exports in $file:"
echo "$exports"
echo

# Search for each export across the codebase (excluding the file itself)
for name in $exports; do
  echo "References to '$name':"
  grep -R -n --include=\*.{ts,tsx} --exclude="$file" -e "\b$name\b" .
  echo
done
apps/web/core/hooks/organizations/teams/use-team-invitations.ts (2)

21-301: Excellent refactoring to React Query

This refactoring significantly improves data fetching patterns by:

  • Leveraging React Query's caching and synchronization
  • Implementing proper optimistic updates
  • Maintaining backward compatibility with Jotai state

The migration is well-structured and follows React Query best practices.


29-29: We need to broaden our search to include both .ts and .tsx files without relying on ripgrep’s predefined types. Let’s retry with glob patterns:

#!/bin/bash
set -eo pipefail

echo "Checking where activeTeamId cookie is set:"
rg "setActiveTeamIdCookie" --glob "*.{ts,tsx}"

echo -e "\nChecking other usages of getActiveTeamIdCookie:"
rg "getActiveTeamIdCookie" --glob "*.{ts,tsx}"

echo -e "\nChecking team switching logic:"
rg "switchTeam|changeTeam|selectTeam" -A5 --glob "*.{ts,tsx}"
apps/web/core/components/pages/teams/team/team-members.tsx (3)

11-34: Excellent type safety improvements!

The addition of TeamMembersProps and TeamMembersViewProps interfaces significantly improves type safety and makes the component contracts more explicit. Using TOrganizationTeamEmployee instead of a generic interface is also a good practice.


69-101: Excellent performance optimizations!

The memoization strategy is well-thought-out:

  • Processing members in a single pass with filtering, sorting, and current user identification
  • Efficient filter conditions for block view members
  • Proper dependency arrays for useMemo hooks

The comment about avoiding "useless memoization" for isTeamsFetching shows good judgment about when memoization is actually beneficial.


145-214: Clean and maintainable implementation!

The refactored TeamMembersView component demonstrates several best practices:

  • Proper memoization of filtered members
  • Configuration-based rendering eliminates switch statements
  • Good defensive programming with fallback to CARDS view
  • Clean separation of concerns between view selection and rendering
  • Setting displayName for better debugging experience

Copy link
Contributor

@Innocent-Akim Innocent-Akim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please check the suggestions made by the AI? @NdekoCode

Copy link

⚠️ Unused code detected in the following changed files:

  • apps/web/core/components/duplicated-components/_input.tsx
  • apps/web/core/components/pages/timesheet/table-time-sheet.tsx
  • apps/web/core/components/pages/timesheet/timesheet-detail-modal.tsx
  • apps/web/core/components/tasks/kanban.tsx
  • apps/web/core/components/tasks/task-card.tsx
  • apps/web/core/components/teams/invite/user-invite-card.tsx
  • apps/web/core/hooks/tasks/use-timer-button.ts
  • apps/web/core/types/interfaces/task/task-card.ts
  • apps/web/core/types/interfaces/user/invite.ts

Please review these files and clean up the unused code.

@NdekoCode NdekoCode requested a review from Innocent-Akim June 20, 2025 07:31
@Innocent-Akim Innocent-Akim self-requested a review June 20, 2025 08:14
@NdekoCode NdekoCode merged commit 162e0e4 into develop Jun 20, 2025
14 of 16 checks passed
@NdekoCode NdekoCode deleted the fix/invitation-data-render branch June 20, 2025 10:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants