From ee2a2b16a523cff96e1512cd0897f75d938aee20 Mon Sep 17 00:00:00 2001 From: plebeius Date: Sun, 11 Jan 2026 17:40:50 +0100 Subject: [PATCH] not needed for now --- src/views/mod-queue/mod-queue.module.css | 24 ------------- src/views/mod-queue/mod-queue.tsx | 44 +++++++++++++++++------- 2 files changed, 32 insertions(+), 36 deletions(-) diff --git a/src/views/mod-queue/mod-queue.module.css b/src/views/mod-queue/mod-queue.module.css index ee96e5f7..26463e4f 100644 --- a/src/views/mod-queue/mod-queue.module.css +++ b/src/views/mod-queue/mod-queue.module.css @@ -64,7 +64,6 @@ } .numberHeader, -.boardHeader, .excerptHeader, .timeHeader, .actionsHeader { @@ -77,11 +76,6 @@ flex-shrink: 0; } -.boardHeader { - width: 50px; - flex-shrink: 0; -} - .excerptHeader { flex-grow: 1; } @@ -117,7 +111,6 @@ } .number, -.board, .excerpt, .time, .actions { @@ -129,7 +122,6 @@ /* Odd rows - theme-specific background colors applied to cells */ :global(body.yotsuba) .rowOdd .number, -:global(body.yotsuba) .rowOdd .board, :global(body.yotsuba) .rowOdd .excerpt, :global(body.yotsuba) .rowOdd .time, :global(body.yotsuba) .rowOdd .actions { @@ -137,7 +129,6 @@ } :global(body.yotsuba-b) .rowOdd .number, -:global(body.yotsuba-b) .rowOdd .board, :global(body.yotsuba-b) .rowOdd .excerpt, :global(body.yotsuba-b) .rowOdd .time, :global(body.yotsuba-b) .rowOdd .actions { @@ -145,7 +136,6 @@ } :global(body.futaba) .rowOdd .number, -:global(body.futaba) .rowOdd .board, :global(body.futaba) .rowOdd .excerpt, :global(body.futaba) .rowOdd .time, :global(body.futaba) .rowOdd .actions { @@ -153,7 +143,6 @@ } :global(body.burichan) .rowOdd .number, -:global(body.burichan) .rowOdd .board, :global(body.burichan) .rowOdd .excerpt, :global(body.burichan) .rowOdd .time, :global(body.burichan) .rowOdd .actions { @@ -161,7 +150,6 @@ } :global(body.tomorrow) .rowOdd .number, -:global(body.tomorrow) .rowOdd .board, :global(body.tomorrow) .rowOdd .excerpt, :global(body.tomorrow) .rowOdd .time, :global(body.tomorrow) .rowOdd .actions { @@ -169,7 +157,6 @@ } :global(body.photon) .rowOdd .number, -:global(body.photon) .rowOdd .board, :global(body.photon) .rowOdd .excerpt, :global(body.photon) .rowOdd .time, :global(body.photon) .rowOdd .actions { @@ -181,12 +168,6 @@ flex-shrink: 0; } -.board { - width: 50px; - flex-shrink: 0; - font-weight: bold; -} - .excerpt { flex-grow: 1; white-space: nowrap; @@ -323,11 +304,6 @@ span.reject:hover { padding: 8px; } - .board { - width: auto; - margin-right: 8px; - } - .time { margin-left: auto; width: auto; diff --git a/src/views/mod-queue/mod-queue.tsx b/src/views/mod-queue/mod-queue.tsx index b2d1075f..d900a482 100644 --- a/src/views/mod-queue/mod-queue.tsx +++ b/src/views/mod-queue/mod-queue.tsx @@ -47,14 +47,13 @@ const ModQueueFooter = ({ hasMore, subplebbitAddresses }: ModQueueFooterProps) = interface ModQueueRowProps { comment: Comment; - showBoardColumn?: boolean; isOdd?: boolean; } // Track which action was initiated to show appropriate completion message type ModerationAction = 'approve' | 'reject' | null; -const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQueueRowProps) => { +const ModQueueRow = ({ comment, isOdd = false }: ModQueueRowProps) => { const { t } = useTranslation(); const { getAlertThresholdSeconds } = useModQueueStore(); const [initiatedAction, setInitiatedAction] = useState(null); @@ -70,7 +69,6 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue const alreadyApproved = approved === true; const alreadyRejected = removed === true; - const boardPath = useBoardPath(subplebbitAddress); const timeWaiting = Date.now() / 1000 - timestamp; const alertThresholdSeconds = getAlertThresholdSeconds(); const isOverThreshold = timeWaiting > alertThresholdSeconds; @@ -145,6 +143,7 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue const approveFailed = initiatedAction === 'approve' && approveState === '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 excerpt = rawExcerpt.length > 101 ? rawExcerpt.slice(0, 98) + '...' : rawExcerpt; const threadTargetCid = threadCid || cid; @@ -195,7 +194,6 @@ const ModQueueRow = ({ comment, showBoardColumn = false, isOdd = false }: ModQue return (
{number ?? 'N/A'}
- {showBoardColumn &&
{boardPath ? /{boardPath}/ : }
}
{postUrl ? ( @@ -230,18 +228,28 @@ const ModQueueBoardFilter = ({ subplebbits }: ModQueueBoardFilterProps) => { const handleChange = (e: React.ChangeEvent) => { const value = e.target.value; - setSelectedBoardFilter(value === '' ? null : value); + setSelectedBoardFilter(value); }; if (!subplebbits || subplebbits.length === 0) { 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 (
- {subplebbits.map((sub) => { const address = sub.address; if (!address) return null; @@ -445,11 +453,18 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV return [resolvedAddress]; } + // Always require a board filter when viewing /mod/queue (no boardIdentifier) if (selectedBoardFilter) { return [selectedBoardFilter]; } - return accountSubplebbitAddresses; + // Default to first board if none selected + const firstBoardAddress = accountSubplebbitAddresses[0]; + if (firstBoardAddress) { + return [firstBoardAddress]; + } + + return []; }, [resolvedAddress, selectedBoardFilter, accountSubplebbitAddresses]); const { feed, hasMore, loadMore, reset } = useFeed({ @@ -464,7 +479,13 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV setResetFunction(reset); }, [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) // Note: useFeedStateString is called inside ModQueueFooter to isolate re-renders from backend state changes @@ -539,7 +560,6 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV <>
No.
- {showBoardColumn &&
{t('board')}
}
{t('excerpt')}
{t('submitted')}
{t('actions')}
@@ -553,13 +573,13 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV totalCount={feed.length} endReached={loadMore} increaseViewportBy={{ bottom: 1200, top: 1200 }} - itemContent={(index, comment) => } + itemContent={(index, comment) => } components={footerComponents} /> ) : ( <> {feed.map((comment, index) => ( - + ))}