Skip to content

[Web]-Fix: Enhance progress bar color logic and improve task estimation handling #3962

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

Conversation

NdekoCode
Copy link
Collaborator

@NdekoCode NdekoCode commented Jul 28, 2025

[Web]-Fix: 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.

Screenshots

Previous screenshots

Screen.Recording.2025-07-28.at.15.38.50.mov

Current screenshots

Screen.Recording.2025-07-28.at.15.43.06.mov

Related Issues

ETP-62 [Bug]-Web Progress Bar Shows Green Color When No Estimation Data Exists

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

  • Style

    • Improved visual distinction for zero progress state in progress bars by displaying a neutral gray color.
    • Adjusted spacing in team notifications with added bottom margin for better layout.
  • Bug Fixes

    • Enhanced task statistics to handle cases with no estimation data, preventing division by zero and ensuring accurate percentage calculations.

…n 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.
@NdekoCode NdekoCode requested review from evereq and CREDO23 July 28, 2025 13:46
@NdekoCode NdekoCode self-assigned this Jul 28, 2025
@NdekoCode NdekoCode added the Improvement Improvement label Jul 28, 2025
Copy link
Contributor

coderabbitai bot commented Jul 28, 2025

Walkthrough

The changes introduce explicit handling for zero states in both UI and logic: a progress bar now displays a distinct color when progress is exactly zero, a task estimation hook prevents division by zero and clarifies behavior when no estimate exists, and a minor UI spacing adjustment is made to a team notifications component.

Changes

Cohort / File(s) Change Summary
Progress Bar Zero State
apps/web/core/components/duplicated-components/_progress-bar.tsx
Adds a conditional to return a neutral gray color for zero progress, differentiating it visually from low (but non-zero) progress.
Task Estimation Guard
apps/web/core/hooks/tasks/use-task-statistics.ts
Updates getEstimation to check for zero/undefined estimate, returning 0 early to prevent division by zero and clarify intent when no estimate is present.
UI Spacing Adjustment
apps/web/core/components/teams/team-outstanding-notifications.tsx
Adds a bottom margin class (mb-1) to the outer container for improved spacing, with no logic changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested labels

WEB, Ever Teams

Suggested reviewers

  • evereq

Poem

A rabbit hopped by the code today,
Saw zero progress, now it's gray!
No more dividing by zero's curse,
Spacing tweaks make things less terse.
With careful hops and gentle paws,
The code is better—applause, applause!
🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ETP-62-bug-web-progress-bar-shows-green-color-when-no-estimation-data-exists

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 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/_progress-bar.tsx
  • apps/web/core/hooks/tasks/use-task-statistics.ts

Please review these files and clean up the unused code.

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.

Greptile Summary

This PR fixes a visual bug where progress bars incorrectly displayed green color when no task estimation data existed, which misleadingly suggested task completion. The solution implements a three-part approach:

  1. Progress Bar Color Logic Enhancement: Modified the getProgressColor function in _progress-bar.tsx to add an explicit check for progress === 0, returning neutral gray colors (bg-gray-400 dark:bg-gray-500) instead of falling through to the default green state.

  2. Task Statistics Hook Update: Updated the getEstimation function in use-task-statistics.ts to return 0 when no estimation data is available (totalEstimate === 0), rather than attempting calculations that could result in undefined behavior or division by zero.

  3. Minor Layout Adjustment: Added mb-1 class to the TeamOutstandingNotifications component for improved spacing when the neutral state is displayed.

The changes work together to create a consistent neutral state throughout the application - when no estimation exists, the hook returns 0, which triggers the gray color in the progress bar, providing clear visual feedback that no estimation has been set rather than suggesting completion.

Confidence score: 5/5

• This PR is extremely safe to merge - it's a well-contained bug fix with clear logic and no side effects
• The changes are straightforward, well-tested locally, and address a specific UX issue with proper fallback handling
• All three files contain minimal, focused changes that work together cohesively without affecting other functionality

3 files reviewed, no comments

