import { ReactNode } from "react";
import { GenericFieldLabel } from "@app/components/secret-syncs";
import {
HumanitecSyncScope,
THumanitecSync
} from "@app/hooks/api/secretSyncs/types/humanitec-sync";
type Props = {
secretSync: THumanitecSync;
};
export const HumanitecSyncDestinationSection = ({ secretSync }: Props) => {
const { destinationConfig } = secretSync;
let Components: ReactNode;
switch (destinationConfig.scope) {
case HumanitecSyncScope.Application:
Components = (
<>
{destinationConfig.app}
{destinationConfig.org}
>
);
break;
case HumanitecSyncScope.Environment:
Components = (
<>
{destinationConfig.app}
{destinationConfig.org}
{destinationConfig.env}
>
);
break;
default:
throw new Error(
`Uhandled Humanitec Sync Destination Section Scope ${secretSync.destinationConfig.scope}`
);
}
return (
<>
{destinationConfig.scope.replace("-", " ")}
{Components}
>
);
};