From 3b6a51b2ada73160e9da2c6f3dd7c0e827db349c Mon Sep 17 00:00:00 2001 From: Manasvi Gaur Date: Wed, 14 Feb 2024 11:39:22 +0530 Subject: [PATCH] Fixed Bug - Down Votes for a particular tutorial goes to negative #1175 --- docker-compose.yml | 6 ++++++ src/components/Card/CardWithPicture.jsx | 5 +++-- src/components/Card/CardWithoutPicture.jsx | 5 +++-- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 4943af63..87e23cb7 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -7,8 +7,11 @@ services: dockerfile: Dockerfile ports: - 5173:5173 + environment: + - CHOKIDAR_USEPOLLING=true volumes: - .:/app + - /app/node_modules/ networks: - main emulator: @@ -18,7 +21,10 @@ services: GCP_PROJECT: demo-sampark ports: - 5001:5001 + - 9099:9099 + - 9199:9199 - 9000:9000 + - 9005:9005 - 8080:8080 - 8085:8085 - 5000:5000 diff --git a/src/components/Card/CardWithPicture.jsx b/src/components/Card/CardWithPicture.jsx index e8cd65c2..e11656fb 100644 --- a/src/components/Card/CardWithPicture.jsx +++ b/src/components/Card/CardWithPicture.jsx @@ -74,7 +74,7 @@ const useStyles = makeStyles(theme => ({ export default function CardWithPicture({ tutorial }) { const classes = useStyles(); const [alignment, setAlignment] = React.useState("left"); - const [count, setCount] = useState(1); + const [count, setCount] = useState(0); const dispatch = useDispatch(); const firebase = useFirebase(); const firestore = useFirestore(); @@ -83,7 +83,8 @@ export default function CardWithPicture({ tutorial }) { }; const handleDecrement = () => { - setCount(count - 1); + if(count>0) + setCount(count - 1); }; const handleAlignment = (event, newAlignment) => { diff --git a/src/components/Card/CardWithoutPicture.jsx b/src/components/Card/CardWithoutPicture.jsx index abc4ecb0..4105aaf1 100644 --- a/src/components/Card/CardWithoutPicture.jsx +++ b/src/components/Card/CardWithoutPicture.jsx @@ -68,7 +68,7 @@ const useStyles = makeStyles(theme => ({ export default function CardWithoutPicture({ tutorial }) { const classes = useStyles(); const [alignment, setAlignment] = React.useState("left"); - const [count, setCount] = useState(1); + const [count, setCount] = useState(0); const dispatch = useDispatch(); const firebase = useFirebase(); const firestore = useFirestore(); @@ -77,7 +77,8 @@ export default function CardWithoutPicture({ tutorial }) { }; const handleDecrement = () => { - setCount(count - 1); + if(count>0) + setCount(count - 1); }; const handleAlignment = (event, newAlignment) => {