Skip to content

Add "Mark All as Done" button to Daily Task Reminders#60

Merged
jpdevhub merged 5 commits into
jpdevhub:mainfrom
jyoti430:feature/mark-all-done-button
Jun 22, 2026
Merged

Add "Mark All as Done" button to Daily Task Reminders#60
jpdevhub merged 5 commits into
jpdevhub:mainfrom
jyoti430:feature/mark-all-done-button

Conversation

@jyoti430

@jyoti430 jyoti430 commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

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

  • Added a "Mark All as Done" button to the Daily Tasks card.
  • Added functionality to mark all daily tasks as completed in one click.
  • Reused the existing task completion and localStorage persistence flow.
  • Preserved compatibility with the existing "Reset for Tomorrow" functionality.

Testing

  • Added/updated tests
  • Tested locally (describe steps)

Local testing:

  • Opened the dashboard page.
  • Clicked "Mark All as Done" and verified all tasks were marked complete.
  • Verified the completion counter updated correctly.
  • Refreshed the page and confirmed task state persisted.
  • Clicked "Reset for Tomorrow" and verified all tasks became unchecked.
  • Refreshed again and confirmed the reset state persisted.

Checklist

  • Code follows the project's TypeScript / Python style conventions
  • No secrets or .env values are committed
  • CI passes

Summary by CodeRabbit

  • New Features
    • Added a “Mark All as Done” action to complete all daily tasks in one step.
  • UI/UX Improvements
    • Updated the daily task card header, completion summary, badge, and button text to use localized Daily Tasks copy.
    • Refined the header layout by grouping the completion badge and the quick action together.
  • Accessibility / Bug Fixes
    • Improved checkbox accessibility by linking each label to its matching checkbox.
  • Tests
    • Relaxed the completion indicator assertions to match by value (e.g., 2/3) rather than full text.
  • Documentation / Localization
    • Added Bengali, Hindi, and English translations for the Daily Tasks UI (title, statuses, button label).

@vercel

vercel Bot commented Jun 14, 2026

Copy link
Copy Markdown

@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.

@github-actions

Copy link
Copy Markdown

🎉 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

@coderabbitai

coderabbitai Bot commented Jun 14, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 5f453a2d-3bb6-47b5-967a-0075b5f0e52f

📥 Commits

Reviewing files that changed from the base of the PR and between 8b8f871 and a7e8e48.

📒 Files selected for processing (1)
  • frontend/src/components/__tests__/DailyTaskReminders.test.tsx

📝 Walkthrough

Walkthrough

DailyTaskReminders gains a markAllAsDone helper that sets water, fertilize, and harvest states to true. The component header is refactored to conditionally render a "Mark All as Done" button alongside the completion badge inside a flex-aligned container, with all text sourced from i18n keys. Each task row's label is now explicitly wired to its checkbox via htmlFor and id attributes. Translation strings are added to English, Bengali, and Hindi locale files to support the updated UI text. Test assertions are loosened to match partial text via regex instead of full strings to accommodate the new i18n-driven rendering.

Changes

Mark All as Done in DailyTaskReminders

Layer / File(s) Summary
markAllAsDone logic, header refactor, task accessibility, and test updates
frontend/src/components/DailyTaskReminders.tsx, frontend/src/components/__tests__/DailyTaskReminders.test.tsx
Adds markAllAsDone function that sets all three task states to true, updates the header to conditionally show a "Mark All as Done" button (hidden when all tasks are already complete) alongside the status badge in a flex container using i18n keys, improves accessibility by connecting each task label to its checkbox with matching htmlFor/id attributes, and loosens test assertions from full-string matching to regex partial matching to work with i18n-rendered text.
i18n localization for daily tasks
frontend/src/locales/en.json, frontend/src/locales/bn.json, frontend/src/locales/hi.json
Adds dailyTasks translation objects to all three locale files with consistent labels for title, completion status, "mark all done" action, and status badges ("today" and "done").

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested labels

Medium

Suggested reviewers

  • jpdevhub

Poem

🐇 Hippity hop, tasks all in sight,
One button to mark them complete and right!
Water, fertilize, harvest — away!
The farmer rests now, hip-hip-hooray! ✅

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main feature addition: a 'Mark All as Done' button to Daily Task Reminders, which is the primary change throughout the changeset.
Linked Issues check ✅ Passed The implementation fully addresses issue #42 by adding a 'Mark All as Done' button with proper localization support and functionality to mark all daily tasks as completed in a single action.
Out of Scope Changes check ✅ Passed All changes are directly related to implementing the 'Mark All as Done' feature: component logic, localization support, test updates, and semantic HTML associations for accessibility.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/src/components/DailyTaskReminders.tsx (1)

90-95: ⚡ Quick win

Derive “all done” state from TASKS to avoid future drift.

Line 91 hardcodes task keys, which can silently desync from TASKS when a new daily task is added. Build the next state from TASKS so 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

📥 Commits

Reviewing files that changed from the base of the PR and between 58186ea and 8887d0c.

📒 Files selected for processing (1)
  • frontend/src/components/DailyTaskReminders.tsx

Comment thread frontend/src/components/DailyTaskReminders.tsx Outdated
@jyoti430

Copy link
Copy Markdown
Contributor Author

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.

@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agronavis-ai-farm-assiatant Ready Ready Preview, Comment Jun 22, 2026 9:02am

@jpdevhub

Copy link
Copy Markdown
Owner

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 DailyTaskReminders.test.tsx are failing on this branch.

The tests use screen.getByLabelText(/water/i), which expects the <input type="checkbox"> elements to be explicitly associated with their <label> wrappers using standard HTML id and htmlFor attributes. Because the inputs currently lack explicit IDs, the tests can't find them and fail.

Could you please make a small update to frontend/src/components/DailyTaskReminders.tsx to fix this?

Just add htmlFor to the label and id to the input like this:

<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! 🚀

@jyoti430

Copy link
Copy Markdown
Contributor Author

Thanks for reviewing! I've added the explicit id and htmlFor association for the task checkboxes and pushed the update.

@jpdevhub

Copy link
Copy Markdown
Owner

the issues are their:
The test expects the completion text to display as "2/3 complete today", but the component renders it as "{completedCount}/{TASKS.length} complete today" where the text is generated from the i18n translation key dashboard.dailyTasks.completeToday. The test is looking for an exact string match that doesn't account for the actual rendered output.

Issues Identified
Test Assertion Issue (Line 24 & 39): The tests use screen.getByText('2/3 complete today') which searches for an exact text match. However, the component uses a translation key that likely returns a formatted string.

Missing test setup: The tests don't mock or set up the i18n context, so translations may not be rendering as expected.

@jpdevhub jpdevhub merged commit 1f5879f into jpdevhub:main Jun 22, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add 'Clear All' button to Daily Tasks

2 participants