Skip to content

feat: enhance empty states for tasks, farms, and crops in dashboard#56

Merged
jpdevhub merged 2 commits into
jpdevhub:mainfrom
gitbasitmalik:feat/empty-states
Jun 12, 2026
Merged

feat: enhance empty states for tasks, farms, and crops in dashboard#56
jpdevhub merged 2 commits into
jpdevhub:mainfrom
gitbasitmalik:feat/empty-states

Conversation

@gitbasitmalik

@gitbasitmalik gitbasitmalik commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Summary

Enhances the dashboard by adding beautifully designed Empty State illustrations for the Farms, Crops, and Tasks sections.

Related Issue

Closes #47

Changes

  • Tasks: Replaced the basic text badge in DailyTaskReminders with an animated EmptyState component when all tasks are complete.
  • Crops: Created a dedicated "My Crops" tab in the dashboard navigation. When a farm has no crops, it displays the crops EmptyState illustration. Added translations for this new tab across English, Hindi, and Bengali locales.
  • Farms: Verified the Farms tab correctly renders the EmptyState component when no fields are mapped.

Testing

  • Tested locally (describe steps)
    • Ran the local Next.js dev server and navigated to the dashboard to view the empty states conditionally for Farms, Crops, and Tasks.
    • Verified UI across different tabs.
    • Ran npx tsc --noEmit to ensure no TypeScript errors were introduced.

Checklist

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

Summary by CodeRabbit

  • New Features

    • Added "My Crops" dashboard tab displaying crop cards with type, variety, allocated area, season, and growth stage information
    • Added "Plant a Crop" call-to-action for quick crop onboarding
    • Added "Scan Crop" button for rapid crop scanning from the dashboard
    • Enhanced task completion with celebration state and reset functionality
  • Localization

    • Added multi-language support for new features in English, Bengali, and Hindi

Copilot AI review requested due to automatic review settings June 10, 2026 14:42
@vercel

vercel Bot commented Jun 10, 2026

Copy link
Copy Markdown

@gitbasitmalik 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, @gitbasitmalik!

Please make sure CI passes and the checklist in the PR template is complete. A maintainer will review this soon.

— The AgroNavis team

Copilot AI 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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds a reusable, illustrated EmptyState component and expands the dashboard UI with a dedicated “My Crops” tab and localized empty-state copy, plus a small dev script adjustment for running the backend from a venv.

Changes:

  • Introduced EmptyState component + CSS module with illustrations/animations
  • Replaced multiple inline empty-state UIs in the dashboard with the new component and added “My Crops” navigation/tab
  • Added i18n strings for new nav item and empty states (EN/HI/BN) and adjusted dev:api script

Reviewed changes

Copilot reviewed 9 out of 11 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
package.json Updates dev:api to use the backend venv uvicorn on non-Windows
frontend/src/styles/EmptyState.module.css Adds styling/animations for the new EmptyState component
frontend/src/pages/dashboard.tsx Adds “My Crops” item to dashboard nav
frontend/src/locales/en.json Adds myCrops nav label + dashboard.emptyStates.* strings
frontend/src/locales/hi.json Adds myCrops nav label + dashboard.emptyStates.* strings
frontend/src/locales/bn.json Adds myCrops nav label + dashboard.emptyStates.* strings
frontend/src/components/EmptyState.tsx New reusable illustrated EmptyState component
frontend/src/components/Dashboard.tsx Uses EmptyState in multiple places + adds “My Crops” tab content
frontend/src/components/DailyTaskReminders.tsx Shows a “tasks complete” EmptyState variant when all tasks are done
Files not reviewed (1)
  • frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

