Skip to content

Commit

Permalink
removed unused code
Browse files Browse the repository at this point in the history
  • Loading branch information
abhishektiwari47 committed Nov 30, 2023
1 parent 94295d7 commit e909ed4
Show file tree
Hide file tree
Showing 15 changed files with 80 additions and 99 deletions.
4 changes: 1 addition & 3 deletions apps/client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import { useEffect, useState , lazy,Suspense } from 'react'
import reactLogo from './assets/react.svg'
import viteLogo from '/vite.svg'
import { useEffect, lazy } from 'react'
import './App.css'
import {BrowserRouter as Router, Route, Routes} from 'react-router-dom';
const Auth = lazy(() => import('./components/visitor/Authentication'));
Expand Down
44 changes: 21 additions & 23 deletions apps/client/src/components/buyer/AddBid.tsx
Original file line number Diff line number Diff line change
@@ -1,32 +1,30 @@
import { useParams ,useNavigate} from "react-router-dom";
import { useNavigate} from "react-router-dom";
import BackButton from "../../assets/svg/BackButton.svg";
import BackButton2 from "../../assets/svg/BackButton2.svg";
import BidButton from '../../assets/svg/BidButton.svg';
import mongoose from "mongoose";
import { constSelector, useRecoilState } from "recoil";
import { useRecoilState } from "recoil";
import { singleProductDataState, userData } from "../../data/ComponentData";
import React, { useEffect, useState } from "react";
import axios from "axios";
import { isDarkModeState } from "../../data/RelatedStates";

