Skip to content

Commit 79bdcc7

Browse files
committed
refactor(cards): a card's reaction room counts whatever else its foot holds, so other chips can sit beside the pills
1 parent 6a810e0 commit 79bdcc7

1 file changed

Lines changed: 7 additions & 6 deletions

File tree

‎src/client/CardView.tsx‎

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ function LiveCard({
466466
)}
467467
<ReactionPills
468468
card={card}
469-
room={reactionRoom(card, origin, liveness)}
469+
room={reactionRoom(card, [origin, liveness])}
470470
show={showReactors}
471471
/>
472472
{origin && <ProvenanceBadge origin={origin} />}
@@ -479,16 +479,17 @@ function LiveCard({
479479

480480
/**
481481
* How many reaction pills fit in a card's foot beside everything else in
482-
* it ("+N" counts as one): four beside the comment count, fewer for each
483-
* other thing there, and never fewer than two.
482+
* it ("+N" counts as one): four beside the comment count, one fewer for
483+
* each other thing there, never fewer than two. `beside` is whatever else
484+
* the foot holds (a provenance badge, liveness, another chip): each present
485+
* one takes a pill's room.
484486
*/
485-
function reactionRoom(card: Card, origin: unknown, liveness: unknown): number {
487+
function reactionRoom(card: Card, beside: readonly unknown[]): number {
486488
const others = [
487489
card.assignees.length > 0 || (card.kind === "discussion" && card.author),
488490
card.discussion?.upvotes !== undefined,
489491
card.discussion?.locked,
490-
origin,
491-
liveness,
492+
...beside,
492493
].filter(Boolean).length;
493494
return Math.max(2, 4 - others);
494495
}

0 commit comments

Comments
 (0)