mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-12 23:31:02 +00:00
da324121bd
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".
15 lines
571 B
TypeScript
15 lines
571 B
TypeScript
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(', ');
|
|
}
|