fix: remove rowStatuses prop from ProductDescriptions to fix app crash

The rowStatuses prop was merged from feature branch but is incompatible
with main. Removed it and restored original tbody structure while keeping
the Present/Missing filter fix.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
Christian Vidal Wolf
2026-04-08 19:32:28 +02:00
co-authored by Qwen-Coder
parent 0d47f5be33
commit 71a4897f28
2 changed files with 60 additions and 71 deletions
+3 -4
View File
@@ -95,8 +95,8 @@ export default function App() {
// Skip Article No, Barcodes, and other code-like fields // Skip Article No, Barcodes, and other code-like fields
// But allow if it's a weight/measure column (e.g. Article NW (kg)) // But allow if it's a weight/measure column (e.g. Article NW (kg))
if ((header.includes('id') || header.includes('no') || header.includes('code') || if ((header.includes('id') || header.includes('no') || header.includes('code') ||
header.includes('art.') || header.includes('barcode') || header.includes('article')) && header.includes('art.') || header.includes('barcode') || header.includes('article')) &&
!(header.includes('nw') || header.includes('gw') || header.includes('weight') || header.includes('kg'))) { !(header.includes('nw') || header.includes('gw') || header.includes('weight') || header.includes('kg'))) {
return val; return val;
} }
@@ -167,7 +167,7 @@ export default function App() {
const header = (rawHeaders[idx] || '').toLowerCase(); const header = (rawHeaders[idx] || '').toLowerCase();
if (header.includes('id') || header.includes('no') || header.includes('code') || if (header.includes('id') || header.includes('no') || header.includes('code') ||
header.includes('art.') || header.includes('barcode') || header.includes('article')) { header.includes('art.') || header.includes('barcode') || header.includes('article')) {
// But allow if it's a weight/measure column (e.g. Article NW (kg)) // But allow if it's a weight/measure column (e.g. Article NW (kg))
if (!(header.includes('nw') || header.includes('gw') || header.includes('weight') || header.includes('kg'))) { if (!(header.includes('nw') || header.includes('gw') || header.includes('weight') || header.includes('kg'))) {
return val; return val;
@@ -369,7 +369,6 @@ export default function App() {
<ProductDescriptions <ProductDescriptions
data={appState.data} data={appState.data}
onEdit={(index) => setEditingRowIndex(index)} onEdit={(index) => setEditingRowIndex(index)}
rowStatuses={rowStatuses}
/> />
)} )}
{activeModule === 'matrix' && ( {activeModule === 'matrix' && (
+31 -41
View File
@@ -304,47 +304,37 @@ export function ProductDescriptions({ data, onEdit }: ProductDescriptionsProps)
</tr> </tr>
</thead> </thead>
<tbody className="divide-y divide-slate-700/50"> <tbody className="divide-y divide-slate-700/50">
{paginatedData.map(({ row, index }) => { {paginatedData.map(({ row, index }) => (
const isPending = rowStatuses[String(row[COLUMNS.ARTICLE_NO])] === 'pending'; <tr key={index} className={cn("transition-colors", getRowColor(row))}>
return ( <td className="px-4 py-3 font-mono text-slate-300 text-xs">{row[COLUMNS.ARTICLE_NO]}</td>
<tr <td className="px-4 py-3 font-medium text-white max-w-[200px] truncate" title={row[COLUMNS.ARTICLE_NAME]}>{row[COLUMNS.ARTICLE_NAME]}</td>
key={index} <td className="px-4 py-3 text-slate-300 text-xs">{row[COLUMNS.LINE]}</td>
className={cn( <td className="px-4 py-3 text-slate-300 text-xs truncate max-w-[120px]" title={row[COLUMNS.LICENSE]}>{row[COLUMNS.LICENSE] || '—'}</td>
"transition-colors", <td className="px-4 py-3">
getRowColor(row), <span className={cn(
isPending ? "bg-yellow-400/20 border-l-4 border-l-yellow-400" : "" "px-2 py-0.5 rounded text-[10px] font-bold border",
)} String(row[COLUMNS.CLASSIFICATION]).includes('OOC')
> ? "bg-amber-500/10 text-amber-500 border-amber-500/20"
<td className="px-4 py-3 font-mono text-slate-300 text-xs">{row[COLUMNS.ARTICLE_NO]}</td> : "bg-slate-700/50 text-slate-400 border-slate-600/50"
<td className="px-4 py-3 font-medium text-white max-w-[200px] truncate" title={row[COLUMNS.ARTICLE_NAME]}>{row[COLUMNS.ARTICLE_NAME]}</td> )}>
<td className="px-4 py-3 text-slate-300 text-xs">{row[COLUMNS.LINE]}</td> {row[COLUMNS.CLASSIFICATION] || '—'}
<td className="px-4 py-3 text-slate-300 text-xs truncate max-w-[120px]" title={row[COLUMNS.LICENSE]}>{row[COLUMNS.LICENSE] || '—'}</td> </span>
<td className="px-4 py-3"> </td>
<span className={cn( <td className="px-4 py-3"><Badge content={row[COLUMNS.LONG_DE]} row={row} /></td>
"px-2 py-0.5 rounded text-[10px] font-bold border", <td className="px-4 py-3"><Badge content={row[COLUMNS.LONG_EN]} row={row} /></td>
String(row[COLUMNS.CLASSIFICATION]).includes('OOC') <td className="px-4 py-3"><Badge content={row[COLUMNS.SHORT_DE]} row={row} /></td>
? "bg-amber-500/10 text-amber-500 border-amber-500/20" <td className="px-4 py-3"><Badge content={row[COLUMNS.SHORT_EN]} row={row} /></td>
: "bg-slate-700/50 text-slate-400 border-slate-600/50" <td className="px-4 py-3 text-right">
)}> <button
{row[COLUMNS.CLASSIFICATION] || '—'} onClick={() => onEdit(index)}
</span> className="inline-flex items-center gap-2 px-3 py-1.5 bg-blue-600/10 text-blue-400 hover:bg-blue-600 hover:text-white rounded-md transition-colors font-medium"
</td> >
<td className="px-4 py-3"><Badge content={row[COLUMNS.LONG_DE]} row={row} /></td> <Edit2 className="w-4 h-4" />
<td className="px-4 py-3"><Badge content={row[COLUMNS.LONG_EN]} row={row} /></td> Edit
<td className="px-4 py-3"><Badge content={row[COLUMNS.SHORT_DE]} row={row} /></td> </button>
<td className="px-4 py-3"><Badge content={row[COLUMNS.SHORT_EN]} row={row} /></td> </td>
<td className="px-4 py-3 text-right"> </tr>
<button ))}
onClick={() => onEdit(index)}
className="inline-flex items-center gap-2 px-3 py-1.5 bg-blue-600/10 text-blue-400 hover:bg-blue-600 hover:text-white rounded-md transition-colors font-medium"
>
<Edit2 className="w-4 h-4" />
Edit
</button>
</td>
</tr>
);
})}
{paginatedData.length === 0 && ( {paginatedData.length === 0 && (
<tr> <tr>
<td colSpan={9} className="px-4 py-8 text-center text-slate-500"> <td colSpan={9} className="px-4 py-8 text-center text-slate-500">