Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

1.3 KB
Raw Blame
import { useTranslation } from "react-i18next";
import { SettingsCard } from "@/components/settings/settings-card";
import { SettingsSection } from "@/components/settings/settings-section";
import type {
  AdminSettings,
  AdminSettingsChange,
} from "@/fetchers/admin/settings-types";
import { SettingSwitchRow } from "./setting-switch-row";

type IntegrationsSectionProps = {
  settings: AdminSettings;
  pending: boolean;
  onChange: (change: AdminSettingsChange) => void;
};

export function IntegrationsSection({
  settings,
  pending,
  onChange,
}: IntegrationsSectionProps) {
  const { t } = useTranslation();
  const disabled = new Set(settings.disabledIntegrations);

  return (
    <SettingsSection title={t("settings:adminSettings.integrations")}>
      <SettingsCard>
        {settings.integrationProviders.map((provider) => (
          <SettingSwitchRow
            key={provider.type}
            title={provider.name}
            checked={!disabled.has(provider.type)}
            disabled={pending}
            onCheckedChange={(enabled) => {
              const next = new Set(disabled);
              if (enabled) next.delete(provider.type);
              else next.add(provider.type);
              onChange({ disabledIntegrations: [...next] });
            }}
          />
        ))}
      </SettingsCard>
    </SettingsSection>
  );
}