mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
style(mod queue): flatten feed items, add View Thread button for replies
This commit is contained in:
@@ -412,6 +412,9 @@ const PostInfo = ({
|
|||||||
)}
|
)}
|
||||||
{isModQueue && (
|
{isModQueue && (
|
||||||
<span className={styles.modQueueActions}>
|
<span className={styles.modQueueActions}>
|
||||||
|
<span className={styles.modQueueTypeField}>
|
||||||
|
{capitalize(t('type'))}: {capitalize(t(isReply ? 'reply' : 'post'))}
|
||||||
|
</span>
|
||||||
{modQueueStatus === 'approved' ? (
|
{modQueueStatus === 'approved' ? (
|
||||||
<span className={styles.modQueueStatusApproved}>{t('approved')}</span>
|
<span className={styles.modQueueStatusApproved}>{t('approved')}</span>
|
||||||
) : modQueueStatus === 'rejected' ? (
|
) : modQueueStatus === 'rejected' ? (
|
||||||
@@ -425,6 +428,15 @@ const PostInfo = ({
|
|||||||
<LoadingEllipsis string={t('publishing')} />
|
<LoadingEllipsis string={t('publishing')} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{isReply && boardPath && (post?.threadCid || post?.parentCid) && (
|
||||||
|
<span className={styles.modQueueButtonWrapper}>
|
||||||
|
[
|
||||||
|
<Link to={`/${boardPath}/thread/${post.threadCid || post.parentCid}`} className={styles.modQueueActionButton}>
|
||||||
|
{t('view_thread')}
|
||||||
|
</Link>
|
||||||
|
]
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
<span className={styles.modQueueButtonWrapper}>
|
<span className={styles.modQueueButtonWrapper}>
|
||||||
[
|
[
|
||||||
<button className={styles.modQueueActionButton} onClick={onApprove} disabled={isPublishing}>
|
<button className={styles.modQueueActionButton} onClick={onApprove} disabled={isPublishing}>
|
||||||
|
|||||||
@@ -566,7 +566,7 @@ const PostMobile = ({
|
|||||||
onReject,
|
onReject,
|
||||||
}: PostProps) => {
|
}: PostProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { author, cid, pinned, postCid, replyCount, state, subplebbitAddress } = post || {};
|
const { author, cid, parentCid, pinned, postCid, replyCount, state, subplebbitAddress } = post || {};
|
||||||
const params = useParams();
|
const params = useParams();
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const navigationType = useNavigationType();
|
const navigationType = useNavigationType();
|
||||||
@@ -625,6 +625,7 @@ const PostMobile = ({
|
|||||||
|
|
||||||
const stateString = useStateString(post) || t('loading_post');
|
const stateString = useStateString(post) || t('loading_post');
|
||||||
const hasFailedState = state === 'failed';
|
const hasFailedState = state === 'failed';
|
||||||
|
const isReply = !!parentCid;
|
||||||
|
|
||||||
// Filter out deleted replies with no children for both virtuoso and non-virtuoso rendering
|
// Filter out deleted replies with no children for both virtuoso and non-virtuoso rendering
|
||||||
const filteredReplies = repliesForRender.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)));
|
const filteredReplies = repliesForRender.filter((reply) => !(reply.deleted && (reply.replyCount === 0 || !reply.replyCount)));
|
||||||
@@ -732,8 +733,13 @@ const PostMobile = ({
|
|||||||
{!isInPostView && !isInPendingPostView && (showReplies || isModQueue) && (
|
{!isInPostView && !isInPendingPostView && (showReplies || isModQueue) && (
|
||||||
<div className={styles.postLink}>
|
<div className={styles.postLink}>
|
||||||
<span className={styles.info}>
|
<span className={styles.info}>
|
||||||
{replyCount > 0 && `${replyCount} Replies`}
|
{[
|
||||||
{linksCount > 0 && ` / ${linksCount} ${requirePostLinkIsMedia ? 'Images' : 'Links'}`}
|
isModQueue ? `${capitalize(t('type'))}: ${capitalize(t(isReply ? 'reply' : 'post'))}` : null,
|
||||||
|
replyCount > 0 ? `${replyCount} Replies` : null,
|
||||||
|
linksCount > 0 ? `${linksCount} ${requirePostLinkIsMedia ? 'Images' : 'Links'}` : null,
|
||||||
|
]
|
||||||
|
.filter(Boolean)
|
||||||
|
.join(' / ')}
|
||||||
</span>
|
</span>
|
||||||
{isModQueue ? (
|
{isModQueue ? (
|
||||||
<div className={styles.modQueueActions}>
|
<div className={styles.modQueueActions}>
|
||||||
@@ -750,6 +756,11 @@ const PostMobile = ({
|
|||||||
<LoadingEllipsis string={t('publishing')} />
|
<LoadingEllipsis string={t('publishing')} />
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
|
{isReply && boardPath && (post?.threadCid || post?.parentCid) && (
|
||||||
|
<Link to={`/${boardPath}/thread/${post.threadCid || post.parentCid}`} className={`button ${styles.approveButton}`}>
|
||||||
|
{t('view_thread')}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
<button className={`button ${styles.approveButton}`} onClick={onApprove} disabled={isPublishing}>
|
<button className={`button ${styles.approveButton}`} onClick={onApprove} disabled={isPublishing}>
|
||||||
{t('approve')}
|
{t('approve')}
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import React, { useMemo, useState, useEffect, useCallback, memo } from 'react';
|
import React, { useMemo, useState, useEffect, useCallback, memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useParams, Link } from 'react-router-dom';
|
import { useParams, Link } from 'react-router-dom';
|
||||||
import { useFeed, Comment, usePublishCommentModeration, useEditedComment, useSubplebbit, useComment } from '@bitsocialhq/bitsocial-react-hooks';
|
import { useFeed, Comment, usePublishCommentModeration, useEditedComment, useSubplebbit } from '@bitsocialhq/bitsocial-react-hooks';
|
||||||
import { Virtuoso } from 'react-virtuoso';
|
import { Virtuoso } from 'react-virtuoso';
|
||||||
import styles from './mod-queue.module.css';
|
import styles from './mod-queue.module.css';
|
||||||
import useModQueueStore from '../../stores/use-mod-queue-store';
|
import useModQueueStore from '../../stores/use-mod-queue-store';
|
||||||
@@ -432,18 +432,8 @@ const ModQueueFeedPost = ({ comment }: { comment: Comment }) => {
|
|||||||
const { editedComment } = useEditedComment({ comment });
|
const { editedComment } = useEditedComment({ comment });
|
||||||
const displayComment = editedComment || comment;
|
const displayComment = editedComment || comment;
|
||||||
const { status, errorMessage, isPublishing, handleApprove, handleReject } = useModQueueActions(displayComment);
|
const { status, errorMessage, isPublishing, handleApprove, handleReject } = useModQueueActions(displayComment);
|
||||||
const { parentCid } = displayComment;
|
|
||||||
|
|
||||||
// Fetch parent comment if this is a reply
|
|
||||||
const parentComment = useComment({ commentCid: parentCid });
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
|
||||||
{parentCid && parentComment && (
|
|
||||||
<div style={{ marginBottom: '10px', paddingLeft: '20px', borderLeft: '2px solid var(--mod-queue-alert-color, #ccc)' }}>
|
|
||||||
<Post post={parentComment} showAllReplies={false} showReplies={false} isModQueue={false} />
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
<Post
|
<Post
|
||||||
post={displayComment}
|
post={displayComment}
|
||||||
showAllReplies={false}
|
showAllReplies={false}
|
||||||
@@ -455,7 +445,6 @@ const ModQueueFeedPost = ({ comment }: { comment: Comment }) => {
|
|||||||
onApprove={handleApprove}
|
onApprove={handleApprove}
|
||||||
onReject={handleReject}
|
onReject={handleReject}
|
||||||
/>
|
/>
|
||||||
</>
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -196,6 +196,10 @@
|
|||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.modQueueTypeField {
|
||||||
|
font-weight: 400;
|
||||||
|
}
|
||||||
|
|
||||||
.modQueueButtonWrapper {
|
.modQueueButtonWrapper {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user