diff --git a/apps/web/components/AI/AIActivityAsk.tsx b/apps/web/components/AI/AIActivityAsk.tsx index 75281795..bc21baeb 100644 --- a/apps/web/components/AI/AIActivityAsk.tsx +++ b/apps/web/components/AI/AIActivityAsk.tsx @@ -2,7 +2,7 @@ import { useSession } from '@components/Contexts/SessionContext' import { sendActivityAIChatMessage, startActivityAIChatSession } from '@services/ai/ai'; import Avvvatars from 'avvvatars-react'; import { motion, AnimatePresence } from 'framer-motion'; -import { FlaskConical, Keyboard, Sparkle, Sparkles, X } from 'lucide-react' +import { FlaskConical, Keyboard, MessageCircle, Sparkle, Sparkles, X } from 'lucide-react' import Image from 'next/image'; import { send } from 'process'; import learnhouseAI_icon from "public/learnhouse_ai_simple.png"; @@ -19,8 +19,9 @@ function AIActivityAsk(props: AIActivityAskProps) { const [isAIModalOpen, setIsAIModalOpen] = React.useState(false); + return ( -
+
setIsAIModalOpen(true)} @@ -59,12 +60,16 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { // TODO : come up with a better way to handle this const inputClass = isWaitingForResponse - ? 'ring-1 ring-inset ring-white/10 bg-transparent w-full rounded-lg outline-none px-4 py-2 text-white text-sm placeholder:text-white/30 opacity-30' + ? 'ring-1 ring-inset ring-white/10 bg-transparent w-full rounded-lg outline-none px-4 py-2 text-white text-sm placeholder:text-white/30 opacity-30 ' : 'ring-1 ring-inset ring-white/10 bg-transparent w-full rounded-lg outline-none px-4 py-2 text-white text-sm placeholder:text-white/30'; - React.useEffect(() => { - - }, [session]); + useEffect(() => { + if (props.isAIModalOpen) { + document.body.style.overflow = 'hidden'; + } else { + document.body.style.overflow = 'unset'; + } + }, [props.isAIModalOpen]); function handleKeyDown(event: React.KeyboardEvent) { if (event.key === 'Enter') { @@ -106,7 +111,7 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { if (messagesEndRef.current) { messagesEndRef.current.scrollIntoView({ behavior: 'smooth' }); } - + }, [messages, session]); @@ -116,11 +121,12 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) { initial={{ y: 20, opacity: 0.3, filter: 'blur(5px)' }} animate={{ y: 0, opacity: 1, filter: 'blur(0px)' }} transition={{ type: "spring", bounce: 0.35, duration: 1.7, mass: 0.2, velocity: 2 }} - className='fixed top-0 left-0 w-full h-full z-50 flex justify-center items-center' + className='fixed top-0 left-0 w-full h-full z-50 flex justify-center items-center ' + style={{ pointerEvents: 'none' }} >
@@ -149,9 +155,9 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) {
) : ( - + )} -
+
@@ -159,6 +165,9 @@ function ActivityChatMessageBox(props: ActivityChatMessageBoxProps) {
+
+ sendMessage(chatInputValue)} /> +
@@ -202,16 +211,17 @@ function AIMessage(props: AIMessageProps) { ) } -const AIMessagePlaceHolder = () => { +const AIMessagePlaceHolder = (props : {activity_uuid : string, sendMessage : any}) => { + const session = useSession() as any; return (
-
+
-

How can we help today ?

-
- Explain in simple examples - Generate flashcards - Break down in concepts +

Hello {session.user.username}, How can we help today ?

+
+ props.sendMessage('Explain this Course in Simple examples.')} className='py-1.5 px-6 text-xs font-semibold text-white/30 rounded-full shadow-2xl bg-black/20 mb-3 outline outline-gray-400/5 cursor-pointer'>Explain in simple examples + props.sendMessage('Generate flashcards about this course and this lecture.')} className='py-1.5 px-6 text-xs font-semibold text-white/30 rounded-full shadow-2xl bg-black/20 mb-3 outline outline-gray-400/5 cursor-pointer'>Generate flashcards + props.sendMessage('Break down this Course in concepts.')} className='py-1.5 px-6 text-xs font-semibold text-white/30 rounded-full shadow-2xl bg-black/20 mb-3 outline outline-gray-400/5 cursor-pointer'>Break down in concepts