mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-06-30 02:31:47 +00:00
c1fe1d2d6a
Removing the only item of a user-created category deleted the whole category. Turn that row back into the existing ... placeholder in place instead, so the category keeps its position and colour; adding an item reuses the placeholder slot. Deleting the placeholder (or the category menu) still removes an empty category.
50 lines
2.1 KiB
TypeScript
50 lines
2.1 KiB
TypeScript
import { Luggage } from 'lucide-react'
|
|
import type { PackingState } from './usePackingListPanel'
|
|
import { KategorieGruppe } from './PackingListPanelCategoryGroup'
|
|
|
|
export function PackingList(S: PackingState) {
|
|
const {
|
|
items, gruppiert, t, tripId, allCategories, handleRenameCategory, handleDeleteCategory, handleDeleteItem,
|
|
handleAddItemToCategory, categoryAssignees, tripMembers, handleSetAssignees,
|
|
bagTrackingEnabled, bags, handleCreateBagByName, canEdit,
|
|
} = S
|
|
return (
|
|
<div style={{ flex: 1, overflowY: 'auto', padding: '10px 0 16px' }}>
|
|
{items.length === 0 ? (
|
|
<div style={{ textAlign: 'center', padding: '60px 20px' }}>
|
|
<Luggage size={40} style={{ color: 'var(--text-faint)', display: 'block', margin: '0 auto 10px' }} />
|
|
<p style={{ fontSize: 14, fontWeight: 600, color: 'var(--text-secondary)', margin: '0 0 4px' }}>{t('packing.emptyTitle')}</p>
|
|
<p style={{ fontSize: 13, color: 'var(--text-faint)', margin: 0 }}>{t('packing.emptyHint')}</p>
|
|
</div>
|
|
) : Object.keys(gruppiert).length === 0 ? (
|
|
<div style={{ textAlign: 'center', padding: '40px 20px', color: 'var(--text-faint)' }}>
|
|
<p style={{ fontSize: 13, margin: 0 }}>{t('packing.emptyFiltered')}</p>
|
|
</div>
|
|
) : (
|
|
<div className="grid grid-cols-1 md:grid-cols-2 gap-2">
|
|
{Object.entries(gruppiert).map(([kat, katItems]) => (
|
|
<KategorieGruppe
|
|
key={kat}
|
|
kategorie={kat}
|
|
items={katItems}
|
|
tripId={tripId}
|
|
allCategories={allCategories}
|
|
onRename={handleRenameCategory}
|
|
onDeleteAll={handleDeleteCategory}
|
|
onDeleteItem={handleDeleteItem}
|
|
onAddItem={handleAddItemToCategory}
|
|
assignees={categoryAssignees[kat] || []}
|
|
tripMembers={tripMembers}
|
|
onSetAssignees={handleSetAssignees}
|
|
bagTrackingEnabled={bagTrackingEnabled}
|
|
bags={bags}
|
|
onCreateBag={handleCreateBagByName}
|
|
canEdit={canEdit}
|
|
/>
|
|
))}
|
|
</div>
|
|
)}
|
|
</div>
|
|
)
|
|
}
|