diff --git a/src/components/creation/MetafieldResolver.tsx b/src/components/creation/MetafieldResolver.tsx index 3f5337a..719b329 100644 --- a/src/components/creation/MetafieldResolver.tsx +++ b/src/components/creation/MetafieldResolver.tsx @@ -27,8 +27,9 @@ export function MetafieldResolver({ specificColumns, onResolved }: Props) { setMatched(data.matched) setUnmatched(data.unmatched) const init: Record = { ...data.matched } + // Défaut : 'skip' — l'utilisateur choisit explicitement ce qu'il veut créer data.unmatched.forEach((col: string) => { - init[col] = { columnHeader: col, action: 'create', namespace: 'custom', key: normalizeMetafieldKey(col) } + init[col] = { columnHeader: col, action: 'skip', namespace: 'custom', key: normalizeMetafieldKey(col) } }) setResolutions(init) }) @@ -69,47 +70,91 @@ export function MetafieldResolver({ specificColumns, onResolved }: Props) { )} {unmatched.length > 0 && (
-

- ⚠ {unmatched.length} colonne{unmatched.length > 1 ? 's' : ''} sans correspondance — action requise -

+
+

+ Ces colonnes n'ont pas de métachamp correspondant dans Shopify. + Choisissez pour chacune : Créer nouveau (nouveau métachamp Shopify), + Associer (utiliser un existant), ou + Ignorer (ne pas synchroniser). +

+
{unmatched.map(col => { const res = resolutions[col] if (!res) return null return ( -
-

{col}

+
+
+

{col}

+ {res.action === 'create' && ✓ Sera créé dans Shopify} + {res.action === 'map' && ✓ Associé à un existant} + {res.action === 'skip' && — Ignoré} +
{(['create', 'map', 'skip'] as const).map(action => ( ))}
{res.action === 'create' && ( -
- updateResolution(col, { key: e.target.value })} placeholder="clé (ex: puissance)" - className="flex-1 bg-slate-600 border border-slate-500 rounded px-2 py-1 text-xs text-white" /> - updateResolution(col, { namespace: e.target.value })} placeholder="namespace" - className="w-24 bg-slate-600 border border-slate-500 rounded px-2 py-1 text-xs text-white" /> +
+
+ + updateResolution(col, { key: e.target.value })} + placeholder="ex: puissance" + className="w-full bg-slate-600 border border-slate-500 rounded px-2 py-1 text-xs text-white focus:outline-none focus:ring-1 focus:ring-indigo-500" + /> +
+
+ + updateResolution(col, { namespace: e.target.value })} + placeholder="custom" + className="w-full bg-slate-600 border border-slate-500 rounded px-2 py-1 text-xs text-white focus:outline-none focus:ring-1 focus:ring-indigo-500" + /> +
)} {res.action === 'map' && ( - +
+ + +
)}
) })}
+ {/* Résumé des actions */} +
+ {Object.values(resolutions).filter(r => r.action === 'create').length} à créer + {Object.values(resolutions).filter(r => r.action === 'map').length} à associer + {Object.values(resolutions).filter(r => r.action === 'skip').length} ignorés +
)}