package.json:1

  • On non-Windows this assumes ./venv/bin/uvicorn exists and is directly executable. A more reliable way to ensure the correct environment and avoid executable-bit/shebang issues is to invoke uvicorn via the venv’s Python (e.g., ./venv/bin/python -m uvicorn ...; аналогously on Windows with ...\\\\python.exe -m uvicorn ...). This tends to be more portable across environments and venv setups.
{

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread frontend/src/components/Dashboard.tsx
Comment on lines +105 to +112
{allComplete ? (
<EmptyState
variant="tasks"
title={t('dashboard.emptyStates.tasks.title')}
description={t('dashboard.emptyStates.tasks.desc')}
ctaLabel="Reset for Tomorrow"
onCta={resetTasks}
/>
Comment thread frontend/src/components/EmptyState.tsx
Comment thread frontend/src/styles/EmptyState.module.css
@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@gitbasitmalik, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 44 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 7543dff1-b515-4fad-8ac5-394401ba0f41

📥 Commits

Reviewing files that changed from the base of the PR and between 3a46bad and 1ad905d.

📒 Files selected for processing (5)
  • frontend/src/components/DailyTaskReminders.tsx
  • frontend/src/components/Dashboard.tsx
  • frontend/src/locales/bn.json
  • frontend/src/locales/en.json
  • frontend/src/locales/hi.json
📝 Walkthrough

Walkthrough

The PR introduces a reusable EmptyState component with SVG illustrations and animations for empty-data UI states, integrates it across the Dashboard (farms, crops, fields, tasks), adds a new crops tab with crop card rendering and metadata display, and provides localization support in English, Bengali, and Hindi.

Changes

Empty State UI System

Layer / File(s) Summary
EmptyState component foundation
frontend/src/components/EmptyState.tsx, frontend/src/styles/EmptyState.module.css
Four SVG illustration components (FarmsIllustration, CropsIllustration, FieldsIllustration, TasksDoneIllustration) and an ILLUSTRATIONS lookup. Exported types EmptyStateVariant and EmptyStateProps define the component contract. EmptyState renders the selected illustration, title, description, and optional CTA button with a plus icon. CSS module provides keyframe animations (float, fadeSlideIn, pulseDot), wrapper/illustration styling, typography, gradient CTA button with hover/active states, decorative animated dot row, and prefers-reduced-motion accessibility support.
Navigation setup and localization
frontend/src/pages/dashboard.tsx, frontend/src/locales/en.json, frontend/src/locales/bn.json, frontend/src/locales/hi.json
New crops sidebar navigation entry with icon and translation key. English, Bengali, and Hindi localization files add dashboard.shell.nav.myCrops label and dashboard.overview.emptyStates block with titles, descriptions, and CTA labels for farms, crops, fields, and tasks empty states.
Dashboard empty-state integration
frontend/src/components/Dashboard.tsx (overview, farms, map tabs)
Dashboard imports EmptyState and replaces hardcoded empty-state markup: overview tab uses crops variant routed to crop onboarding; farms tab uses farms variant routed to farm onboarding; map tab uses farms and fields variants routing to their respective onboarding flows.
Crops tab with crop card grid
frontend/src/components/Dashboard.tsx (crops tab)
New activeTab === 'crops' section renders loading card, empty-states for no farms or no crops, or a crop card grid. Cards display crop type/variety, allocated area, season, growth stage, formatted sowing/harvest dates, and "Scan Crop" button. Tab header includes "Plant a Crop" CTA routing to crop onboarding with the selected or first farm's farmId.
Task reminders completion state
frontend/src/components/DailyTaskReminders.tsx
Imports EmptyState and useTranslation to render a translated completion celebration. Adds resetTasks handler. Conditional rendering: EmptyState (with reset CTA) when all tasks complete; checkbox list otherwise.
Backend API dev script
package.json
Updated dev:api script to use backend virtual environment binary (./venv/bin/uvicorn) with --app-dir backend flag on non-Windows platforms.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 A farmer's joy, no more blank screens!
Empty states now bloom with grace and sheen,
Illustrations dance, CTAs call true,
Crops tab blooms with metadata in view,
Multi-tongue welcomes every new farmer too! 🌾✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning One change appears out-of-scope: the package.json modification updates the dev:api script to use uvicorn with --app-dir backend, unrelated to empty state enhancements. Remove the package.json dev:api script change or explain its necessity in relation to the empty states feature implementation.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately summarizes the main change: enhancing empty states across tasks, farms, and crops sections.
Linked Issues check ✅ Passed All objectives from issue #47 are met: EmptyState component created with SVG illustrations, CTA buttons added, and empty states implemented for Farms, Crops, and Tasks sections.
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: 4

🤖 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`:
- Line 110: DailyTaskReminders currently hardcodes the CTA text via
ctaLabel="Reset for Tomorrow"; add a new translation key (e.g.
dashboard.emptyStates.tasks.resetCta) to en.json, bn.json, and hi.json with the
appropriate localized strings, then replace the hardcoded ctaLabel with
t('dashboard.emptyStates.tasks.resetCta') in the DailyTaskReminders component so
it uses the existing t() i18n pattern used for title and description.

In `@frontend/src/components/Dashboard.tsx`:
- Around line 545-563: Replace the hardcoded header and button strings in the
Dashboard component with i18n lookups: use t('dashboard.crops.title') instead of
"My Crops" (target s.fertTitle), t('dashboard.crops.subtitle') for the subtitle
text, t('dashboard.crops.addCrop') for the button label (button using s.emptyBtn
and router.push), and t('dashboard.crops.loading') for the loading text shown
when loading is true; also add the suggested keys under dashboard.crops in your
locale JSONs (en.json, bn.json, hi.json).
- Around line 609-632: The crop card contains hardcoded user strings—replace
"Area not set", the "Stage: " prefix and "Growth stage not set", and "Scan Crop"
with localized keys from the dashboard.crops.card locale (e.g. card.areaNotSet,
card.stageLabel, card.stageNotSet, card.scanCrop). In Dashboard.tsx import/use
the i18n translation hook (e.g. useTranslation or t) at the top of the
component, swap the literal strings for t('dashboard.crops.card.areaNotSet')
where crop.area_allocated <= 0, render the stage by concatenating
t('dashboard.crops.card.stageLabel') + crop.current_growth_stage when present or
t('dashboard.crops.card.stageNotSet') otherwise (target the existing JSX that
references crop.current_growth_stage), and replace the button text "Scan Crop"
with t('dashboard.crops.card.scanCrop'); keep existing handlers like
setActiveTab('cropscan') unchanged.
- Around line 589-594: Validate and safely format crop.sowing_date and
crop.expected_harvest_date before calling toLocaleDateString: implement a
defensive helper (e.g., safeFormatDate) that accepts the raw value
(crop.sowing_date / crop.expected_harvest_date), returns 'Not set' for
null/undefined/empty, attempts to construct a Date and checks isFinite(date) or
isNaN(date.getTime()), and only then returns date.toLocaleDateString(...) else
returns 'Not set' (or a configurable fallback). Replace the inline new
Date(...).toLocaleDateString calls that produce sowingLabel and harvestLabel
with calls to this helper so malformed or invalid strings won't crash the UI.
🪄 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: 836c1509-ed35-47d3-a016-4b06a57cc5cd

📥 Commits

Reviewing files that changed from the base of the PR and between 6d2d32c and 3a46bad.

⛔ Files ignored due to path filters (2)
  • frontend/package-lock.json is excluded by !**/package-lock.json
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • frontend/src/components/DailyTaskReminders.tsx
  • frontend/src/components/Dashboard.tsx
  • frontend/src/components/EmptyState.tsx
  • frontend/src/locales/bn.json
  • frontend/src/locales/en.json
  • frontend/src/locales/hi.json
  • frontend/src/pages/dashboard.tsx
  • frontend/src/styles/EmptyState.module.css
  • package.json

Comment thread frontend/src/components/DailyTaskReminders.tsx Outdated
Comment thread frontend/src/components/Dashboard.tsx Outdated
Comment thread frontend/src/components/Dashboard.tsx Outdated
Comment thread frontend/src/components/Dashboard.tsx Outdated
@gitbasitmalik gitbasitmalik requested a review from Copilot June 10, 2026 15:43

Copilot AI 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.

Pull request overview

Copilot reviewed 9 out of 11 changed files in this pull request and generated 6 comments.

Files not reviewed (1)
  • frontend/package-lock.json: Language not supported
Comments suppressed due to low confidence (1)

package.json:1

  • On non-Windows this now hard-depends on backend/venv/bin/uvicorn existing. If the venv isn’t created (or is named differently), npm run dev:api will fail. Consider adding a small fallback (e.g., try ./venv/bin/uvicorn then uvicorn) or documenting/enforcing venv creation as part of setup (e.g., a setup script).
{

Comment on lines +252 to +253
<p className={s.title}>{title}</p>
<p className={s.desc}>{description}</p>
/* Crops exist — render crop cards */
<div className={s.farmsGrid}>
{crops.map((crop) => {
const stage = crop.current_growth_stage || 'Vegetative';
</div>
{/* Area + Season row */}
<div className={s.soilDesc}>
{crop.area_allocated > 0 ? `${crop.area_allocated.toFixed(1)} acres` : t('dashboard.cropsTab.areaNotSet')}
{/* Sowing & Harvest */}
<div className={s.farmNpkGrid} style={{ marginTop: 0 }}>
<div className={s.npkItem}>
<div className={s.npkLabel}>SOWING</div>
<div className={s.npkVal} style={{ fontSize: 12 }}>{sowingLabel}</div>
</div>
<div className={s.npkItem}>
<div className={s.npkLabel}>HARVEST</div>
Comment on lines +589 to +595
const parseDate = (d: string | null | undefined) => {
if (!d) return t('dashboard.notSet');
const date = new Date(d);
return isNaN(date.getTime())
? t('dashboard.notSet')
: date.toLocaleDateString(undefined, { day: 'numeric', month: 'short', year: 'numeric' });
};

@JainamDedhia JainamDedhia left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed the implementation and the overall approach looks good. The EmptyState integration across Farms, Crops, and Tasks improves the user experience and keeps the dashboard consistent. The localization updates and reusable component structure are also well organized.

Nice work! 🚀

@jpdevhub jpdevhub left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for contributing

@vercel

vercel Bot commented Jun 12, 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 12, 2026 4:47am

@jpdevhub jpdevhub merged commit 58186ea into jpdevhub:main Jun 12, 2026
5 of 6 checks passed
@gitbasitmalik

Copy link
Copy Markdown
Contributor Author

you're welcome @JainamDedhia @jpdevhub

@jpdevhub

Copy link
Copy Markdown
Owner

You are not in the official contributer list of ssoc contact the organisers

@gitbasitmalik

Copy link
Copy Markdown
Contributor Author

how to do this? i don't have an idea about this can you help me with that!

@jpdevhub

Copy link
Copy Markdown
Owner
image

@gitbasitmalik

Copy link
Copy Markdown
Contributor Author

it's says Contributor registration is currently closed. Please check back later!

@jpdevhub

Copy link
Copy Markdown
Owner

Hm you have to contact the organisers

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.

Enhance Empty States in the Dashboard

4 participants