confirmation-accepted.tsx 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Derived from vercel/ai-elements (skills/ai-elements/scripts/confirmation-accepted.tsx).
  3. * Copyright 2023 Vercel, Inc. Licensed under Apache-2.0.
  4. * Modified by ZCode: local integration, formatting and adaptations.
  5. * See THIRD-PARTY-NOTICES.md in the repository root for license and provenance.
  6. */
  7. "use client";
  8. import {
  9. Confirmation,
  10. ConfirmationAccepted,
  11. ConfirmationRejected,
  12. ConfirmationRequest,
  13. ConfirmationTitle,
  14. } from "@/components/ai-elements/confirmation";
  15. import { CheckIcon, XIcon } from "lucide-react";
  16. import { nanoid } from "nanoid";
  17. const Example = () => (
  18. <div className="w-full max-w-2xl">
  19. <Confirmation approval={{ approved: true, id: nanoid() }} state="approval-responded">
  20. <ConfirmationTitle>
  21. <ConfirmationRequest>
  22. This tool wants to delete the file{" "}
  23. <code className="rounded bg-muted px-1.5 py-0.5 text-sm">/tmp/example.txt</code>. Do you
  24. approve this action?
  25. </ConfirmationRequest>
  26. <ConfirmationAccepted>
  27. <CheckIcon className="size-4 text-green-600 dark:text-green-400" />
  28. <span>You approved this tool execution</span>
  29. </ConfirmationAccepted>
  30. <ConfirmationRejected>
  31. <XIcon className="size-4 text-destructive" />
  32. <span>You rejected this tool execution</span>
  33. </ConfirmationRejected>
  34. </ConfirmationTitle>
  35. </Confirmation>
  36. </div>
  37. );
  38. export default Example;