Skip to content

sachdevlaksh/grocery-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

38 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ›’ Grocery Tracker

A modern, feature-rich React application to track your daily grocery purchases with visual analytics and expiry alerts.

πŸš€ Features

Core Features

  • Add Groceries - Track items with detailed information:
    • Item name
    • Category and subcategory
    • Weight/quantity
    • Price in Indian Rupees (β‚Ή)
    • Purchase date
    • Expiry date
    • Status (In Stock / Finished)

Analytics & Dashboard

  • Total Summary Cards

    • Total items in stock
    • Total amount spent
  • Visual Charts

    • πŸ“Š Pie chart showing spending by category
    • πŸ“Š Pie chart showing spending by subcategory
    • Interactive tooltips and legends
    • Color-coded visualization

Smart Alerts

  • 🚨 Expired Items Alert (Red Flag)

    • Displays all items that have passed their expiry date
    • Shows when each item expired
    • Remove button to mark items as finished
  • ⚠️ Close to Expire Alert (Amber Flag)

    • Shows items expiring within the next 7 days
    • Displays days remaining until expiry
    • Remove button to mark items as finished

Data Management

  • Sorting

    • Sort groceries by date (Newest First / Oldest First)
  • Item Status Tracking

    • Mark items as "In Stock" (πŸ“¦) - Active items
    • Mark items as "Finished" (βœ“) - Consumed/Disposed items
    • Finished items remain in database for historical tracking
    • Finished items don't appear in alerts
  • Comprehensive Dashboard Table

    • View all items with all details
    • Status indicators (In Stock / Finished)
    • Faded appearance for finished items

UI/UX Features

  • Beautiful Modern Design

    • Gradient purple-themed header with emoji decorations
    • Animated header icons with bounce effect
    • Responsive grid layout
    • Smooth card animations on hover
  • Interactive Elements

    • Hover effects on cards and buttons
    • Slide-in animations for alerts
    • Color-coded badges and indicators
    • Form inputs with focus states
    • Delete buttons with visual feedback

πŸ“‹ Installation & Setup

Prerequisites

  • Node.js (v14 or higher)
  • npm or yarn

Installation Steps

  1. Clone the repository:
git clone <repository-url>
cd grocery-tracker
  1. Install dependencies:
npm install
  1. Start the development server:
npm start
  1. Open your browser and navigate to:
http://localhost:3000

πŸ“¦ Available Scripts

npm start

Runs the app in development mode. The page reloads automatically when you make changes.

npm test

Launches the test runner in interactive watch mode.

npm run build

Builds the app for production in the build folder. The build is minized and ready for deployment.

npm run eject

Note: This is a one-way operation. Once you eject, you can't go back!

πŸ› οΈ Technologies Used

  • React 19.2.3 - Frontend framework
  • Recharts - Data visualization library for pie charts
  • CSS3 - Styling and animations
  • JavaScript (ES6+) - Core logic

πŸ“ Project Structure

grocery-tracker/
β”œβ”€β”€ public/
β”‚   β”œβ”€β”€ index.html
β”‚   β”œβ”€β”€ manifest.json
β”‚   └── robots.txt
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ GroceryForm.js       # Form to add new groceries
β”‚   β”‚   └── GroceryDashboard.js  # Table display of all items
β”‚   β”œβ”€β”€ data/
β”‚   β”‚   └── groceryData.js       # Sample initial data
β”‚   β”œβ”€β”€ App.js                   # Main app component
β”‚   β”œβ”€β”€ App.css                  # App styling
β”‚   β”œβ”€β”€ index.js                 # Entry point
β”‚   └── setupTests.js
β”œβ”€β”€ package.json
└── README.md

🎯 How to Use

  1. Add Items

    • Fill in the form with item details
    • Click "Add" to add to your grocery list
    • Fields auto-reset after adding an item
  2. View Analytics

    • See total items and total spent at the top
    • View spending breakdown in pie charts
    • Check category and subcategory wise spending
  3. Check Alerts

    • Red alert shows expired items
    • Amber alert shows items expiring soon
    • Click "πŸ—‘οΈ Remove" to mark items as finished
  4. Sort Items

    • Use the sort dropdown to order by date
    • Choose "Newest First" or "Oldest First"
  5. Track Status

    • Check the Status column in the dashboard
    • "πŸ“¦ In Stock" = Active item
    • "βœ“ Finished" = Consumed/Disposed item

Dashboard with Analytics and Grocery Form

Dashboard

Shows pie charts for spending by category and subcategory, grocery form for adding items, and the data table.

Header and Alerts Section

Header and Alerts

Beautiful gradient header with emoji decorations, summary cards showing total items and total spent, and smart alerts for expired items with remove buttons.

οΏ½πŸ’‘ Tips

  • Items marked as "Finished" don't appear in expiry alerts
  • All finished items remain in the database for history
  • Expired items have a red background color
  • Close-to-expire items have an amber background
  • Charts update automatically when you add/remove items

πŸ“ Learn More

πŸ“„ License

This project is open source and available under the MIT License.


Happy Grocery Tracking! πŸ₯¬πŸ₯•πŸŽ

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

npm run build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

About

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors