Git Product home page Git Product logo

buyitnow's Introduction

Getting Started with Create React App

This project was bootstrapped with Create React App.

Available Scripts

In the project directory, you can run:

npm start

Runs the app in the development mode.
Open http://localhost:3000 to view it in your browser.

The page will reload when you make changes.
You may also see any lint errors in the console.

npm test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

npm run build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

npm run eject

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

If you aren't satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.

You don't have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

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

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

buyitnow's People

Contributors

ghulamabbas2 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

buyitnow's Issues

Filters and functions not working. I put your yt video code here

"use client"
import { useState } from "react";
import { useRouter } from "next/navigation";

const ProductFilterSidebar = ({ data }) => {
const [priceFrom, setpriceFrom] = useState(0);
const [priceTo, setpriceTo] = useState(5000);
const [isShoringOpen, setIsShoringOpen] = useState(true);
const [isAuthorsOpen, setIsAuthorsOpen] = useState(true);
const [isPublishersOpen, setIsPublishersOpen] = useState(true);

const router = useRouter()
let queryParams;

function handleClick(checkbox) {
if (typeof window !== "undefined") {
queryParams = new URLSearchParams(window.location.search);
}
const checkboxes = document.getElementsByName(checkbox.name)

checkboxes.forEach((item) => {
  if (item !== checkbox) item.checked = false
})
if (checkbox.checked === false) {
  queryParams.delete(checkbox.name)
} else {
  if (queryParams.has(checkbox.name)) {
    queryParams.set(checkbox.name, checkbox.value)
  } else {
    queryParams.append(checkbox.name, checkbox.value)
  }
}
const path = window.location.pathname + "?" + queryParams.toString()
router.push(path)

}

function checkHandler(checkBoxType, checkBoxValue) {
if (typeof window !== "undefined") {
queryParams = new URLSearchParams(window.location.search);

  const value = queryParams.get(checkBoxType);
  if (checkBoxValue === value) return true;
  return false;
}

}

return (



Filter by


Price ($)





      <div className="mb-4">
        <input
          name="max"
          className="appearance-none border border-gray-200 bg-gray-100 rounded-md py-2 px-3 hover:border-gray-400 focus:outline-none focus:border-gray-400 w-full"
          type="number"
          placeholder="Max"
        />
      </div>

      <div className="mb-4">
        <button className="px-1 py-2 text-center w-full inline-block text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700">
          Go
        </button>
      </div>
    </div>
  </div>

  <div className="hidden md:block px-6 py-4 border border-gray-200 bg-white rounded shadow-sm">
    <h3 className="font-semibold mb-2">Category</h3>

    <ul className="space-y-1">
      <li>
        <label className="flex items-center">
          <input
            name="category"
            type="checkbox"
            value="Electronics"
            className="h-4 w-4"
            defaultChecked={checkHandler("category", "Electronics")}
            onClick={(e) => handleClick(e.target)}
          />
          <span className="ml-2 text-gray-500"> Electronics </span>
        </label>
      </li>
      <li>
        <label className="flex items-center">
          <input
            name="category"
            type="checkbox"
            value="Laptops"
            className="h-4 w-4"
            defaultChecked={checkHandler("category", "Laptops")}
            onClick={(e) => handleClick(e.target)}
          />
          <span className="ml-2 text-gray-500"> Laptops </span>
        </label>
      </li>
      <li>
        <label className="flex items-center">
          <input
            name="category"
            type="checkbox"
            value="Toys"
            className="h-4 w-4"
            defaultChecked={checkHandler("category", "Toys")}
            onClick={(e) => handleClick(e.target)}
          />
          <span className="ml-2 text-gray-500"> Toys </span>
        </label>
      </li>
      <li>
        <label className="flex items-center">
          <input
            name="category"
            type="checkbox"
            value="Office"
            className="h-4 w-4"
            defaultChecked={checkHandler("category", "Office")}
            onClick={(e) => handleClick(e.target)}
          />
          <span className="ml-2 text-gray-500"> Office </span>
        </label>
      </li>
      <li>
        <label className="flex items-center">
          <input
            name="category"
            type="checkbox"
            value="Beauty"
            className="h-4 w-4"
            defaultChecked={checkHandler("category", "Beauty")}
            onClick={(e) => handleClick(e.target)}
          />
          <span className="ml-2 text-gray-500"> Beauty </span>
        </label>
      </li>
    </ul>

    <hr className="my-4" />

    {/* <h3 className="font-semibold mb-2">Ratings</h3>
  <ul className="space-y-1">
    <li>
      {[5, 4, 3, 2, 1].map((rating) => (
        <label key={rating} className="flex items-center">
          <input
            name="ratings"
            type="checkbox"
            value={rating}
            className="h-4 w-4"
            defaultChecked={checkHandler("ratings", `${rating}`)}
          />
          <span className="ml-2 text-gray-500">
            {" "}
            <StarRatings
              rating={5}
              starRatedColor="#ffb829"
              numberOfStars={5}
              starDimension="20px"
              starSpacing="2px"
              name="rating"
            />{" "}
          </span>
        </label>
      ))}
    </li>
  </ul> */}
  </div>
</aside>

);
};

export default ProductFilterSidebar;

TypeError: mongoose.models is undefined

Hi ghulam, I follow your videos step by step and all codes are same but when i trying to add product item inside product list and run the app i getting this error TypeError: mongoose.models is undefined, are you know the solution for this?

POST 400 (Bad Request) */api/admin/products

Hi Ghulam, I and some other students are having the same problem - we've mentioned it in the Youtube comments but received no response so far - it's stopping us from proceeding with the course, can you please advise us? Below is my comment from YT - posted here to illustrate our problem

Hi Ghulam! So, I ran into a problem that I could not resolve, even after going through the video 3 times and checking all the changed files:
'POST 400 (Bad Request) */api/admin/products '
I got so frustrated that I even tried with your repo from this video, changing the 'next.config' file for mine and I'm still getting the same error. Just to be clear, this is also happening with your repo at this stage (026-new-product) -do you have any idea why this might be? (I checked the db and the product is not added.
Thanks again!

[next-auth][error][CLIENT_FETCH_ERROR]

const isAuthenticatedUser = async (req, res, next) => {
const session = await getSession({req} );

if (!session) {
return next(new Error("Login first to access this route", 401));
}

req.user = session.user;
console.log( req.user = session.user);
next();
};

export { isAuthenticatedUser };

handel.use(isAuthenticatedUser).post(PostTodo)
handel.use(isAuthenticatedUser).get(getTodo)

[next-auth][error][CLIENT_FETCH_ERROR]
https://next-auth.js.org/errors#client_fetch_error undefined {
error: {},
url: 'http://localhost:3000/api/auth/session',
message: undefined
}
{
_id: '64443c6eb3d7f41520ad196f',
name: 'badhon',
email: '[email protected]',
password: '$2a$10$PMu0LvTsIDuArfbfcsb2HOH1KTDNgqmwMpcrmvSg9bK8UgIwQA8VW',
__v: 0
}

message ////////////////////////////

when I get request its proper work but when I post request on my formdata then getting error I am still login message is "Login first to access this route" why
like [next-auth][error][CLIENT_FETCH_ERROR]
console.log( req.user = session.user)
{
_id: '64443c6eb3d7f41520ad196f',
name: 'badhon',
email: '[email protected]',
password: '$2a$10$PMu0LvTsIDuArfbfcsb2HOH1KTDNgqmwMpcrmvSg9bK8UgIwQA8VW',
__v: 0
}

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.