diff --git a/examples/conversational-ai/talk-to-santa/components/call-button.tsx b/examples/conversational-ai/talk-to-santa/components/call-button.tsx index 40007c9..8538f78 100644 --- a/examples/conversational-ai/talk-to-santa/components/call-button.tsx +++ b/examples/conversational-ai/talk-to-santa/components/call-button.tsx @@ -1,6 +1,6 @@ "use client"; -import { Button } from "@/components/ui/button"; +import { Button, buttonVariants } from "@/components/ui/button"; import { cn } from "@/lib/utils"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; @@ -8,6 +8,15 @@ import { Loader2 } from "lucide-react"; import Image from "next/image"; import { useState } from "react"; import { LanguageDropdown, LANGUAGES } from "@/components/language-dropdown"; +import Link from "next/link"; +import { + Dialog, + DialogContent, + DialogHeader, + DialogTitle, + DialogDescription, + DialogFooter, +} from "@/components/ui/dialog"; interface CallButtonProps { status: "disconnected" | "connecting" | "connected" | "disconnecting"; @@ -35,6 +44,7 @@ export function CallButton({ languages, }: CallButtonProps) { const [isCalling, setIsCalling] = useState(false); + const [showAgeModal, setShowAgeModal] = useState(false); const [ringingPhoneAudio] = useState(() => { if (typeof Audio !== "undefined") { const audioInstance = new Audio("/assets/ringing-phone.mp3"); @@ -49,6 +59,11 @@ export function CallButton({ requestMediaPermissions(); return; } + setShowAgeModal(true); + }; + + const handleAgeConfirm = () => { + setShowAgeModal(false); setIsCalling(true); ringingPhoneAudio?.play(); setTimeout(() => { @@ -57,6 +72,7 @@ export function CallButton({ startCall(); }, RINGING_PHONE_AUDIO_DURATION); }; + return ( <> {!isCalling && ( @@ -97,6 +113,23 @@ export function CallButton({ )} + + {!isCalling && ( +
+ Powered by{" "} + + ElevenLabs Conversational AI + +
+ )} + {!isCalling && (
+ + + + + Age Verification + + Please confirm that you are 18 years or older to continue. + + + + + + + + ); } diff --git a/examples/conversational-ai/talk-to-santa/components/ui/dialog.tsx b/examples/conversational-ai/talk-to-santa/components/ui/dialog.tsx new file mode 100644 index 0000000..1647513 --- /dev/null +++ b/examples/conversational-ai/talk-to-santa/components/ui/dialog.tsx @@ -0,0 +1,122 @@ +"use client" + +import * as React from "react" +import * as DialogPrimitive from "@radix-ui/react-dialog" +import { X } from "lucide-react" + +import { cn } from "@/lib/utils" + +const Dialog = DialogPrimitive.Root + +const DialogTrigger = DialogPrimitive.Trigger + +const DialogPortal = DialogPrimitive.Portal + +const DialogClose = DialogPrimitive.Close + +const DialogOverlay = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogOverlay.displayName = DialogPrimitive.Overlay.displayName + +const DialogContent = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, children, ...props }, ref) => ( + + + + {children} + + + Close + + + +)) +DialogContent.displayName = DialogPrimitive.Content.displayName + +const DialogHeader = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogHeader.displayName = "DialogHeader" + +const DialogFooter = ({ + className, + ...props +}: React.HTMLAttributes) => ( +
+) +DialogFooter.displayName = "DialogFooter" + +const DialogTitle = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogTitle.displayName = DialogPrimitive.Title.displayName + +const DialogDescription = React.forwardRef< + React.ElementRef, + React.ComponentPropsWithoutRef +>(({ className, ...props }, ref) => ( + +)) +DialogDescription.displayName = DialogPrimitive.Description.displayName + +export { + Dialog, + DialogPortal, + DialogOverlay, + DialogTrigger, + DialogClose, + DialogContent, + DialogHeader, + DialogFooter, + DialogTitle, + DialogDescription, +}