fix(post): prioritize 'failed' state over 'pending'

This commit is contained in:
plebeius.eth
2024-05-07 16:08:02 +02:00
parent 1a57d3ae53
commit fc459d9533
2 changed files with 10 additions and 11 deletions
-1
View File
@@ -77,7 +77,6 @@
} }
.postDesktop .postNumLink a:hover, .postDesktop .postNumLink span:hover, .replyDesktop .postNumLink a:hover, .replyDesktop .postNumLink span:hover { .postDesktop .postNumLink a:hover, .postDesktop .postNumLink span:hover, .replyDesktop .postNumLink a:hover, .replyDesktop .postNumLink span:hover {
cursor: pointer;
color: var(--button-desktop-text-color-hover); color: var(--button-desktop-text-color-hover);
} }
+10 -10
View File
@@ -142,7 +142,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
c/ c/
</Link> </Link>
{!cid ? ( {!cid ? (
<span className={styles.pendingCid}>{state === 'failed' ? 'Failed' : 'Pending'}</span> <span className={styles.pendingCid}>{state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'}</span>
) : ( ) : (
<span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}> <span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}>
{shortCid} {shortCid}
@@ -187,7 +187,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} /> <Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} />
</span> </span>
)} )}
{!cid && state === 'pending' && ( {!cid && state === 'pending' && stateString !== 'Failed' && (
<> <>
<br /> <br />
{loadingString} {loadingString}
@@ -195,7 +195,7 @@ const PostDesktop = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
)} )}
</blockquote> </blockquote>
)} )}
{!isDescription && !isRules && (replies.length > 5 || (pinned && replies.length > 0)) && !isInPostPage && ( {!isDescription && !isRules && !isPendingPostPage && (replies.length > 5 || (pinned && replies.length > 0)) && !isInPostPage && (
<span className={styles.summary}> <span className={styles.summary}>
<span className={styles.expandButtonWrapper}> <span className={styles.expandButtonWrapper}>
<span className={styles.expandButton} /> <span className={styles.expandButton} />
@@ -274,7 +274,7 @@ const ReplyDesktop = ({ reply, roles, openReplyModal }: PostProps) => {
c/ c/
</Link> </Link>
{!cid ? ( {!cid ? (
<span className={styles.pendingCid}>{state === 'failed' ? 'Failed' : 'Pending'}</span> <span className={styles.pendingCid}>{state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'}</span>
) : ( ) : (
<span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}> <span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}>
{shortCid} {shortCid}
@@ -350,7 +350,7 @@ const ReplyDesktop = ({ reply, roles, openReplyModal }: PostProps) => {
</> </>
)} )}
<Markdown content={content} /> <Markdown content={content} />
{!cid && state === 'pending' && ( {!cid && state === 'pending' && stateString !== 'Failed' && (
<> <>
<br /> <br />
{loadingString} {loadingString}
@@ -439,7 +439,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
c/ c/
</Link> </Link>
{!cid ? ( {!cid ? (
<span className={styles.pendingCid}>{state === 'failed' ? 'Failed' : 'Pending'}</span> <span className={styles.pendingCid}>{state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'}</span>
) : ( ) : (
<span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}> <span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}>
{shortCid} {shortCid}
@@ -469,7 +469,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
<Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} /> <Trans i18nKey={'comment_too_long'} shouldUnescape={true} components={{ 1: <Link to={`/p/${subplebbitAddress}/c/${cid}`} /> }} />
</span> </span>
)} )}
{!cid && state === 'pending' && ( {!cid && state === 'pending' && stateString !== 'Failed' && (
<> <>
<br /> <br />
{loadingString} {loadingString}
@@ -478,7 +478,7 @@ const PostMobile = ({ openReplyModal, post, roles, showAllReplies }: PostProps)
</blockquote> </blockquote>
)} )}
</div> </div>
{!isInPostPage && ( {!isInPostPage && !isPendingPostPage && (
<div className={styles.postLink}> <div className={styles.postLink}>
<span className={styles.info}> <span className={styles.info}>
{replyCount > 0 && `${replyCount} Replies`} {replyCount > 0 && `${replyCount} Replies`}
@@ -553,7 +553,7 @@ const ReplyMobile = ({ reply, roles, openReplyModal }: PostProps) => {
</Link> </Link>
</span> </span>
{!cid ? ( {!cid ? (
<span className={styles.pendingCid}>{state === 'failed' ? 'Failed' : 'Pending'}</span> <span className={styles.pendingCid}>{state === 'failed' || stateString === 'Failed' ? 'Failed' : 'Pending'}</span>
) : ( ) : (
<span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}> <span className={styles.replyToPost} title={t('reply_to_post')} onClick={() => openReplyModal && openReplyModal(cid)}>
{shortCid} {shortCid}
@@ -582,7 +582,7 @@ const ReplyMobile = ({ reply, roles, openReplyModal }: PostProps) => {
</> </>
)} )}
<Markdown content={content} /> <Markdown content={content} />
{!cid && state === 'pending' && ( {!cid && state === 'pending' && stateString !== 'Failed' && (
<> <>
<br /> <br />
{loadingString} {loadingString}