"use client"; import { ChevronsUpDown } from "lucide-react"; import { Checkbox } from "@/components/ui/checkbox"; import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "@/components/ui/collapsible"; import { Button } from "@/components/ui/button"; import ScopeItem from "@/components/scopes/ScopeItem"; import { ScopeInfo } from "@/lib/types"; interface ScopeSectionProps { info: ScopeInfo; field: any; } const ScopeSection: React.FC = ({ info, field }) => { const { method, description, scopes, label } = info; const isNested = scopes && scopes.length !== 0; return (
{ return checked ? field.onChange([...field.value, method]) : field.onChange( field.value?.filter((value: string) => value !== method) ); }} />

{description}

{isNested && ( )}
{isNested && (
{method === "admin" ? (scopes as string[][]).map((items) => (
{items.map((item) => ( ))}
)) : (scopes as string[]).map((scope) => ( ))}
)}
); }; export default ScopeSection;