fix: show all marketplaces (incl. Amazon UK) in experiment form

Use a hardcoded ALL_MARKETPLACES list instead of deriving from current
filtered data, so Amazon UK is always available even when viewing PAN-EU.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christian Vidal Wolf
2026-02-20 11:12:30 +01:00
co-authored by Claude Opus 4.6
parent 812425a1ef
commit fed39b18be
+5 -9
View File
@@ -61,6 +61,8 @@ const STATUS_LABELS: Record<ExperimentStatus, string> = {
'failed': 'Failed',
};
const ALL_MARKETPLACES = ['Amazon DE', 'Amazon IT', 'Amazon FR', 'Amazon ES', 'Amazon UK'];
const STORAGE_KEY = 'craze_experiments';
// --- Storage helpers ---
@@ -179,18 +181,12 @@ const ExperimentTracker: React.FC<ExperimentTrackerProps> = ({ rows, weeks, prim
const [formDesc, setFormDesc] = useState('');
const [formImpact, setFormImpact] = useState<ExpectedImpact>('More Sales');
// Available marketplaces from data
const marketplaces = useMemo(() => {
const mks = new Set(rows.map(r => r.customer).filter(Boolean));
return Array.from(mks).sort();
}, [rows]);
// Default marketplace to active filter when opening form
const defaultMarketplace = useMemo(() => {
if (customerFilters.length === 1) return customerFilters[0];
if (customerFilters.length > 0) return customerFilters[0];
return marketplaces[0] || '';
}, [customerFilters, marketplaces]);
return ALL_MARKETPLACES[0];
}, [customerFilters]);
// Available product lines from data
const productLines = useMemo(() => {
@@ -445,7 +441,7 @@ const ExperimentTracker: React.FC<ExperimentTrackerProps> = ({ rows, weeks, prim
className="w-full bg-slate-950 border border-white/10 rounded-lg px-3 py-2 text-sm text-white focus:outline-none focus:ring-2 focus:ring-indigo-500"
>
<option value="">Select marketplace...</option>
{marketplaces.map(mk => (
{ALL_MARKETPLACES.map(mk => (
<option key={mk} value={mk}>{mk}</option>
))}
</select>