44 lines
1.6 KiB
TypeScript
44 lines
1.6 KiB
TypeScript
import React, { useState } from 'react';
|
|
|
|
const AiVoiceWidget: React.FC = () => {
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
|
// This is a placeholder component.
|
|
// The actual implementation for voice commands would be more complex and involve the AI model API.
|
|
|
|
if (!isOpen) {
|
|
return (
|
|
<button
|
|
onClick={() => setIsOpen(true)}
|
|
className="fixed bottom-6 right-6 bg-red-600 text-white w-16 h-16 rounded-full shadow-lg flex items-center justify-center hover:bg-red-700 transition-transform hover:scale-110 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500 z-40"
|
|
aria-label="Open AI Voice Assistant"
|
|
>
|
|
<i className="fa-solid fa-microphone text-2xl"></i>
|
|
</button>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className="fixed bottom-6 right-6 w-80 bg-white rounded-2xl shadow-2xl z-40 border border-gray-200 transform transition-all">
|
|
<div className="p-4">
|
|
<div className="flex justify-between items-center mb-2">
|
|
<h3 className="font-bold text-gray-800">AI Voice Assistant</h3>
|
|
<button
|
|
onClick={() => setIsOpen(false)}
|
|
className="text-gray-400 hover:text-gray-600 text-xl"
|
|
>
|
|
×
|
|
</button>
|
|
</div>
|
|
<div className="text-center py-8 bg-gray-50 rounded-lg">
|
|
<i className="fa-solid fa-microphone-lines text-4xl text-red-500 animate-pulse"></i>
|
|
<p className="text-sm text-gray-600 mt-3">Listening...</p>
|
|
<p className="text-xs text-gray-400 mt-1">Try: "Show me mortality rate"</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
export default AiVoiceWidget;
|