mirror of
https://github.com/bitsocialnet/5chan.git
synced 2026-08-03 07:41:04 +02:00
not needed for now
This commit is contained in:
@@ -64,7 +64,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.numberHeader,
|
.numberHeader,
|
||||||
.boardHeader,
|
|
||||||
.excerptHeader,
|
.excerptHeader,
|
||||||
.timeHeader,
|
.timeHeader,
|
||||||
.actionsHeader {
|
.actionsHeader {
|
||||||
@@ -77,11 +76,6 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.boardHeader {
|
|
||||||
width: 50px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.excerptHeader {
|
.excerptHeader {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
}
|
}
|
||||||
@@ -117,7 +111,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.number,
|
.number,
|
||||||
.board,
|
|
||||||
.excerpt,
|
.excerpt,
|
||||||
.time,
|
.time,
|
||||||
.actions {
|
.actions {
|
||||||
@@ -129,7 +122,6 @@
|
|||||||
|
|
||||||
/* Odd rows - theme-specific background colors applied to cells */
|
/* Odd rows - theme-specific background colors applied to cells */
|
||||||
:global(body.yotsuba) .rowOdd .number,
|
:global(body.yotsuba) .rowOdd .number,
|
||||||
:global(body.yotsuba) .rowOdd .board,
|
|
||||||
:global(body.yotsuba) .rowOdd .excerpt,
|
:global(body.yotsuba) .rowOdd .excerpt,
|
||||||
:global(body.yotsuba) .rowOdd .time,
|
:global(body.yotsuba) .rowOdd .time,
|
||||||
:global(body.yotsuba) .rowOdd .actions {
|
:global(body.yotsuba) .rowOdd .actions {
|
||||||
@@ -137,7 +129,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(body.yotsuba-b) .rowOdd .number,
|
:global(body.yotsuba-b) .rowOdd .number,
|
||||||
:global(body.yotsuba-b) .rowOdd .board,
|
|
||||||
:global(body.yotsuba-b) .rowOdd .excerpt,
|
:global(body.yotsuba-b) .rowOdd .excerpt,
|
||||||
:global(body.yotsuba-b) .rowOdd .time,
|
:global(body.yotsuba-b) .rowOdd .time,
|
||||||
:global(body.yotsuba-b) .rowOdd .actions {
|
:global(body.yotsuba-b) .rowOdd .actions {
|
||||||
@@ -145,7 +136,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(body.futaba) .rowOdd .number,
|
:global(body.futaba) .rowOdd .number,
|
||||||
:global(body.futaba) .rowOdd .board,
|
|
||||||
:global(body.futaba) .rowOdd .excerpt,
|
:global(body.futaba) .rowOdd .excerpt,
|
||||||
:global(body.futaba) .rowOdd .time,
|
:global(body.futaba) .rowOdd .time,
|
||||||
:global(body.futaba) .rowOdd .actions {
|
:global(body.futaba) .rowOdd .actions {
|
||||||
@@ -153,7 +143,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(body.burichan) .rowOdd .number,
|
:global(body.burichan) .rowOdd .number,
|
||||||
:global(body.burichan) .rowOdd .board,
|
|
||||||
:global(body.burichan) .rowOdd .excerpt,
|
:global(body.burichan) .rowOdd .excerpt,
|
||||||
:global(body.burichan) .rowOdd .time,
|
:global(body.burichan) .rowOdd .time,
|
||||||
:global(body.burichan) .rowOdd .actions {
|
:global(body.burichan) .rowOdd .actions {
|
||||||
@@ -161,7 +150,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(body.tomorrow) .rowOdd .number,
|
:global(body.tomorrow) .rowOdd .number,
|
||||||
:global(body.tomorrow) .rowOdd .board,
|
|
||||||
:global(body.tomorrow) .rowOdd .excerpt,
|
:global(body.tomorrow) .rowOdd .excerpt,
|
||||||
:global(body.tomorrow) .rowOdd .time,
|
:global(body.tomorrow) .rowOdd .time,
|
||||||
:global(body.tomorrow) .rowOdd .actions {
|
:global(body.tomorrow) .rowOdd .actions {
|
||||||
@@ -169,7 +157,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
:global(body.photon) .rowOdd .number,
|
:global(body.photon) .rowOdd .number,
|
||||||
:global(body.photon) .rowOdd .board,
|
|
||||||
:global(body.photon) .rowOdd .excerpt,
|
:global(body.photon) .rowOdd .excerpt,
|
||||||
:global(body.photon) .rowOdd .time,
|
:global(body.photon) .rowOdd .time,
|
||||||
:global(body.photon) .rowOdd .actions {
|
:global(body.photon) .rowOdd .actions {
|
||||||
@@ -181,12 +168,6 @@
|
|||||||
flex-shrink: 0;
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board {
|
|
||||||
width: 50px;
|
|
||||||
flex-shrink: 0;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.excerpt {
|
.excerpt {
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
@@ -323,11 +304,6 @@ span.reject:hover {
|
|||||||
padding: 8px;
|
padding: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.board {
|
|
||||||
width: auto;
|
|
||||||
margin-right: 8px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.time {
|
.time {
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
width: auto;
|
width: auto;
|
||||||
|
|||||||
@@ -47,14 +47,13 @@ const ModQueueFooter = ({ hasMore, subplebbitAddresses }: ModQueueFooterProps) =
|
|||||||
|
|
||||||
interface ModQueueRowProps {
|
interface ModQueueRowProps {
|
||||||
comment: Comment;
|
comment: Comment;
|
||||||
showBoardColumn?: boolean;
|
|
||||||
isOdd?: boolean;
|
isOdd?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track which action was initiated to show appropriate completion message
|
// Track which action was initiated to show appropriate completion message
|
||||||
type ModerationAction = 'approve' | 'reject' | null;
|
type ModerationAction = 'approve' | 'reject' | null;
|
||||||
|
|
||||||
const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQueueRowProps) => {
|
const ModQueueRow = ({ comment, isOdd = false }: ModQueueRowProps) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { getAlertThresholdSeconds } = useModQueueStore();
|
const { getAlertThresholdSeconds } = useModQueueStore();
|
||||||
const [initiatedAction, setInitiatedAction] = useState<ModerationAction>(null);
|
const [initiatedAction, setInitiatedAction] = useState<ModerationAction>(null);
|
||||||
@@ -70,7 +69,6 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue
|
|||||||
const alreadyApproved = approved === true;
|
const alreadyApproved = approved === true;
|
||||||
const alreadyRejected = removed === true;
|
const alreadyRejected = removed === true;
|
||||||
|
|
||||||
const boardPath = useBoardPath(subplebbitAddress);
|
|
||||||
const timeWaiting = Date.now() / 1000 - timestamp;
|
const timeWaiting = Date.now() / 1000 - timestamp;
|
||||||
const alertThresholdSeconds = getAlertThresholdSeconds();
|
const alertThresholdSeconds = getAlertThresholdSeconds();
|
||||||
const isOverThreshold = timeWaiting > alertThresholdSeconds;
|
const isOverThreshold = timeWaiting > alertThresholdSeconds;
|
||||||
@@ -145,6 +143,7 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue
|
|||||||
const approveFailed = initiatedAction === 'approve' && approveState === 'failed';
|
const approveFailed = initiatedAction === 'approve' && approveState === 'failed';
|
||||||
const rejectFailed = initiatedAction === 'reject' && rejectState === 'failed';
|
const rejectFailed = initiatedAction === 'reject' && rejectState === 'failed';
|
||||||
|
|
||||||
|
const boardPath = useBoardPath(subplebbitAddress);
|
||||||
const rawExcerpt = title || content || (getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link) ? t('image') : t('no_content'));
|
const rawExcerpt = title || content || (getHasThumbnail(getCommentMediaInfo(link, thumbnailUrl, linkWidth, linkHeight), link) ? t('image') : t('no_content'));
|
||||||
const excerpt = rawExcerpt.length > 101 ? rawExcerpt.slice(0, 98) + '...' : rawExcerpt;
|
const excerpt = rawExcerpt.length > 101 ? rawExcerpt.slice(0, 98) + '...' : rawExcerpt;
|
||||||
const threadTargetCid = threadCid || cid;
|
const threadTargetCid = threadCid || cid;
|
||||||
@@ -195,7 +194,6 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue
|
|||||||
return (
|
return (
|
||||||
<div className={`${styles.row} ${isOdd ? styles.rowOdd : ''}`}>
|
<div className={`${styles.row} ${isOdd ? styles.rowOdd : ''}`}>
|
||||||
<div className={styles.number}>{number ?? 'N/A'}</div>
|
<div className={styles.number}>{number ?? 'N/A'}</div>
|
||||||
{showBoardColumn && <div className={styles.board}>{boardPath ? <Link to={`/${boardPath}`}>/{boardPath}/</Link> : <span>—</span>}</div>}
|
|
||||||
<div className={styles.excerpt}>
|
<div className={styles.excerpt}>
|
||||||
{postUrl ? (
|
{postUrl ? (
|
||||||
<Link to={postUrl} title={excerpt}>
|
<Link to={postUrl} title={excerpt}>
|
||||||
@@ -230,18 +228,28 @@ const ModQueueBoardFilter = ({ subplebbits }: ModQueueBoardFilterProps) => {
|
|||||||
|
|
||||||
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
const value = e.target.value;
|
const value = e.target.value;
|
||||||
setSelectedBoardFilter(value === '' ? null : value);
|
setSelectedBoardFilter(value);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!subplebbits || subplebbits.length === 0) {
|
if (!subplebbits || subplebbits.length === 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default to first board if none selected
|
||||||
|
const firstBoardAddress = subplebbits.find((sub) => sub.address)?.address;
|
||||||
|
const currentFilter = selectedBoardFilter || firstBoardAddress || '';
|
||||||
|
|
||||||
|
// Auto-select first board if none is selected
|
||||||
|
useEffect(() => {
|
||||||
|
if (!selectedBoardFilter && firstBoardAddress) {
|
||||||
|
setSelectedBoardFilter(firstBoardAddress);
|
||||||
|
}
|
||||||
|
}, [selectedBoardFilter, firstBoardAddress, setSelectedBoardFilter]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.filterContainer}>
|
<div className={styles.filterContainer}>
|
||||||
<label>{t('filter_by_board')}:</label>
|
<label>{t('filter_by_board')}:</label>
|
||||||
<select value={selectedBoardFilter || ''} onChange={handleChange}>
|
<select value={currentFilter} onChange={handleChange}>
|
||||||
<option value=''>{t('all_boards')}</option>
|
|
||||||
{subplebbits.map((sub) => {
|
{subplebbits.map((sub) => {
|
||||||
const address = sub.address;
|
const address = sub.address;
|
||||||
if (!address) return null;
|
if (!address) return null;
|
||||||
@@ -445,11 +453,18 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
|
|||||||
return [resolvedAddress];
|
return [resolvedAddress];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always require a board filter when viewing /mod/queue (no boardIdentifier)
|
||||||
if (selectedBoardFilter) {
|
if (selectedBoardFilter) {
|
||||||
return [selectedBoardFilter];
|
return [selectedBoardFilter];
|
||||||
}
|
}
|
||||||
|
|
||||||
return accountSubplebbitAddresses;
|
// Default to first board if none selected
|
||||||
|
const firstBoardAddress = accountSubplebbitAddresses[0];
|
||||||
|
if (firstBoardAddress) {
|
||||||
|
return [firstBoardAddress];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
}, [resolvedAddress, selectedBoardFilter, accountSubplebbitAddresses]);
|
}, [resolvedAddress, selectedBoardFilter, accountSubplebbitAddresses]);
|
||||||
|
|
||||||
const { feed, hasMore, loadMore, reset } = useFeed({
|
const { feed, hasMore, loadMore, reset } = useFeed({
|
||||||
@@ -464,7 +479,13 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
|
|||||||
setResetFunction(reset);
|
setResetFunction(reset);
|
||||||
}, [reset, setResetFunction]);
|
}, [reset, setResetFunction]);
|
||||||
|
|
||||||
const showBoardColumn = !resolvedAddress && !selectedBoardFilter;
|
// Auto-select first board if viewing /mod/queue without a boardIdentifier and no filter is set
|
||||||
|
useEffect(() => {
|
||||||
|
if (!resolvedAddress && !selectedBoardFilter && accountSubplebbitAddresses.length > 0) {
|
||||||
|
const { setSelectedBoardFilter } = useModQueueStore.getState();
|
||||||
|
setSelectedBoardFilter(accountSubplebbitAddresses[0]);
|
||||||
|
}
|
||||||
|
}, [resolvedAddress, selectedBoardFilter, accountSubplebbitAddresses]);
|
||||||
|
|
||||||
// Memoize footer components object to preserve identity across renders (Virtuoso optimization)
|
// Memoize footer components object to preserve identity across renders (Virtuoso optimization)
|
||||||
// Note: useFeedStateString is called inside ModQueueFooter to isolate re-renders from backend state changes
|
// Note: useFeedStateString is called inside ModQueueFooter to isolate re-renders from backend state changes
|
||||||
@@ -539,7 +560,6 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
|
|||||||
<>
|
<>
|
||||||
<div className={styles.tableHeader}>
|
<div className={styles.tableHeader}>
|
||||||
<div className={styles.numberHeader}>No.</div>
|
<div className={styles.numberHeader}>No.</div>
|
||||||
{showBoardColumn && <div className={styles.boardHeader}>{t('board')}</div>}
|
|
||||||
<div className={styles.excerptHeader}>{t('excerpt')}</div>
|
<div className={styles.excerptHeader}>{t('excerpt')}</div>
|
||||||
<div className={styles.timeHeader}>{t('submitted')}</div>
|
<div className={styles.timeHeader}>{t('submitted')}</div>
|
||||||
<div className={styles.actionsHeader}>{t('actions')}</div>
|
<div className={styles.actionsHeader}>{t('actions')}</div>
|
||||||
@@ -553,13 +573,13 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
|
|||||||
totalCount={feed.length}
|
totalCount={feed.length}
|
||||||
endReached={loadMore}
|
endReached={loadMore}
|
||||||
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
increaseViewportBy={{ bottom: 1200, top: 1200 }}
|
||||||
itemContent={(index, comment) => <ModQueueRow key={comment.cid} comment={comment} showBoardColumn={showBoardColumn} isOdd={index % 2 === 0} />}
|
itemContent={(index, comment) => <ModQueueRow key={comment.cid} comment={comment} isOdd={index % 2 === 0} />}
|
||||||
components={footerComponents}
|
components={footerComponents}
|
||||||
/>
|
/>
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{feed.map((comment, index) => (
|
{feed.map((comment, index) => (
|
||||||
<ModQueueRow key={comment.cid} comment={comment} showBoardColumn={showBoardColumn} isOdd={index % 2 === 0} />
|
<ModQueueRow key={comment.cid} comment={comment} isOdd={index % 2 === 0} />
|
||||||
))}
|
))}
|
||||||
<ModQueueFooter hasMore={hasMore} subplebbitAddresses={subplebbitAddresses} />
|
<ModQueueFooter hasMore={hasMore} subplebbitAddresses={subplebbitAddresses} />
|
||||||
</>
|
</>
|
||||||
|
|||||||
Reference in New Issue
Block a user