Skip to content
Merged
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
149 changes: 39 additions & 110 deletions package-lock.json

Large diffs are not rendered by default.

20 changes: 16 additions & 4 deletions src/component/Home Page/TweetComp.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,24 @@ function Tweet(props) {
const [tweetCount, setTweetCount] = useState(props.likeCount)
const [replyCount, setReplyCount] = useState(props.replyCount)
const [replyingto, setReplyingto] = useState([])
const { tweetData } = useSelector((s) => s.TweetFeedReducer)
useEffect(() => {
if (props.replies != null)
if (localStorage.getItem('idx')==props.number) {
console.log("hi");
const index = localStorage.getItem('idx');
setReplyCount(replyCount+1);
localStorage.removeItem('idx')
}
}, [tweetData]);

useEffect(() => {
if (props.replies != null){
setReplyingto(props.replies)
else
}
else{
setReplyingto([])
}
}, [props.replies])

useEffect(() => {
setTweetCount(props.likeCount)
if (props.LIKES) {
Expand Down Expand Up @@ -120,7 +131,8 @@ function Tweet(props) {
}

function handleTweetReply(tweetid, name, image, video, text) {
setReplyCount(replyCount=> replyCount+1)
// setReplyCount(replyCount=> replyCount+1)
localStorage.setItem('idx',props.number)
dispatch(RetweetDetails(tweetid, name, video, text, image))
sessionStorage.setItem("retweetId", tweetid)
setOPacity()
Expand Down
2 changes: 1 addition & 1 deletion src/component/Home Page/createTweet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function CreateTweet(props) {

setSendImage(e.target.files[0]);
simulateUploadProgress(e.target.files[0], true);
}
}
const simulateUploadProgress = (file, isImage) => {
const totalSize = file.size;
let uploadedSize = 0;
Expand Down
3 changes: 2 additions & 1 deletion src/component/Home Page/homePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import Tweetsearch from "../Sidebar/Tweetsearch.jsx";
import { useNavigate } from "react-router";
import localStorage from "redux-persist/es/storage";

function HomePage() {
const dispatch = useDispatch();
Expand All @@ -22,7 +23,7 @@ function HomePage() {
if(!isUser)
navigate("/login")
},[isUser])

const { response } = useSelector((t) => t.TweetCreateReducer)
useEffect(() => {
dispatch(TweetFeedAction())
Expand Down
2 changes: 2 additions & 0 deletions src/react-redux/actions/Replies.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import BaseUrl from "./BaseUrl"
import { ToastContainer, toast } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';
import { TweetFeedAction } from "./Tweets";

export const ReplyToTweet = (formData) => {
const accessToken = localStorage.getItem("access token")
Expand All @@ -23,6 +24,7 @@ export const ReplyToTweet = (formData) => {
type: "REPLY_TWEET_YES",
payload: Res
})
dispatch(TweetFeedAction())
})
.catch((err) => {
toast.error(`${err.response.data.msg}`, {
Expand Down
2 changes: 1 addition & 1 deletion src/react-redux/actions/Tweets.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const TweetFeedAction = () => {
})
})
.catch((err) => {
dispatch({
dispatch({
type: "Tweet_Feed_Failed",
payload: err
})
Expand Down
3 changes: 3 additions & 0 deletions src/react-redux/reducers/ReplyReducer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const initialState = {
nameInReply: [],
replyShow: false,
showName: false,
success:false
};

export const ReplyReducer = (state = initialState, action) => {
Expand All @@ -21,6 +22,7 @@ export const ReplyReducer = (state = initialState, action) => {
loading: false,
responseT: action.payload.data.msg,
errorT: "",
success:true
};
}
case "REPLY_TWEET_NO": {
Expand All @@ -30,6 +32,7 @@ export const ReplyReducer = (state = initialState, action) => {
loading: false,
errorT: action.payload.data.msg,
responseT: "",
success:false
};
}
case "VIEW_REPLY_TWEET_YES": {
Expand Down