mirror of
https://github.com/fosrl/pangolin.git
synced 2026-06-15 03:48:00 +00:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
"use client";
|
|
|
|
import { type UseFormReturn } from "react-hook-form";
|
|
import type { PolicyFormValues } from ".";
|
|
import { PolicyAuthStackSectionCreate } from "./PolicyAuthStackSectionCreate";
|
|
import { PolicyAuthStackSectionEdit } from "./PolicyAuthStackSectionEdit";
|
|
|
|
type PolicyAuthStackSectionEditProps = {
|
|
mode: "edit";
|
|
orgId: string;
|
|
allIdps: { id: number; text: string }[];
|
|
emailEnabled: boolean;
|
|
readonly?: boolean;
|
|
resourceId?: number;
|
|
};
|
|
|
|
type PolicyAuthStackSectionCreateProps = {
|
|
mode: "create";
|
|
form: UseFormReturn<PolicyFormValues, any, any>;
|
|
orgId: string;
|
|
allIdps: { id: number; text: string }[];
|
|
allRoles: { id: string; text: string }[];
|
|
allUsers: { id: string; text: string }[];
|
|
emailEnabled: boolean;
|
|
};
|
|
|
|
export type PolicyAuthStackSectionProps =
|
|
| PolicyAuthStackSectionEditProps
|
|
| PolicyAuthStackSectionCreateProps;
|
|
|
|
export function PolicyAuthStackSection(props: PolicyAuthStackSectionProps) {
|
|
if (props.mode === "create") {
|
|
const { mode: _, ...createProps } = props;
|
|
return <PolicyAuthStackSectionCreate {...createProps} />;
|
|
}
|
|
const { mode: _, ...editProps } = props;
|
|
return <PolicyAuthStackSectionEdit {...editProps} />;
|
|
}
|