diff --git a/src/pages/posts/Post.js b/src/pages/posts/Post.js index 7913d39..5b54165 100644 --- a/src/pages/posts/Post.js +++ b/src/pages/posts/Post.js @@ -1,11 +1,14 @@ import React from "react"; -import {useCurrentUser} from "../../contexts/CurrentUserContext" +import { useCurrentUser } from "../../contexts/CurrentUserContext"; import styles from "../../styles/Post.module.css"; -import Card from 'react-bootstrap/Card'; -import { Media } from "react-bootstrap"; + +import Card from "react-bootstrap/Card"; +import Media from "react-bootstrap/Media"; import { Link } from "react-router-dom"; -import Avatar from "../../components/Avatar" +import Avatar from "../../components/Avatar"; +import OverlayTrigger from "react-bootstrap/OverlayTrigger"; +import Tooltip from "react-bootstrap/Tooltip"; const Post = (props) => { const { @@ -23,7 +26,7 @@ const Post = (props) => { postPage, } = props; - const currentUser = useCurrentUser; + const currentUser = useCurrentUser(); const is_owner = currentUser?.username === owner; return ( @@ -32,11 +35,53 @@ const Post = (props) => { + {owner} +
+ {updated_at} + {is_owner && postPage && "..."} +
+ + + + + {title && {title}} + {content && {content}} +
+ {is_owner ? ( + You can't like your own post!} + > + + + ) : like_id ? ( + {}}> + + + ) : currentUser ? ( + {}}> + + + ) : ( + Log in to like posts!} + > + + + )} + {likes_count} + + + + {comments_count} +
+
); }; -export default Post; +export default Post; \ No newline at end of file