fix: reorder color conditions#2411
Conversation
❌ Deploy Preview for slidev failed.
|
@slidev/client
create-slidev
create-slidev-theme
@slidev/parser
@slidev/cli
@slidev/types
commit: |
There was a problem hiding this comment.
Pull request overview
This PR fixes a logic bug in the timer color status determination for both TimerBar.vue and TimerInlined.vue components. The issue was that timers exceeding 100% were incorrectly displayed in yellow instead of red because the warning threshold (> 80%) was checked before the overdue threshold (> 100%).
Key Changes:
- Reordered conditional checks to prioritize the overdue (red) state over the warning (yellow) state
- Ensures timers with percentage > 100 are always displayed as red, regardless of other thresholds
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
packages/client/internals/TimerInlined.vue |
Fixed color logic to check percentage > 100 before checking > 80, ensuring overdue timers display in red text |
packages/client/internals/TimerBar.vue |
Fixed color logic to check percentage > 100 before checking > 80, ensuring overdue timers display with red background |
After reviewing the changes, I found no issues with this pull request. The fix correctly addresses the bug by reordering the conditional checks so that the more critical condition (percentage > 100) is evaluated before the less critical condition (percentage > 80). This ensures timers that are overdue are always displayed in red as intended. The changes are consistent across both components and follow the same logic pattern.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This pull request updates the logic for determining the color status of timers in both the
TimerBar.vueandTimerInlined.vuecomponents. The main change is reordering the conditional checks so that the "overdue" (red) status takes precedence over the "warning" (yellow) status, ensuring that timers exceeding 100% are always shown as red.Timer color logic update:
colorcomputed property inTimerBar.vueso that timers with a percentage over 100 are assigned the "bg-red" class before checking for the "bg-yellow" warning state.colorcomputed property inTimerInlined.vueto apply the "text-red6 dark:text-red3" class when the percentage is over 100 before checking for the yellow warning state, matching the intended priority.