interface Bid {
amount: number,
userId: mongoose.Types.ObjectId,
}
interface Product {
_id:string;
name: string;
description: string;
originalPrice: number;
image: string;
maxBid: { type: number; required: true };
minBid: { type: number; required: true };
sold: boolean;
sellPrice: number;
sellerId: string;
buyerId: string;
bids: Bid[];
}
// interface Bid {
// amount: number,
// userId: mongoose.Types.ObjectId,
// }
// interface Product {
// _id:string;
// name: string;
// description: string;
// originalPrice: number;
// image: string;
// maxBid: { type: number; required: true };
// minBid: { type: number; required: true };
// sold: boolean;
// sellPrice: number;
// sellerId: string;
// buyerId: string;
// bids: Bid[];
// }
interface User {
fullName:string,
hostelName:string,
Expand All @@ -36,7 +34,7 @@ interface User {
function AddBid(){
const [isDarkMode] = useRecoilState(isDarkModeState)

const { id } = useParams<{ id: string }>();
// const { id } = useParams<{ id: string }>();
const [user] = useRecoilState(userData);
const [seller,setSeller] = useState<User>({
fullName:"",
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/components/buyer/YourBoughtProducts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import axios, { all } from "axios";
import mongoose from "mongoose";
import axios from "axios";
import { useEffect, useState } from "react";

type Product = {
Expand Down
44 changes: 14 additions & 30 deletions apps/client/src/components/seller/AddProduct.tsx
Original file line number Diff line number Diff line change
@@ -1,40 +1,20 @@
import { useParams ,useNavigate} from "react-router-dom";
import { useNavigate} from "react-router-dom";
import BackButton from "../../assets/svg/BackButton.svg";
import BackButton2 from "../../assets/svg/BackButton2.svg";
import BidButton from '../../assets/svg/BidButton.svg';
import mongoose from "mongoose";
import { constSelector, useRecoilState } from "recoil";
import { imageState, singleProductDataState, userData } from "../../data/ComponentData";
// import mongoose from "mongoose";
import { useRecoilState } from "recoil";
import { imageState } from "../../data/ComponentData";
import React, { useEffect, useState } from "react";
import axios from "axios";
import {activeListItemstate, cameraOpenState, isDarkModeState} from '../../data/RelatedStates';
import {activeListItemstate, isDarkModeState} from '../../data/RelatedStates';
import Folder from '../../assets/svg/Folder.svg';
import Camera from '../../assets/svg/Camera.svg';


interface Bid {
amount: number,
userId: mongoose.Types.ObjectId,
}
interface Product {
_id:string;
name: string;
description: string;
originalPrice: number;
image: string;
maxBid: { type: number; required: true };
minBid: { type: number; required: true };
sold: boolean;
sellPrice: number;
sellerId: string;
buyerId: string;
bids: Bid[];
}
interface User {
fullName:string,
hostelName:string,
hostelRoom:string,
}
// interface Bid {
// amount: number,
// userId: mongoose.Types.ObjectId,
// }

function AddProduct(){

Expand Down Expand Up @@ -93,6 +73,8 @@ const videoConstraints = {

const CameraView = () => {
const [image,setImage]=useRecoilState(imageState)
console.log(image);

const [picture, setPicture] = useState<string | null>(null);
const webcamRef = React.useRef<Webcam>(null);

Expand Down Expand Up @@ -197,6 +179,8 @@ const CameraView = () => {

const AddProductCard= ()=>{
const [activeListItem,setActiveListItem]=useRecoilState(activeListItemstate);
console.log(activeListItem);

const [name,setName]=useState('');
const [description,setDescription]=useState('');
const [originalPrice,setOriginalPrice]=useState(0);
Expand Down Expand Up @@ -236,7 +220,7 @@ const AddProductCard= ()=>{
alert("invalid credentials");
}
};
const [isDarkMode]= useRecoilState(isDarkModeState)
// const [isDarkMode]= useRecoilState(isDarkModeState)

return <div className="bg-white border-[1px] px-10 py-3 rounded border-[#8D8D8D]">
<h2 className="text-center text-[22px] ">Product Details</h2>
Expand Down
4 changes: 3 additions & 1 deletion apps/client/src/components/seller/ProductForSell.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import axios, { all } from "axios";
import axios from "axios";
import mongoose from "mongoose";
import { useEffect, useState } from "react";
import DeleteIcon from '../../assets/svg/DeleteIcon.svg';
Expand Down Expand Up @@ -35,6 +35,8 @@ function ProductForSell(){
{
console.log(id)
let obj = new mongoose.Types.ObjectId(id)
console.log(obj);

const response = await axios.delete(`http://ec2-15-206-194-131.ap-south-1.compute.amazonaws.com:4242/general/product/sold/${id}`,{

headers:{
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/visitor/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ function ProfilePhoto(props:propsType){
}

function Account(){
const [user,setUser] = useRecoilState(userData)
const [user] = useRecoilState(userData)
let renderEmoji:string[]=[];
let count =0;

Expand Down
1 change: 0 additions & 1 deletion apps/client/src/components/visitor/AddMoney.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { useRecoilState,atom } from "recoil";
import { userData } from "../../data/ComponentData";
import { useState } from "react";
import axios from "axios";
import { isDarkModeState } from "../../data/RelatedStates";

Expand Down
2 changes: 0 additions & 2 deletions apps/client/src/components/visitor/AllProducts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import axios from "axios";
import {useEffect} from 'react';
import { productListState, userData } from "../../data/ComponentData";
import { useRecoilState } from "recoil";
import mongoose from "mongoose";
import ProductCard from "./ProductCard";
import { buyState } from "../../data/RelatedStates";



Expand Down
6 changes: 3 additions & 3 deletions apps/client/src/components/visitor/Authentication.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@

import {Link,useNavigate} from 'react-router-dom';
import React, { useState } from 'react';
import {useNavigate} from 'react-router-dom';
import { useState } from 'react';
import axios from 'axios';
import BidhubDesign from '../../assets/svg/BidhubDesign.svg';
import { useRecoilState } from 'recoil';
import { isDarkModeState } from '../../data/RelatedStates';

function Auth(){
const [showComponentA, setShowComponentA] = useState(true);
const [isDarkMode,setIsDarkMode]=useRecoilState(isDarkModeState)
const [isDarkMode]=useRecoilState(isDarkModeState)
const toggleComponent = () => {
setShowComponentA(!showComponentA);
};
Expand Down
3 changes: 1 addition & 2 deletions apps/client/src/components/visitor/Display.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { useRecoilState } from "recoil"
import { lazy } from "react";
import { activeListItemstate, menuState } from "../../data/RelatedStates"
import AllProduct from "./AllProducts";
import AllYourBid from "../buyer/AllYourBids";
Expand All @@ -18,7 +17,7 @@ const {Account} = AccountComponent;

export function DisplayArea(){
const [activeListItem] = useRecoilState(activeListItemstate)
const [menuOpen,setMenuOpen]=useRecoilState(menuState)
const [menuOpen]=useRecoilState(menuState)
const renderPage = ()=>{
switch(activeListItem){
case 0:
Expand Down
41 changes: 20 additions & 21 deletions apps/client/src/components/visitor/Home.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
import { useRecoilState, useRecoilValue } from "recoil";
import imageLink from "../../assets/imageLink";

import { useRecoilState } from "recoil";
import {productListState, userData} from "../../data/ComponentData"
import axios from "axios";
import { useEffect, useState } from "react";
import { useEffect } from "react";
import AddMoneyIcon from '../../assets/svg/AddMoneyIcon.svg';
import { activeListItemstate, buyProductState, buyState, isDarkModeState, logoutState, menuState } from "../../data/RelatedStates";
import MenuList from "./MenuList";
import { VerticalLine } from "../common";
import { DisplayArea } from "./Display";
import mongoose from "mongoose";
import { Navigate, useNavigate } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import UserAccount from './Account';
const {ProfilePhoto}=UserAccount;
import SearchIcon from '../../assets/svg/SearchIcon.svg';
Expand Down Expand Up @@ -78,7 +76,7 @@ function Home()
const [productList,setProductList]=useRecoilState(productListState)
const [menuOpen,setMenuOpen] = useRecoilState(menuState)

const [productId,setProductId] = useRecoilState(buyProductState)
const [productId] = useRecoilState(buyProductState)
async function buyAProduct()
{
const authorization = "bearer "+localStorage.getItem('token');
Expand Down Expand Up @@ -148,7 +146,8 @@ function Home()
},[])

const [activeListItem,setActiveListItem] = useRecoilState(activeListItemstate)

console.log(activeListItem);

const searchHolder = `Hi ${user.username.toString()} , search for a here...`;

return <div className="p-1 h-[100vh] w-[100%]" style={{backgroundColor:(isDarkMode)?"#03001C":'white'}}>
Expand Down Expand Up @@ -198,20 +197,20 @@ function Home()
</main>
</div>
}
type userType = {
userId: string;
username: string;
password: string;
balance: number;
fullName: string;
hostelName: string;
hostelRoom: string;
imageLink: string;
productId: never[];}
// type userType = {
// userId: string;
// username: string;
// password: string;
// balance: number;
// fullName: string;
// hostelName: string;
// hostelRoom: string;
// imageLink: string;
// productId: never[];}

type propsType = {
user:userType;
dimention:number;
}
// type propsType = {
// user:userType;
// dimention:number;
// }

export default Home;
6 changes: 4 additions & 2 deletions apps/client/src/components/visitor/MenuList.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { useRecoilState } from "recoil"
import { activeListItemstate, isDarkModeState, logoutState, menuState } from "../../data/RelatedStates"
import { VerticalLine } from "../common"
import { useState } from "react";
// import { VerticalLine } from "../common"
// import { useState } from "react";

function MenuList(){
const [isDialogOpen, setDialogOpen] = useRecoilState(logoutState);
console.log(isDialogOpen);

const [menuOpen,setMenuOpen] = useRecoilState(menuState)
const openDialog = () => {
setDialogOpen(true);
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/components/visitor/NoMatch.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from "react";
// import React from "react";

function NoMatch(){
return <>
Expand Down
15 changes: 9 additions & 6 deletions apps/client/src/components/visitor/ProductCard.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import mongoose, { mongo } from "mongoose";
import mongoose from "mongoose";
import { useRecoilState } from "recoil";
import { buyProductState, buyState } from "../../data/RelatedStates";
import axios from "axios";
import { productListState,singleProductDataState, userData } from "../../data/ComponentData";
import { buyState } from "../../data/RelatedStates";

import { singleProductDataState } from "../../data/ComponentData";
import { useNavigate } from "react-router-dom";

interface Bid {
Expand All @@ -29,11 +29,14 @@ interface Bid {

function ProductCard(allProducts:{data:Product,userId:string}){
const navigate = useNavigate();
const [user,setUser] = useRecoilState(userData)
// const [user,setUser] = useRecoilState(userData)
const [isBuyPressed, setBuyPressed] = useRecoilState(buyState);
const [productId,setProductId] = useRecoilState(buyProductState);
console.log(isBuyPressed);

// const [productId,setProductId] = useRecoilState(buyProductState);
const {data,userId} = allProducts
const [productData,setProductData] = useRecoilState(singleProductDataState);
console.log(productData);

function getUserBid(productBid:Bid[], userId:string) {
if (userId === "") {
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/data/ComponentData.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { atom,selector } from "recoil";
import { atom } from "recoil";
import mongoose from 'mongoose';

const userData = atom({
Expand Down

0 comments on commit e909ed4

Please sign in to comment.