Skip to content

Commit

Permalink
feat: Transition from upVote/downVote to like/dislike system for comm…
Browse files Browse the repository at this point in the history
…ents
  • Loading branch information
lokeshwar777 committed Jun 14, 2024
1 parent 501dc78 commit 5c4bc6c
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions src/components/TutorialPage/components/Commnets/Comment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ import {
import { makeStyles } from "@mui/styles";
import CardActions from "@mui/material/CardActions";
import MoreVertOutlinedIcon from "@mui/icons-material/MoreVertOutlined";
import ToggleButton from "@mui/lab/ToggleButton";
import ToggleButtonGroup from "@mui/lab/ToggleButtonGroup";
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
import React, {
useState,
useEffect,
Expand All @@ -29,6 +25,7 @@ import {
getCommentReply,
addComment
} from "../../../../store/actions/tutorialPageActions";
import CommentLikesDislikes from "../../../ui-helpers/CommentLikesDislikes";
const useStyles = makeStyles(() => ({
container: {
margin: "10px 0",
Expand All @@ -55,7 +52,6 @@ const useStyles = makeStyles(() => ({
const Comment = ({ id }) => {
const classes = useStyles();
const [showReplyfield, setShowReplyfield] = useState(false);
const [alignment, setAlignment] = React.useState("left");
const [count, setCount] = useState(1);
const firestore = useFirestore();
const firebase = useFirebase();
Expand Down Expand Up @@ -84,18 +80,6 @@ const Comment = ({ id }) => {

const [replies] = repliesArray.filter(replies => replies.comment_id == id);

const handleIncrement = () => {
setCount(count + 1);
};

const handleDecrement = () => {
setCount(count - 1);
};

const handleAlignment = (event, newAlignment) => {
setAlignment(newAlignment);
};

const handleSubmit = comment => {
const commentData = {
content: comment,
Expand Down Expand Up @@ -129,32 +113,7 @@ const Comment = ({ id }) => {
Reply
</Button>
)}
<ToggleButtonGroup
size="small"
className={classes.small}
value={alignment}
exclusive
onChange={handleAlignment}
aria-label="text alignment"
>
<ToggleButton
className={classes.small}
onClick={handleIncrement}
value="left"
aria-label="left aligned"
>
<KeyboardArrowUpIcon />
<span>{count}</span>
</ToggleButton>
<ToggleButton
className={classes.small}
onClick={handleDecrement}
value="center"
aria-label="centered"
>
<KeyboardArrowDownIcon />
</ToggleButton>
</ToggleButtonGroup>
<CommentLikesDislikes comment_id={data.comment_id} />
<IconButton aria-label="share" data-testId="MoreIcon">
<MoreVertOutlinedIcon />
</IconButton>
Expand Down

0 comments on commit 5c4bc6c

Please sign in to comment.