Giter Site home page Giter Site logo

devjoylee / nodeul-market Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 1.0 124 KB

Grocery Sharing Service built in Esbuild 🍎

Home Page: https://nodeulmarket.netlify.app

TypeScript 56.76% JavaScript 1.50% CSS 3.67% HTML 1.02% SCSS 37.04%
react sass typescript

nodeul-market's Introduction

Logo

Nodeul Market (λ…Έλ“€λ§ˆμΌ“)

View Demo

Table of Contents

About The Project

Anyone living alone or with a small family may experienced throwing away rotten fruits or vegetables from the fridge. If you buy a small amount, it is expensive, and if you buy it in bulk, it will eventually become a troublesome work. So, here is the solution. An online local market service designed to help you share fruits, vegetables, frozen foods, dairy products and other food items to neighbors at a low price.

πŸ’‘ What does the 'Nodeul Market' mean?
I was living in a shared house called 'Nodeul House' when there was zero waste boom in Korea. I made this service from the thought of sharing groceries with housemates effectively to follow the zero wast campaign. That's why I named it as 'Nodeul Market', which means a market in Nodeul House.

  • Production Period : 2021.04.01 - 2021.04.21

Built With

Β Β Β Β Β Β Β Β 


Getting Started

You are able to start the app by typing the following commands in the command line:

git clone https://github.com/devjoylee/nodeul-market.git
npm install
npm run dev

Main Features

Q: What products are usually sold?

The main products include 1) fruits and vegetables which cannot keep it long, 2) soy milk and frozen foods that are difficult to purchase in small quantities. You can click the 'ADD TO CART' button if there is something you like.

img

  • Code Preview
// App.tsx
// Move to cart when you click 'ADD TO CART'
const handleAddToCart = (clickedItem: iItemDetail) => {
	setCartItems((prevItems) => {
		// Is the item already added in the cart?
		const isItemInCart = prevItems.find((item) => item.id === clickedItem.id);
		if (isItemInCart) {
			alert("It's already in your cart πŸ˜‹");
			return [...prevItems];
		}

		// First time the item is added
		alert("Successfully added πŸŽ‰");
		return [{ ...clickedItem }, ...prevItems];
	});
};

Q: How can people buy a item?

Once you have placed the item in your shopping cart, click the MY CART button at the top to view your cart history. If you wish to buy it, click BUY THIS button to let the seller know. If you don't want to buy it, delete the product with the DELETE THIS button.

img

  • Code Preview
// App.tsx
// Delete an item from the cart
const handleRemoveFromCart = (id: number) => {
	if (confirm("Are you sure to delete it from the cart?")) {
		setCartItems((prevItems) => {
			return prevItems.filter((item) => item.id !== id);
		});
	}
};

Q: How can people add a item?

Click the ADD ITEM button at the top or at the center of the banner to add the item. Fill out the form about the item you want to share, and click the ADD TO INVENTORY button to save it.

img

  • Code Preview
// components/NewItemModal
// Used react custom hooks (useForm, useImage)
const { values, handleChange, handleResetForm } = useForm();
const [errors, setErrors] = useState({} as ErrorMessage);
const fileImageRef = useRef<HTMLInputElement>(null);
const { preview, handleImageURL, handleRemoveImage } = useImage();

//...

// Check the form validation when you click the submit button.
const handleSubmit = async (e: React.MouseEvent<HTMLButtonElement>) => {
  e.preventDefault();

  const error = await validate(values);
  const hasInvaild = Object.keys(error).length;
  setErrors(error);

  // store the uploaded image
  if (preview) {
    values.image = preview;
  }

  // if all vaildation is passed, add to inventory
  if (!hasInvaild) {
    addToInventory(values);
    closeModal();
  }
};

(back to top)

nodeul-market's People

Contributors

devjoylee avatar zaydek avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

zaydek

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.