From ec1b5063414d2fef6034528661b2c373182a88e9 Mon Sep 17 00:00:00 2001 From: Christian Vidal Wolf Date: Tue, 7 Apr 2026 13:38:21 +0200 Subject: [PATCH] feat: include article details (DE/EN) in completeness check and make them editable --- src/components/DataCompleteness.tsx | 4 ++- src/components/EditPanel.tsx | 32 +++++++++++++++++++--- src/components/ProductDescriptions.tsx | 38 +++++++++++++++++++------- 3 files changed, 59 insertions(+), 15 deletions(-) diff --git a/src/components/DataCompleteness.tsx b/src/components/DataCompleteness.tsx index b56f01d..b7e371f 100644 --- a/src/components/DataCompleteness.tsx +++ b/src/components/DataCompleteness.tsx @@ -21,6 +21,8 @@ export function DataCompleteness({ data, headers }: DataCompletenessProps) { COLUMNS.TARIFF_CODE, COLUMNS.COUNTRY_ORIGIN, COLUMNS.RECOMMENDED_AGE, + COLUMNS.DETAILS_DE, + COLUMNS.DETAILS_EN, COLUMNS.LONG_DE, COLUMNS.LONG_EN, COLUMNS.SHORT_DE, @@ -70,7 +72,7 @@ export function DataCompleteness({ data, headers }: DataCompletenessProps) {

Data Completeness

-

Evaluating 10 key fields per product.

+

Evaluating 12 key fields per product.

diff --git a/src/components/EditPanel.tsx b/src/components/EditPanel.tsx index e71ea28..8100132 100644 --- a/src/components/EditPanel.tsx +++ b/src/components/EditPanel.tsx @@ -19,6 +19,8 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed longEn: row[COLUMNS.LONG_EN] || '', shortDe: row[COLUMNS.SHORT_DE] || '', shortEn: row[COLUMNS.SHORT_EN] || '', + detailsDe: row[COLUMNS.DETAILS_DE] || '', + detailsEn: row[COLUMNS.DETAILS_EN] || '', innerW: row[COLUMNS.INNER_W] || '', innerL: row[COLUMNS.INNER_L] || '', innerH: row[COLUMNS.INNER_H] || '', @@ -48,8 +50,12 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed outerH: COLUMNS.OUTER_H, unitsOuter: COLUMNS.UNITS_OUTER, moq: COLUMNS.MOQ, + detailsDe: COLUMNS.DETAILS_DE, + detailsEn: COLUMNS.DETAILS_EN, }; - return formData[field] !== (row[colMap[field]] || ''); + const colIndex = (colMap as Record)[field as string]; + if (colIndex === undefined) return false; + return formData[field] !== (row[colIndex] || ''); }; const handleGenerate = async (field: keyof typeof formData) => { @@ -65,7 +71,7 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed try { let prompt = ''; - const baseContext = `Article Name: ${row[COLUMNS.ARTICLE_NAME]}\nArticle Details (EN): ${row[COLUMNS.DETAILS_EN] || 'N/A'}\nArticle Details (DE): ${row[COLUMNS.DETAILS_DE] || 'N/A'}`; + const baseContext = `Article Name: ${row[COLUMNS.ARTICLE_NAME]}\nArticle Details (EN): ${formData.detailsEn || 'N/A'}\nArticle Details (DE): ${formData.detailsDe || 'N/A'}`; const systemPrompt = "You are a professional copywriter and expert translator for CRAZE GmbH, a German toy company. You excel at translating product descriptions between German and English, maintaining the commercial and professional tone while ensuring all technical toy details are accurate. Use clear, engaging language."; @@ -143,6 +149,8 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed newRow[COLUMNS.OUTER_H] = formData.outerH; newRow[COLUMNS.UNITS_OUTER] = formData.unitsOuter; newRow[COLUMNS.MOQ] = formData.moq; + newRow[COLUMNS.DETAILS_DE] = formData.detailsDe; + newRow[COLUMNS.DETAILS_EN] = formData.detailsEn; onSave(rowIndex, newRow); }; @@ -230,11 +238,27 @@ export function EditPanel({ row, rowIndex, onSave, onClose, onCaptureState }: Ed
Details (DE) -

{row[COLUMNS.DETAILS_DE] || '-'}

+