'use client';

import { useT } from '@/lib/i18n/react';
import type { Config } from './config';

interface Props {
  instanceId?: string;
  config: Config;
  onChange: (c: Config) => void;
}

/**
 * ConfigEditor for category-chips.
 * Categories are seeded by default and typically not edited in admin.
 * Shows a read-only summary of configured categories.
 */
export function ConfigEditor({ config }: Props) {
  const t = useT('category_chips');
  return (
    <div className="flex flex-col gap-2">
      <p className="text-text-muted text-sm">{t('editor_hint')}</p>
      <ul className="flex flex-wrap gap-1.5">
        {config.categories.map((c) => (
          <li
            key={c.slug}
            className="bg-surface-raised text-text-secondary rounded-full px-2.5 py-0.5 text-xs"
          >
            {c.label.he}
          </li>
        ))}
      </ul>
    </div>
  );
}
