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 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough
ChangesMark All as Done in DailyTaskReminders
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
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
|
Addressed the localization feedback by moving the new Daily Tasks labels to the translation files and adding translations for English, Hindi, and Bengali. Also updated the Daily Tasks title and completion summary to use localized strings. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Thanks for this addition! The "Mark All as Done" functionality works perfectly and is a great quality-of-life feature for the Dashboard. I noticed that the React Testing Library tests in The tests use Could you please make a small update to Just add <label
key={task.id}
htmlFor={`task-${task.id}`}
className={`${s.dailyTaskItem} ${checked ? s.dailyTaskItemDone : ''}`}
>
<input
id={`task-${task.id}`}
className={s.dailyTaskCheckbox}
type="checkbox"
checked={checked}
onChange={() => toggleTask(task.id)}
/>
<span className={s.dailyTaskTitle}>{task.title}</span>
<span className={s.dailyTaskDesc}>{task.description}</span>
</label>Once you push that change, the tests should pass perfectly, and we can get this merged! 🚀 |
|
Thanks for reviewing! I've added the explicit |
|
the issues are their: Issues Identified Missing test setup: The tests don't mock or set up the i18n context, so translations may not be rendering as expected. |
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
2/3) rather than full text.