Add "Mark All as Done" button to Daily Task Reminders#60
Conversation
|
@jyoti430 is attempting to deploy a commit to the karan3431's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
🎉 Thanks for your contribution, @jyoti430! Please make sure CI passes and the checklist in the PR template is complete. A maintainer will review this soon. — The AgroNavis team |
📝 WalkthroughWalkthrough
ChangesMark All as Done in DailyTaskReminders
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
frontend/src/components/DailyTaskReminders.tsx (1)
90-95: ⚡ Quick winDerive “all done” state from
TASKSto avoid future drift.Line 91 hardcodes task keys, which can silently desync from
TASKSwhen a new daily task is added. Build the next state fromTASKSso bulk-complete always matches the rendered checklist.Suggested refactor
const markAllAsDone = () => { - setTaskState({ - water: true, - fertilize: true, - harvest: true, - }); -}; + setTaskState( + TASKS.reduce((acc, task) => { + acc[task.id] = true; + return acc; + }, {} as TaskState) + ); + };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@frontend/src/components/DailyTaskReminders.tsx` around lines 90 - 95, The markAllAsDone function hardcodes task keys (water, fertilize, harvest) directly in the setTaskState call, which can become out of sync when new tasks are added to the TASKS constant. Refactor the function to dynamically build the state object by iterating over the TASKS constant and mapping each task to true, ensuring the bulk-complete action always matches the rendered checklist regardless of future task additions.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/components/DailyTaskReminders.tsx`:
- Around line 114-120: The hardcoded English strings "Mark All as Done", "Done",
and "Today" in the DailyTaskReminders.tsx component are not localized. Wrap each
of these string literals with the t() localization function to match the
existing localization pattern used elsewhere in the component. Apply t() to the
button text content, the conditional string in the span element showing 'Done'
or 'Today', and any other user-facing text in the affected code block.
---
Nitpick comments:
In `@frontend/src/components/DailyTaskReminders.tsx`:
- Around line 90-95: The markAllAsDone function hardcodes task keys (water,
fertilize, harvest) directly in the setTaskState call, which can become out of
sync when new tasks are added to the TASKS constant. Refactor the function to
dynamically build the state object by iterating over the TASKS constant and
mapping each task to true, ensuring the bulk-complete action always matches the
rendered checklist regardless of future task additions.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 8beca20a-ef85-4657-80cb-669af99bf55a
📒 Files selected for processing (1)
frontend/src/components/DailyTaskReminders.tsx
| Mark All as Done | ||
| </button> | ||
| )} | ||
|
|
||
| <span className={`${s.taskStatusBadge} ${allComplete ? s.taskStatusBadgeDone : ''}`}> | ||
| {allComplete ? 'Done' : 'Today'} | ||
| </span> |
There was a problem hiding this comment.
Localize newly surfaced header labels.
Lines 114–120 use hardcoded English UI text ("Mark All as Done", "Done", "Today") even though this component already uses t(...). This creates a localization gap in non-English locales.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/src/components/DailyTaskReminders.tsx` around lines 114 - 120, The
hardcoded English strings "Mark All as Done", "Done", and "Today" in the
DailyTaskReminders.tsx component are not localized. Wrap each of these string
literals with the t() localization function to match the existing localization
pattern used elsewhere in the component. Apply t() to the button text content,
the conditional string in the span element showing 'Done' or 'Today', and any
other user-facing text in the affected code block.
Summary
Adds a "Mark All as Done" button to the Daily Task Reminders component, allowing farmers to complete all daily tasks with a single click.
Related Issue
Closes #42
Changes
Testing
Local testing:
Checklist
.envvalues are committedSummary by CodeRabbit
New Features
UI/UX Improvements