import { HelpCircle, Shield } from "lucide-react"; import type { PermissionEventData, QuestionEventData } from "sandbox-agent"; import { formatJson } from "../../utils/format"; const ApprovalsTab = ({ questionRequests, permissionRequests, questionSelections, onSelectQuestionOption, onAnswerQuestion, onRejectQuestion, onReplyPermission }: { questionRequests: QuestionEventData[]; permissionRequests: PermissionEventData[]; questionSelections: Record; onSelectQuestionOption: (requestId: string, optionLabel: string) => void; onAnswerQuestion: (request: QuestionEventData) => void; onRejectQuestion: (requestId: string) => void; onReplyPermission: (requestId: string, reply: "once" | "always" | "reject") => void; }) => { return ( <> {questionRequests.length === 0 && permissionRequests.length === 0 ? (
No pending approvals.
) : ( <> {questionRequests.map((request) => { const selections = questionSelections[request.question_id] ?? []; const selected = selections[0] ?? []; const answered = selected.length > 0; return (
Question Pending
{request.prompt}
{request.options.map((option) => { const isSelected = selected.includes(option); return ( ); })}
); })} {permissionRequests.map((request) => (
Permission Pending
{request.action}
{request.metadata !== null && request.metadata !== undefined && (
{formatJson(request.metadata)}
)}
))} )} ); }; export default ApprovalsTab;