mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-04 01:44:13 +00:00
fix(packing): name everyone who brings a shared item
A common item brought by several members showed the first bringer's avatar and a bare "+2". The tooltip only named the first person, and on the phone neither the row nor the item sheet said who else brings it (discussion #2782). packingBringerNames lists the bringer and every contributor; the desktop row, the phone row and the phone item sheet use it for "brought by".
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
interface BroughtItem {
|
||||
owner_username?: string | null;
|
||||
contributors?: { username: string }[] | null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Everyone bringing a common item, as one readable list: its bringer first, then
|
||||
* whoever also brings it. The row only has room for one avatar and a "+n", so this
|
||||
* is what its tooltip and the item sheet name (#2782).
|
||||
*/
|
||||
export function packingBringerNames(item: BroughtItem): string {
|
||||
const names = [item.owner_username, ...(item.contributors ?? []).map((c) => c.username)];
|
||||
return [...new Set(names.filter((n): n is string => !!n))].join(', ');
|
||||
}
|
||||
Reference in New Issue
Block a user