mirror of
https://github.com/outline/outline.git
synced 2026-12-02 09:42:07 +03:00
fix: Avoid pointless +1 on Facepile (#12823)
* Avoid +1 on facepile * revert * feedback
This commit is contained in:
1 parent
79d646b904
commit
b8ed9be236
1 file changed
+8
-2
@@ -37,10 +37,16 @@ function Facepile({
|
||||
...rest
|
||||
}: Props) {
|
||||
const { t } = useTranslation();
|
||||
const filtered = users.filter(Boolean).slice(-limit);
|
||||
const present = users.filter(Boolean);
|
||||
// A "+1" badge takes up the same space as an avatar, so when the single
|
||||
// overflowing user is actually present in the list, show their avatar
|
||||
// instead. Fall back to the badge when the overflow comes from a separate
|
||||
// total count and the extra user isn't available to render.
|
||||
const showLastInsteadOfBadge = overflow === 1 && present.length - limit === 1;
|
||||
const filtered = present.slice(-(showLastInsteadOfBadge ? limit + 1 : limit));
|
||||
const Component = renderAvatar;
|
||||
|
||||
if (overflow > 0) {
|
||||
if (overflow > 0 && !showLastInsteadOfBadge) {
|
||||
filtered.unshift({
|
||||
id: "overflow",
|
||||
initial: `${users.length ? "+" : ""}${overflow}`,
|
||||
|
||||
Reference in new issue
Block a user