diff --git a/epoch_frontend/src/modules/Feed.js b/epoch_frontend/src/modules/Feed.js index f5a4b25..1db0ce6 100644 --- a/epoch_frontend/src/modules/Feed.js +++ b/epoch_frontend/src/modules/Feed.js @@ -29,7 +29,8 @@ export default function Feed({ posts, isInFavorites, isInHashtags, - hashtag + hashtag, + isInComments }) { const [isLoading, setIsLoading] = useState(true); @@ -372,7 +373,8 @@ export default function Feed({ setFileBlob={setFileBlob} setPostToEditId={setPostToEditId} setPostToEditCaption={setPostToEditCaption} - setPostToEdit={setPostToEdit}/> + setPostToEdit={setPostToEdit} + isInComments={isInComments}/> )) )} diff --git a/epoch_frontend/src/modules/Post.js b/epoch_frontend/src/modules/Post.js index c322b9f..0be1a53 100644 --- a/epoch_frontend/src/modules/Post.js +++ b/epoch_frontend/src/modules/Post.js @@ -12,7 +12,7 @@ import {favoritePost, removeFavoritePost, votePost, removeVotePost} from "../ser import ForumOutlinedIcon from '@mui/icons-material/ForumOutlined'; import ShareOutlinedIcon from '@mui/icons-material/ShareOutlined'; -export default function Post({post, postViewer, isInFavorites, setShowDeletePostPopup, setPostToDelete, setShowFavoritedByList, setShowVoteByList, favoritedByUsernameList, voteByUsernameList, setFavoritedByUsernameList, setVoteByUsernameList, showPostPopup, setShowPostPopup, setReleaseMonth, setReleaseDay, setReleaseYear, setReleaseHour, setReleaseMinute, setReleaseSecond, setFileBlob, setPostToEditId, setPostToEditCaption, setPostToEdit}) { +export default function Post({post, postViewer, isInFavorites, setShowDeletePostPopup, setPostToDelete, setShowFavoritedByList, setShowVoteByList, favoritedByUsernameList, voteByUsernameList, setFavoritedByUsernameList, setVoteByUsernameList, showPostPopup, setShowPostPopup, setReleaseMonth, setReleaseDay, setReleaseYear, setReleaseHour, setReleaseMinute, setReleaseSecond, setFileBlob, setPostToEditId, setPostToEditCaption, setPostToEdit, isInComments}) { const captionCharLimit = 240; const timeAllowedToEditInSeconds = 30; const [editable, setEditable] = useState(false); @@ -39,6 +39,7 @@ export default function Post({post, postViewer, isInFavorites, setShowDeletePost const [localFinalVoteByUsernameList, setLocalFinalVoteByUsernameList] = useState(voteByUsernameList); const [copiedMessage, setCopiedMessage] = useState(''); const [isMobile, setIsMobile] = useState( window.innerWidth <= 768); + const [notVisibleReason, setNotVisibleReason] = useState(null); useEffect(() => { @@ -227,6 +228,7 @@ export default function Post({post, postViewer, isInFavorites, setShowDeletePost for (let i = 0; i < usernames.length && !visible; i++) { if (postViewer && postViewer.username === usernames[i]) { visible = true; + setNotVisibleReason(null); } } @@ -234,12 +236,30 @@ export default function Post({post, postViewer, isInFavorites, setShowDeletePost { visible = postAdmin; } + + if (!visible) + { + setNotVisibleReason('You can not see this post because is is not dedicated to you.'); + } + else + { + setNotVisibleReason(null); + } } else { visible = true; + setNotVisibleReason(null); } } + else + { + setNotVisibleReason('You can not see this post because it is not in your favorites.'); + } + } + else + { + setNotVisibleReason('You can not see this post because it is not released yet.\n' + (post.release ? ' Release: ' + getReleaseFormat() : '')); } @@ -630,6 +650,7 @@ export default function Post({post, postViewer, isInFavorites, setShowDeletePost }, []); return ( + <>
{getReleaseFormat()}
+