Edit Code 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: 1

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 161d5a2 and 715da74.

📒 Files selected for processing (3)
  • apps/web/core/components/duplicated-components/_progress-bar.tsx (1 hunks)
  • apps/web/core/components/teams/team-outstanding-notifications.tsx (1 hunks)
  • apps/web/core/hooks/tasks/use-task-statistics.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
apps/web/core/hooks/tasks/use-task-statistics.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/duplicated-components/_progress-bar.tsx (8)

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: #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: 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: syns2191
PR: #3549
File: apps/server-web/src/main/helpers/interfaces/i-constant.ts:14-17
Timestamp: 2025-01-26T17:29:05.825Z
Learning: In apps/server-web/src/main/helpers/interfaces/i-constant.ts, Linux platform uses the same styling as Windows in the CustomStyle type. No separate Linux-specific styling is needed in the PlatformStyle type.

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: NdekoCode
PR: #3199
File: apps/web/components/nav-main.tsx:74-90
Timestamp: 2024-10-28T17:28:53.268Z
Learning: In apps/web/components/nav-main.tsx, prefer to keep className styles inline instead of extracting repeated logic into shared classes.

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/teams/team-outstanding-notifications.tsx (8)

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/lib/layout/main-layout.tsx:63-63
Timestamp: 2024-10-25T14:59:25.183Z
Learning: In the ever-teams codebase, custom CSS classes may include unconventional or non-standard Tailwind CSS syntax, such as group-has-[[data-collapsible=icon]]/sidebar-wrapper:h-12, which are intentional and should not be flagged as issues.

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: syns2191
PR: #3409
File: apps/server-web/src/renderer/components/svgs/EverTeamsLogo.tsx:18-19
Timestamp: 2024-12-11T01:40:38.438Z
Learning: In the EverTeamsLogo component (apps/server-web/src/renderer/components/svgs/EverTeamsLogo.tsx), it's acceptable to have multiple elements with the same id attribute.

Learnt from: NdekoCode
PR: #3199
File: apps/web/components/nav-main.tsx:74-90
Timestamp: 2024-10-28T17:28:53.268Z
Learning: In apps/web/components/nav-main.tsx, prefer to keep className styles inline instead of extracting repeated logic into shared classes.

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: #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().

🪛 GitHub Actions: Knip Review - Cleanup Unused Code - WEB
apps/web/core/hooks/tasks/use-task-statistics.ts

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

apps/web/core/components/duplicated-components/_progress-bar.tsx

[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 (4)
apps/web/core/hooks/tasks/use-task-statistics.ts (2)

172-172: LGTM: Enhanced function signature with optional estimate parameter.

The addition of the estimate = 0 parameter provides flexibility for passing custom estimates while maintaining backward compatibility through the default value.


173-178: Excellent zero-state handling implementation.

The introduction of totalEstimate variable and early return for zero values provides clear defensive programming that:

  • Prevents division by zero errors
  • Establishes a clear neutral state (0) when no estimation data exists
  • Improves code readability by making the intent explicit

This aligns perfectly with the PR objective of fixing the progress bar color logic for cases with no estimation data.

apps/web/core/components/duplicated-components/_progress-bar.tsx (1)

6-7: Excellent addition of neutral state for zero progress.

The new condition if (progress === 0) return 'bg-gray-400 dark:bg-gray-500'; provides:

  • Clear visual distinction between zero progress and low progress
  • Appropriate neutral gray color that works in both light and dark themes
  • Better user experience by avoiding misleading red color for zero states

This change perfectly complements the task statistics hook changes that now return 0 for cases with no estimation data.

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

32-32: LGTM: Minor spacing improvement.

The addition of mb-1 class provides better visual spacing below the notifications container. This is a small but beneficial UI enhancement that improves the overall layout.

@evereq evereq merged commit 763e484 into develop Jul 29, 2025
14 of 16 checks passed
@evereq evereq deleted the ETP-62-bug-web-progress-bar-shows-green-color-when-no-estimation-data-exists branch July 29, 2025 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants