import React, { useState, useEffect } from 'react'; import { AuthProvider, AuthGuard, useAuth } from './AdminAuth'; import AdminLayout from './AdminLayout'; interface Collection { id: string; slug: string; name_en: string; name_nl: string; description: string | null; type: 'smart' | 'manual' | 'hybrid'; rules_json: any; sort_by: string; is_active: boolean; is_featured: boolean; max_products: number | null; } const RULE_FIELDS = ['brand', 'category', 'price', 'offer_count', 'is_sneaker', 'name']; const RULE_OPS = ['equals', 'not_equals', 'contains', 'greater_than', 'less_than', 'in']; interface Rule { field: string; operator: string; value: string; } function RuleRow({ rule, onChange, onRemove }: { rule: Rule; onChange: (r: Rule) => void; onRemove: () => void }) { return (
| Naam | Slug | Type | Rules | Max | Status | Acties |
|---|---|---|---|---|---|---|
|
{c.name_nl || c.name_en}
{c.is_featured && ⭐ Featured}
|
{c.slug} | {c.type} | {c.rules_json?.rules?.map((r: any) => `${r.field} ${r.operator} ${r.value}`).join(' & ') || '-'} | {c.max_products || '∞'} | {c.is_active ? 'Actief' : 'Inactief'} |
|