Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I 'm Include chat bot #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions db.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"posts": [
{
"Contact": {
"id": "Contact",
"message": "1234567890",
"value": "1234567890"
},
"id": 1
}
]
}
4,023 changes: 3,972 additions & 51 deletions package-lock.json

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,22 @@
"dependencies": {
"@headlessui/react": "^1.5.0",
"@heroicons/react": "^1.0.6",
"@iconify/icons-heroicons-solid": "^1.2.5",
"@testing-library/jest-dom": "^5.16.2",
"@testing-library/react": "^12.1.4",
"@testing-library/user-event": "^13.5.0",
"@types/react-router": "^5.1.19",
"axios": "^0.26.1",
"firebase": "^9.6.8",
"font-awesome": "^4.7.0",
"heroicons-react": "^1.4.1",
"node-modules": "^1.0.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-router-dom": "^6.2.2",
"react-scripts": "5.0.0",
"react-simple-chatbot": "^0.6.1",
"styled-components": "^5.3.6",
"web-vitals": "^2.1.4"
},
"scripts": {
Expand Down
4 changes: 3 additions & 1 deletion src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import ProductDetail from './Pages/ProductDetail'
import Cart from './Pages/Cart'
import Favorites from './Pages/Favorites'



function App() {
return (
<div className="container mx-auto">
Expand All @@ -24,7 +26,7 @@ function App() {
<Route path="/favorites" element={<Favorites />} />
<Route path="/signin" element={<Signin />} />
<Route path="/signup" element={<Signup />} />
<Route path="*" element={<Error404 />} />
<Route path="*" element={<Error404 />} />
</Routes>
</Container>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/Components/Card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@ import styles from './styles.module.css'
import { StarIcon, ShoppingCartIcon, HeartIcon } from '@heroicons/react/solid'
import { Link } from 'react-router-dom'

const Card = ({
const Card = ({
item,
addToFavorite,
findFavoriteItem,
addToCart,
findCartItem,
}) => {

}) =>
{

return (
<div key={`${item.id}-item`} className={styles.card} title={item.title}>
{/* <h1>{item.title}</h1> */}


<div className={styles.cardLink}>
<button
className={
Expand Down Expand Up @@ -91,6 +95,6 @@ const Card = ({
</div>
</div>
)
}

}
export default Card
4 changes: 2 additions & 2 deletions src/Pages/Auth/Signin/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Signin = () => {

const { currentUser, login, setCurrentUser, setIsSubmitting, loggedIn } = useAuth()

const [email, setEmail] = useState("")
const [email, setEmail] = useState("")
const [password, setPassword] = useState("")

const emailRef = useRef()
Expand All @@ -35,7 +35,7 @@ const Signin = () => {
<div className={styles.formGroupContainer}>
<div className={styles.formGroup}>
<div>
<h2 className={styles.title}>Login</h2>
<h2 className={styles.title}>Login</h2>
</div>
<form
autoComplete="off"
Expand Down
1 change: 0 additions & 1 deletion src/Pages/Auth/Signup/validations.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const validations = (currentUser, users) => {
console.log(users)
const isUser = users.some((item) => item.email === currentUser.email)
Expand Down
15 changes: 11 additions & 4 deletions src/Pages/ProductDetail/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { useProduct } from "../../Context/ProductContext";
import { useCart } from "../../Context/CartContext";
import { useFavorite } from "../../Context/FavoriteContext";
import styles from "./styles.module.css";
import First from '../../chatbot/First'


const ProductDetail = () => {
const { addToCart, items } = useCart();
Expand All @@ -20,9 +22,8 @@ const ProductDetail = () => {
useEffect(() => {
setProductID(product_id);
}, []);

return (
<>
<>
{!loading && product?.id ? (
<div className="flex flex-wrap max-w-7xl mx-auto my-4">
<div className="w-full sm:w-2/2 md:w-2/2 xl:w-5/5 p-4 flex flex-wrap">
Expand Down Expand Up @@ -63,10 +64,12 @@ const ProductDetail = () => {
{product.description}
</p>
<div className="flex">
<div className="my-auto">
<div className="my-2">
<span className="font-extralight text-2xl inline-block align-middle mt-2 my-auto">
$ {product.price}
</span>


</div>
<div className="block ml-auto my-auto mt-0">
{" "}
Expand All @@ -79,7 +82,6 @@ const ProductDetail = () => {
className={styles.shoppingCartIcon}
aria-hidden="true"
/>

<div className="flex flex-col self-center">
<span className={styles.buttonText}>
{findCartItem ? "Remove from cart" : "Add to Cart"}
Expand All @@ -101,11 +103,16 @@ const ProductDetail = () => {
>
<HeartIcon className={styles.heartIcon} />
</button>
<div className='feed'>
<span><First/></span>
</div>
</div>
</div>
</div>
</div>

</div>

) : (
<Spinner />
)}
Expand Down
7 changes: 6 additions & 1 deletion src/Pages/ProductDetail/styles.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
max-h-max
w-full
py-4
my-auto
mb-auto
mt-0
px-4
object-scale-down
shadow-sm
Expand Down Expand Up @@ -138,4 +139,8 @@
.emptyStarIcon {
@apply
text-zinc-900/80
}
.feedback{

color:blue
}
1 change: 1 addition & 0 deletions src/Pages/Products/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Card from "../../Components/Card";

const Products = () => {
const {addToCart, items} = useCart()

const {addToFavorite, favoriteItems} = useFavorite()

const { productList, loading, setProductID, setCategory } = useProduct();
Expand Down
6 changes: 6 additions & 0 deletions src/chatbot/App.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

.btn img{
width:40px;
margin-top:20px;
}

61 changes: 61 additions & 0 deletions src/chatbot/First.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import React, { useState } from "react";
import SimpleForm from "./SimpleForm";
import "./App.css";
import { Link} from 'react-router-dom';
import Logo from './Logo.png'


const First = (props) => {
let [showChat, setShowChat] = useState(false);

const startChat = () => {
setShowChat(true);

};
const hideChat = () => {
setShowChat(false);
};

return (
<>
<div className="header">{/* <h2>My Application!!!</h2> */}</div>
<div className="main">
<div className="nav">{/* <h3>My Navigation</h3> */}</div>


<div className="content">
{/* <div style = {{padding:"20px"}}>
<h1>Content of my application will go here.....</h1>
<p>Sample content to fill the gap as much as possible. Sample content to fill the gap as much as possible.
Sample content to fill the gap as much as possible.Sample content to fill the gap as much as possible.</p>
<p>More content to fill the available area of the main contect. More content to fill the available area of the main contect.
More content to fill the available area of the main contect.More content to fill the available area of the main contect. </p>
</div> */}
</div>
</div>
{/* <div className = "footer">Footer</div> */}
<div className="bot">
<div style={{ display: showChat ? "" : "none" }}>
<SimpleForm/>
<Link to="/first" >
</Link>
</div>
{/* <div> {showChat ? <SimpleForm></SimpleForm> : null} </div> */}
<div>
{!showChat ? (
<button className="btn" onClick={() => startChat()}>
<img src={Logo} alt='Logo.png' />{" "}
</button>
) : (
<button className="btn" onClick={() => hideChat()}>
<img src={Logo} alt='Logo.png' />{""}
</button>
)}

</div>
</div>
</>
);
};

export default First;
Binary file added src/chatbot/Logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
55 changes: 55 additions & 0 deletions src/chatbot/Review.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React, { useState, useEffect } from "react";
import PropTypes from "prop-types";
import axios from "axios";


const Review = (props) => {
const [state, setState] = useState({ Product: "", gmail: "", Contact: "" });


useEffect(() => {
const { steps } = props;
const { Product, gmail, Contact } = steps;
setState({ Product, gmail, Contact })
axios.post(`http://localhost:3000/posts`,{
Contact,
gmail
})
}, []);

const { Product, gmail, Contact } = state;

return (
<div style={{ width: "100%" }}>
<h3>Summary</h3>
<table>
<tbody>
<tr>
<td>Product</td>
<td>{Product.value}</td>
</tr>
{/* <tr>
<td>Gmail</td>
<td>{gmail.value}</td>
</tr> */}
<tr>
<td>Contact Number</td>
<td>{Contact.value}</td>
</tr>
</tbody>
</table>
{/* <button type="submit" onClick={data}>submit</button> */}

</div>
);
};

Review.propTypes = {
steps: PropTypes.object
};

Review.defaultProps = {
steps: undefined
};

export default Review;
Loading