not needed for now

This commit is contained in:
plebeius
2026-01-11 17:40:50 +01:00
parent acd6514e31
commit ee2a2b16a5
2 changed files with 32 additions and 36 deletions
-24
View File
@@ -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;
+32 -12
View File
@@ -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<ModerationAction>(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 (
<div className={`${styles.row} ${isOdd ? styles.rowOdd : ''}`}>
<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}>
{postUrl ? (
<Link to={postUrl} title={excerpt}>
@@ -230,18 +228,28 @@ const ModQueueBoardFilter = ({ subplebbits }: ModQueueBoardFilterProps) => {
const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
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 (
<div className={styles.filterContainer}>
<label>{t('filter_by_board')}:</label>
<select value={selectedBoardFilter || ''} onChange={handleChange}>
<option value=''>{t('all_boards')}</option>
<select value={currentFilter} onChange={handleChange}>
{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
<>
<div className={styles.tableHeader}>
<div className={styles.numberHeader}>No.</div>
{showBoardColumn && <div className={styles.boardHeader}>{t('board')}</div>}
<div className={styles.excerptHeader}>{t('excerpt')}</div>
<div className={styles.timeHeader}>{t('submitted')}</div>
<div className={styles.actionsHeader}>{t('actions')}</div>
@@ -553,13 +573,13 @@ export const ModQueueView = ({ boardIdentifier: propBoardIdentifier }: ModQueueV
totalCount={feed.length}
endReached={loadMore}
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}
/>
) : (
<>
{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} />
</>