Skip to content

Commit

Permalink
Merge branch 'mohitparmar1:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushpatel1248 authored May 15, 2024
2 parents eadaf2b + e216cad commit e87d12c
Show file tree
Hide file tree
Showing 16 changed files with 412 additions and 12 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: 🪲 Bug Report
about: Create a bug report to help us resolving the bug
title: '🪲[Bug]: '
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
22 changes: 22 additions & 0 deletions .github/ISSUE_TEMPLATE/docs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: 📝 Documentation
about: Propose changes and improvements to ScrapQuest Docs.
title: '📝[Docs]: '
labels: 'enhancement'
assignees: ''
---

**What Docs changes are you proposing?**
Provide a clear description of the changes you're proposing for the documentation. Are you suggesting corrections, clarifications, additions, or updates?

**Why do the Docs need this improvement? What is the motivation for this change? How will this change benefit the community?**
Explain the motivation behind the proposed changes and how they will benefit the community or users of the documentation.

**Describe the solution you'd like**
Provide a clear and concise description of the changes you'd like to see implemented in the documentation.

**Describe alternatives you've considered**
If you've thought about alternative approaches or solutions, briefly describe them here.

**Additional context**
Add any additional context, examples, or screenshots related to the proposed documentation changes.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: 💡 Feature Request
about: Suggest an interesting feature idea for this project
title: '💡[FEATURE]: '
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
24 changes: 24 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: 'Greetings'

on:
fork:
push:
branches: [main]
issues:
types: [opened]
pull_request_target:
types: [opened]

jobs:
welcome:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: EddieHubCommunity/gh-action-community/src/welcome@main
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: |
Congratulations, @${{ github.actor }}! 🎉 Thank you for creating your issue. Your contribution is greatly appreciated and we look forward to working with you to resolve the issue. Keep up the great work!
pr-message: |
Great job, @${{ github.actor }}! 🎉 Thank you for submitting your pull request. Your contribution is valuable and we appreciate your efforts to improve our project.
footer: 'We will promptly review your changes and offer feedback. Keep up the excellent work! Kindly remember to check our [contributing guidelines](https://github.com/mohitparmar1/Shopy/blob/main/README.md)'
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ cd Shopy
npm install
```

```bash
npm install vite
```


```bash
npm run dev
Expand Down
16 changes: 16 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import Login from "./Pages/Login";
import Product from "./Pages/Product";
import Shop from "./Pages/Shop";
import ShopCategory from "./Pages/ShopCategory";
import Saved from "./Pages/WishList"
import About from "./Pages/About";

import "./index.css";
import Signup from "./Pages/Signup";
Expand All @@ -27,11 +29,16 @@ const App = () => {
<Route path="/kids" element={<ShopCategoryWithFooter banner={kids_banner} category="kid" />} />
<Route path="/product/:productId" element={<ProductWithFooter />} />
<Route path="/cart" element={<CartWithFooter />} />
<Route path="/wishlist" element={<WishlistWithFooter />} />
<Route path="/about" element={<About/>} />

</Routes>
</Router>
);
};



