import { Users } from 'lucide-react' import { Tooltip } from '../shared/Tooltip' import type { PersonLoad } from './packingListPanel.helpers' const kgOrG = (grams: number) => (grams >= 1000 ? `${(grams / 1000).toFixed(1)} kg` : `${grams} g`) interface Props { t: (key: string, params?: Record) => string total: number packed: number people: PersonLoad[] /** Hairline above the people block; off where the summary sits in its own frame. */ topRule?: boolean } /** * The weight foot under the bags (#1131): who carries what, then the total with * the packed part of it as a thin bar. Shared by the sidebar and the bag modal so * both read the same. */ export function PackingWeightSummary({ t, total, packed, people, topRule = true }: Props) { const pct = total > 0 ? Math.min(100, Math.round((packed / total) * 100)) : 0 return (
{people.length > 0 && (
{t('packing.perPerson')}
{people.map(p => (
{p.avatar ? ( ) : ( {p.username[0]?.toUpperCase()} )} {p.username} {p.shared ? ( {kgOrG(p.grams)} ) : ( {kgOrG(p.grams)} )}
))}
)}
{t('packing.totalWeight')} {kgOrG(total)}
{total > 0 && ( <>
{t('packing.packedWeight')} {kgOrG(packed)}
)}
) }