diff --git a/src/components/post/post.module.css b/src/components/post/post.module.css index 0ff6cc29..60adcd93 100644 --- a/src/components/post/post.module.css +++ b/src/components/post/post.module.css @@ -191,6 +191,10 @@ color: var(--post-mobile-abbr-text-color); } +.stateString { + color: var(--post-mobile-abbr-text-color); +} + .postDesktop .summary .expandButtonWrapper { position: absolute; top: 8px; diff --git a/src/components/post/post.tsx b/src/components/post/post.tsx index 93836512..c5b9c4be 100644 --- a/src/components/post/post.tsx +++ b/src/components/post/post.tsx @@ -61,6 +61,11 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps) const account = useAccount(); const accountShortAddress = account?.author?.shortAddress; + const stateString = useStateString(post); + const loadingString = stateString && ( +
{stateString !== 'Failed' ? : stateString}
+ ); + return (
@@ -181,6 +186,12 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps) }} /> )} + {!cid && state === 'pending' && ( + <> +
+ {loadingString} + + )} )} {(replies.length > 5 || (pinned && replies.length > 0)) && !isInPostPage && ( @@ -375,6 +386,11 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps) const account = useAccount(); const accountShortAddress = account?.author?.shortAddress; + const stateString = useStateString(post); + const loadingString = stateString && ( +
{stateString !== 'Failed' ? : stateString}
+ ); + return (
@@ -448,6 +464,12 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps) }} /> )} + {!cid && state === 'pending' && ( + <> +
+ {loadingString} + + )} )}
diff --git a/src/views/pending-post/pending-post.module.css b/src/views/pending-post/pending-post.module.css deleted file mode 100644 index 76b18b4d..00000000 --- a/src/views/pending-post/pending-post.module.css +++ /dev/null @@ -1,16 +0,0 @@ -.stateString { - white-space: nowrap; - overflow: hidden; - text-overflow: ellipsis; - width: calc(100vw - 28px); - width: 100vw; - margin-top: 10px; - margin-left: 40px; -} - -@media (max-width: 640px) { - .stateString { - margin-top: 0px; - margin-left: 10px; - } -} \ No newline at end of file diff --git a/src/views/pending-post/pending-post.tsx b/src/views/pending-post/pending-post.tsx index c8724c39..0aab5e3b 100644 --- a/src/views/pending-post/pending-post.tsx +++ b/src/views/pending-post/pending-post.tsx @@ -1,17 +1,13 @@ import { useEffect } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import { useAccountComment } from '@plebbit/plebbit-react-hooks'; -import styles from './pending-post.module.css'; import Post from '../../components/post'; -import useStateString from '../../hooks/use-state-string'; -import LoadingEllipsis from '../../components/loading-ellipsis'; const PendingPost = () => { const { accountCommentIndex } = useParams<{ accountCommentIndex?: string }>(); const commentIndex = accountCommentIndex ? parseInt(accountCommentIndex) : undefined; const post = useAccountComment({ commentIndex }); const navigate = useNavigate(); - const stateString = useStateString(post); useEffect(() => window.scrollTo(0, 0), []); @@ -21,16 +17,7 @@ const PendingPost = () => { } }, [post, navigate]); - const loadingString = stateString && ( -
{stateString !== 'Failed' ? : stateString}
- ); - - return ( -
- - {loadingString} -
- ); + return ; }; export default PendingPost;