d25d482dc2
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
Publish CLI Package / publish-npm (push) Has been cancelled
Publish Python SDK / publish-pypi (push) Has been cancelled
Publish TypeScript SDK / publish-npm (push) Has been cancelled
90 lines
2.7 KiB
TypeScript
90 lines
2.7 KiB
TypeScript
'use client'
|
|
|
|
import { useCallback } from 'react'
|
|
import { domAnimation, LazyMotion, m } from 'framer-motion'
|
|
import { Mic } from 'lucide-react'
|
|
|
|
interface VoiceInputProps {
|
|
onVoiceStart: () => void
|
|
isListening?: boolean
|
|
disabled?: boolean
|
|
large?: boolean
|
|
minimal?: boolean
|
|
}
|
|
|
|
export function VoiceInput({
|
|
onVoiceStart,
|
|
isListening = false,
|
|
disabled = false,
|
|
large = false,
|
|
minimal = false,
|
|
}: VoiceInputProps) {
|
|
const handleVoiceClick = useCallback(() => {
|
|
if (disabled) return
|
|
onVoiceStart()
|
|
}, [disabled, onVoiceStart])
|
|
|
|
if (minimal) {
|
|
return (
|
|
<button
|
|
type='button'
|
|
onClick={handleVoiceClick}
|
|
disabled={disabled}
|
|
className={`flex items-center justify-center rounded-full p-1.5 text-gray-600 transition-colors duration-200 hover:bg-gray-100 md:p-2 ${
|
|
disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'
|
|
}`}
|
|
title='Start voice conversation'
|
|
>
|
|
<Mic size={16} className='md:h-5 md:w-5' />
|
|
</button>
|
|
)
|
|
}
|
|
|
|
if (large) {
|
|
return (
|
|
<div className='flex flex-col items-center'>
|
|
<LazyMotion features={domAnimation}>
|
|
<m.button
|
|
type='button'
|
|
onClick={handleVoiceClick}
|
|
disabled={disabled}
|
|
className={`flex items-center justify-center rounded-full border-2 p-6 transition-all duration-200 ${
|
|
isListening
|
|
? 'border-red-400 bg-red-500/20 text-red-600 hover:bg-red-500/30'
|
|
: 'border-blue-300 bg-blue-500/10 text-blue-600 hover:bg-blue-500/20'
|
|
} ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}`}
|
|
whileHover={{ scale: 1.05 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
title='Start voice conversation'
|
|
>
|
|
<Mic size={32} />
|
|
</m.button>
|
|
</LazyMotion>
|
|
</div>
|
|
)
|
|
}
|
|
|
|
return (
|
|
<div className='flex items-center'>
|
|
<LazyMotion features={domAnimation}>
|
|
<m.button
|
|
type='button'
|
|
onClick={handleVoiceClick}
|
|
disabled={disabled}
|
|
className={`flex items-center justify-center rounded-full p-2.5 transition-all duration-200 md:p-3 ${
|
|
isListening
|
|
? 'bg-red-500 text-white hover:bg-red-600'
|
|
: 'bg-black text-white hover:bg-zinc-700'
|
|
} ${disabled ? 'cursor-not-allowed opacity-50' : 'cursor-pointer'}`}
|
|
whileHover={{ scale: 1.05 }}
|
|
whileTap={{ scale: 0.95 }}
|
|
title='Start voice conversation'
|
|
>
|
|
<Mic size={16} className='md:hidden' />
|
|
<Mic size={18} className='hidden md:block' />
|
|
</m.button>
|
|
</LazyMotion>
|
|
</div>
|
|
)
|
|
}
|