'use client';

import { useT } from '@/lib/i18n/react';
import { Switch } from '@/components/ui/primitives/Switch';
import { Label } from '@/components/ui/primitives/Label';
import type { Config } from './config';

export function ConfigEditor({
  config,
  onChange,
}: {
  config: Config;
  onChange: (c: Config) => void;
}) {
  const t = useT('greeting-bar');
  return (
    <div className="flex items-center gap-3">
      <Switch
        id="greeting-savings"
        checked={config.showSavings}
        onCheckedChange={(v) => onChange({ ...config, showSavings: v })}
      />
      <Label htmlFor="greeting-savings">{t('config_show_savings')}</Label>
    </div>
  );
}
