|
| 1 | +import * as S from "@chakra-ui/react"; |
| 2 | +import { Skeleton, useMediaQuery, useToast } from "@chakra-ui/react"; |
| 3 | +import { ParsedData } from "draftjs-raw-parser"; |
1 | 4 | import React, { useEffect, useState } from "react";
|
2 | 5 | import { connect } from "react-redux";
|
| 6 | +import styled, { css } from "styled-components"; |
| 7 | +import { postComment } from "../../../actions/commentAction"; |
3 | 8 | import {
|
| 9 | + getLikedPosts, |
4 | 10 | getPost,
|
5 | 11 | likePost,
|
6 |
| - getLikedPosts, |
| 12 | + reallyGetAllPosts, |
7 | 13 | setCurrentPost,
|
8 | 14 | } from "../../../actions/getPostAction";
|
9 | 15 | import { showNav } from "../../../actions/navAction";
|
10 |
| -import { ParsedData } from "draftjs-raw-parser"; |
11 | 16 | import { getThatProfileE } from "../../../actions/profileAction";
|
12 |
| -import { reallyGetAllPosts } from "../../../actions/getPostAction"; |
13 |
| -import { postComment } from "../../../actions/commentAction"; |
14 | 17 | import Comment from "../../comment/Comment";
|
15 |
| -import * as S from "@chakra-ui/react"; |
16 |
| -import styled, { css } from "styled-components"; |
17 |
| -import { useToast } from "@chakra-ui/react"; |
18 |
| -import { useMediaQuery } from "@chakra-ui/react"; |
19 | 18 |
|
20 | 19 | const Post = ({
|
21 |
| - post: { currentPost, openedPost, likedStatus, likedPost }, |
| 20 | + post: { currentPost, openedPost, likedStatus, likedPost, loadingPost }, |
22 | 21 | getPost,
|
23 | 22 | likePost,
|
24 | 23 | getLikedPosts,
|
25 | 24 | auth,
|
26 | 25 | showNav,
|
27 | 26 | history,
|
28 |
| - getThatProfileE, |
29 |
| - reallyGetAllPosts, |
30 | 27 | setCurrentPost,
|
31 | 28 | comment,
|
32 | 29 | }) => {
|
@@ -99,57 +96,65 @@ const Post = ({
|
99 | 96 | };
|
100 | 97 |
|
101 | 98 | const getThatP = () => {
|
102 |
| - // getThatProfileE(openedPost.user); |
103 |
| - // reallyGetAllPosts(openedPost.user); |
104 | 99 | history.push(`/dashboard/home/${openedPost.name}/${openedPost.user}`);
|
105 | 100 | };
|
106 | 101 |
|
| 102 | + console.log(openedPost); |
| 103 | + |
107 | 104 | return (
|
108 | 105 | <React.Fragment>
|
109 | 106 | <S.Flex
|
110 | 107 | flexDir="column"
|
111 | 108 | px={isLargerThan500 ? "400px" : "50px"}
|
112 | 109 | w="100vw"
|
113 | 110 | >
|
114 |
| - <S.Heading fontSize={["35", "50", "80"]} color="gray.900"> |
115 |
| - {post.heading} |
116 |
| - </S.Heading> |
| 111 | + {loadingPost ? ( |
| 112 | + <Skeleton h="80px" mt="30px"></Skeleton> |
| 113 | + ) : ( |
| 114 | + <S.Heading mt="30px" color="#d6d6d6" fontSize="65px"> |
| 115 | + {post.heading} |
| 116 | + </S.Heading> |
| 117 | + )} |
117 | 118 | <S.Flex flexDir="column">
|
118 | 119 | {openedPost.user ? (
|
119 | 120 | <S.Box
|
120 | 121 | onClick={getThatP}
|
121 | 122 | fontSize={["15px", "23px"]}
|
122 |
| - color="gray.700" |
| 123 | + color="#d6d6d690" |
123 | 124 | mb="10px"
|
124 | 125 | >
|
125 | 126 | {post.name}
|
126 | 127 | </S.Box>
|
127 | 128 | ) : (
|
128 |
| - <span>No id</span> |
| 129 | + <Skeleton h="30px" w="300px" mt="0.5rem"></Skeleton> |
| 130 | + )} |
| 131 | + {loadingPost ? ( |
| 132 | + <Skeleton h="30px" w="200px" my="0.5rem"></Skeleton> |
| 133 | + ) : ( |
| 134 | + <S.Flex alignItems="center" mb="10px"> |
| 135 | + <S.Text fontSize={["15", "18"]}>{"7min"}</S.Text> |
| 136 | + <span |
| 137 | + style={{ |
| 138 | + width: "5px", |
| 139 | + height: "5px", |
| 140 | + borderRadius: "100%", |
| 141 | + backgroundColor: "#454545", |
| 142 | + margin: "0 10px 0 10px", |
| 143 | + }} |
| 144 | + ></span> |
| 145 | + <i |
| 146 | + onClick={likeThisPost} |
| 147 | + className={`fa${likedBtn() ? "s" : "r"} fa-heart`} |
| 148 | + style={ |
| 149 | + likedBtn() |
| 150 | + ? { color: "rgb(255, 0, 106)", fontSize: "25px" } |
| 151 | + : { fontSize: isLargerThan500 ? "25px" : "" } |
| 152 | + } |
| 153 | + ></i> |
| 154 | + </S.Flex> |
129 | 155 | )}
|
130 |
| - <S.Flex alignItems="center" mb="10px"> |
131 |
| - <S.Text fontSize={["15", "18"]}>{"7min"}</S.Text> |
132 |
| - <span |
133 |
| - style={{ |
134 |
| - width: "5px", |
135 |
| - height: "5px", |
136 |
| - borderRadius: "100%", |
137 |
| - backgroundColor: "#454545", |
138 |
| - margin: "0 10px 0 10px", |
139 |
| - }} |
140 |
| - ></span> |
141 |
| - <i |
142 |
| - onClick={likeThisPost} |
143 |
| - className={`fa${likedBtn() ? "s" : "r"} fa-heart`} |
144 |
| - style={ |
145 |
| - likedBtn() |
146 |
| - ? { color: "rgb(255, 0, 106)", fontSize: "25px" } |
147 |
| - : { fontSize: isLargerThan500 ? "25px" : "" } |
148 |
| - } |
149 |
| - ></i> |
150 |
| - </S.Flex> |
151 | 156 | </S.Flex>
|
152 |
| - <S.Flex> |
| 157 | + <S.Flex mt="0.5rem"> |
153 | 158 | <S.Image
|
154 | 159 | src={post && `${post.image}`}
|
155 | 160 | fallbackSrc="https://i.ibb.co/RBT25fY/default-fallback-image.png"
|
|
0 commit comments