const LoginWithFooter = () => (
<>
<Login />
Expand Down Expand Up @@ -67,4 +74,13 @@ const ShopCategoryWithFooter = ({ banner, category }) => (
</>
);

const WishlistWithFooter=()=>(

<>
<Saved />
<Footer />
</>

);

export default App;
2 changes: 1 addition & 1 deletion src/Components/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Footer = () => {
<a href="#" className="block p-2">Products</a>
</button>
<button className="hover:bg-orange-400 hover:text-white focus:outline-none">
<a href="#" className="block p-2">About Us</a>
<a href="/about" className="block p-2">About Us</a>
</button>
<button className="hover:bg-orange-400 hover:text-white focus:outline-none">
<a href="#" className="block p-2">Contact</a>
Expand Down
12 changes: 11 additions & 1 deletion src/Components/Navbar.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
import React, { useState, useContext } from "react";
import { Link } from "react-router-dom";
import { ShopContext } from "../Context/ShopContext";
import {SavedContext} from "../Context/SavedContext"
import Cart from "../assets/cart_icon.png";
import Wishlist from "../assets/wishlist_icon.png";


const Navbar = () => {
const { getCartQuantity } = useContext(ShopContext);
const { getListQuantity }=useContext(SavedContext);
return (
<div className="flex items-center justify-around bg-white shadow-md top-0 left-0 w-screen">
<div className="text-orange-400 font-bold text-2xl mx-5 text-center">
Expand Down Expand Up @@ -32,7 +36,7 @@ const Navbar = () => {
</li>
</ul>
</div>
<a href="#" className="hover:text-orange-400">
<a href="/about" className="hover:text-orange-400">
About Us
</a>
<a href="#" className="hover:text-orange-400">
Expand All @@ -54,6 +58,12 @@ const Navbar = () => {
<div className="relative -top-2 right-[10px] bg-orange-400 rounded-full w-4 h-4 text-xs text-white text-center pointer-events-none">
{getCartQuantity()}
</div>
<Link to="/wishlist">
<img src={Wishlist} alt="wishlist" className="w-6 h-6 cursor-pointer" />
</Link>
<div className="relative -top-2 right-[10px] bg-orange-400 rounded-full w-4 h-4 text-xs text-white text-center pointer-events-none">
{getListQuantity()}
</div>
</div>
</div>
);
Expand Down
30 changes: 25 additions & 5 deletions src/Components/ProductDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ import React, { useContext, useState } from "react";
import starIcon from "../assets/star_icon.png";
import starDullIcon from "../assets/star_dull_icon.png";
import { ShopContext } from "../Context/ShopContext";
import { SavedContext } from "../Context/SavedContext"
import { ToastContainer, toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";

const ProductDisplay = (props) => {
const { product } = props.data;
const { AddToCart } = useContext(ShopContext);
const { AddToList }=useContext(SavedContext);
const [selectedSize, setSelectedSize] = useState("");

const handleSizeClick = (size) => {
Expand Down Expand Up @@ -95,21 +97,39 @@ const ProductDisplay = (props) => {
</button>
</div>
</div>
<div className="flex items-center mb-2 justify-start">
<div className="flex items-center mb-2 justify-start space-x-4">
<button
onClick={() => {
if (selectedSize === "") {
toast.error("Please select size");
if (product.size === "") {
toast.error("Please select size", {
autoClose:1500,
});
return;
}
AddToCart(product.id);
toast.success("Added to Cart");
toast.success("Added to Cart ", {
autoClose:1500
});
}}
className="bg-orange-400 w-40 text-white px-4 py-2 rounded"
>
Add to Cart
</button>
<ToastContainer />


<button
onClick={() => {

AddToList(product.id);
toast.success("Added to Wishlist");
}}
className="bg-blue-950 w-40 text-white px-4 py-2 rounded"
>
Add to Wishlist
</button>


<ToastContainer toastStyle={{backgroundColor: "lightgreen" , color: "black", fontWeight:"bold",marginTop:"28px"}}/>
</div>
<div className="flex flex-col my-2">
<p>
Expand Down
109 changes: 109 additions & 0 deletions src/Components/SavedItems.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@

import React from "react"
import {useContext} from "react"
import {SavedContext} from "../Context/SavedContext"
import { ShopContext } from "../Context/ShopContext";


const SavedItems=()=>{
const {all_products,listItem,AddToList,RemoveFromList,getListQuantity}=useContext(SavedContext)
const {AddToCart}=useContext(ShopContext)


return(
<>

<div className="flex my-50"><p className="font-normal ">Total products Wishlisted: </p><p className="font-bold">{getListQuantity()}</p></div>

<div className="grid grid-cols-3 ">
{
all_products.map((item) => {
if (listItem[item.id] > 0) {
return(
<div className="h-220 w-94 bg-white space-x-7" key={item.id}>
<img src={item.image} alt={item.name} className="h-150 w-92"/>
<div className="h-150 w-92">
<p className="font-semibold font-serif">
{(item.name.length > 40) ? (
// Truncate the name to the maximum length
item.name.substring(0, 40) + "..."
): (item.name)
}
</p>
<p className="font-mono font-bold">Category: {item.category}</p>
<div className="grid grid-cols-2">
<div><p className="font-bold text-green-900">${item.new_price}</p></div>
<div><p className="line-through text-red-600">${item.old_price}</p></div>

</div>
<div className="flex space-x-20">

<div><button onClick={()=>{
RemoveFromList(item.id)
}} className="bg-blue-950 text-white p-4 font-bold">Remove</button></div>
<div><button className="bg-red-700 text-white p-4 font-extrabold" onClick={()=>{
AddToCart(item.id)
}}>Add to Cart</button></div>

</div>
</div>


</div>
)
}
})
}



</div>

</>
)
}

export default SavedItems;

/*function CardComponent(item){
return(
<div className="h-220 w-94 bg-white">
<img src={item.image} alt={item.name} className="h-150 w-92"/>
<p className="font-semibold">{item.name}</p>
<p className="font-normal">#Category:{item.category}</p>
<div className="flex justify-between">
<p className="font-bold text-green-900">${item.new_price}</p>
<p className="line-through text-red-600">${item.old_price}</p>
</div>
</div>
)
}*/



/*<div className="flex justify-between bg-pink-300">
{
all_products.map((item) => {
if (listItem[item.id] > 0) {
return(
<CardComponent item={item}/>
)
}
})
}
</div>*/


/*<div className="flex justify-between">
<button onClick={()=>{
RemoveFromList(item.id)
}} className="bg-blue-950 text-white">Remove</button>
<button className="bg-red-700 text-white">Add to Cart</button>
</div>*/
Loading

0 comments on commit e87d12c

Please sign in to comment.