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";
import { useLockNote } from "./use-lock-note";

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

export function WorkspacesSection({
  settings,
  pending,
  onChange,
}: WorkspacesSectionProps) {
  const { t } = useTranslation();
  const lockNote = useLockNote(settings);

  return (
    <SettingsSection title={t("settings:adminSettings.workspaces")}>
      <SettingsCard>
        <SettingSwitchRow
          title={t("settings:adminSettings.workspaceCreationRestricted")}
          description={lockNote("workspaceCreationRestricted")}
          checked={settings.workspaceCreationRestricted}
          disabled={
            pending ||
            settings.lockedByEnv.includes("workspaceCreationRestricted")
          }
          onCheckedChange={(workspaceCreationRestricted) =>
            onChange({ workspaceCreationRestricted })
          }
        />
      </SettingsCard>
    </SettingsSection>
  );
}