dev-AshishRanjan / Hacktoberfest-Frontend

Make your Pull Request for Hacktoberfest 2023 in the Web domain specially Frontend. And give this repo a ⭐
https://frontend-database.netlify.app
MIT License
14 stars 37 forks source link

Food Market System #66

Closed Mefisto04 closed 8 months ago

Mefisto04 commented 8 months ago

Describe your change:

Checklist:

ATTACH SCREEN-SHOTS

image

Before After
< Before Image > < After Image >
netlify[bot] commented 8 months ago

Deploy Preview for frontend-database ready!

Name Link
Latest commit 0d89fc969862181bafb923fa9c7339462109e209
Latest deploy log https://app.netlify.com/sites/frontend-database/deploys/6537f9509f5d4e00086c347f
Deploy Preview [https://deploy-preview-66--frontend-database.netlify.app/projects/food market](https://deploy-preview-66--frontend-database.netlify.app/projects/food market)
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

pr-explainer-bot[bot] commented 8 months ago

Pull Request Report

Hey there! I've created a report for the pull request based on the commit history. Let's dive in!

Changes

  1. Added a new project called "Food Market" by Mefisto.
  2. Added the necessary files for the "Food Market" project.

Suggestions

Here are a few suggestions to improve the code:

  1. In the index.html file of the "Food Market" project, consider using external CSS instead of inline styles for better maintainability.
  2. Instead of hardcoding the data in the JavaScript file, consider fetching it from an API or storing it in a separate JSON file.

Bugs

I couldn't find any potential bugs in the code. Great job!

Improvements

I found a couple of places in the code that could be refactored for better readability:

  1. In the displayCards function in the index.html file, consider extracting the card creation logic into a separate function for better modularity. Here's a refactored version of the code:
function createCard(item) {
  const card = document.createElement("div");
  card.classList.add("card");
  card.innerHTML = `
    <img src="${item.image}" alt="${item.name}">
    <h2>${item.name}</h2>
    <p>Category: ${item.category}</p>
  `;
  return card;
}

function displayCards() {
  cardContainer.innerHTML = '';
  const searchTerm = searchInput.value.toLowerCase();
  const selectedCategory = categorySelect.value;

  const filteredItems = data.filter(item => {
    const name = item.name.toLowerCase();
    return (name.includes(searchTerm) && (selectedCategory === 'all' || item.category === selectedCategory));
  });

  filteredItems.forEach(item => {
    const card = createCard(item);
    cardContainer.appendChild(card);
  });
}
  1. In the index.html file, consider adding comments to explain the purpose of each section of the code for better understanding.

Rating

I would rate the code a 7 out of 10 based on the following criteria:

That's it for the pull request report! Let me know if you need any further assistance. Happy coding!

dev-AshishRanjan commented 8 months ago

You can checkout our Idea-Arca, the project idea bank for any languages, for open-source contributions. The PR from this repo is being accepted in hacktoberfest2023

Happy Contributing season! Keep up the good work!