Spaces:
Sleeping
Sleeping
Commit ·
f3edaf2
1
Parent(s): f8f5a66
I see this error with the app, reported by NextJS, please fix it. The er
Browse files
src/components/chatbot/chat-message.tsx
CHANGED
|
@@ -8,6 +8,7 @@ import { Bot, User, AlertTriangle, CheckCircle, Info } from 'lucide-react';
|
|
| 8 |
import { Card, CardContent } from '@/components/ui/card';
|
| 9 |
import { MCQOptions } from './mcq-options';
|
| 10 |
import type { GenerateMCQOutput } from '@/ai/flows/generate-mcq';
|
|
|
|
| 11 |
|
| 12 |
interface ChatMessageProps {
|
| 13 |
message: ChatMessageType;
|
|
@@ -27,6 +28,13 @@ export function ChatMessage({
|
|
| 27 |
const isUser = message.sender === 'user';
|
| 28 |
const Icon = isUser ? User : Bot;
|
| 29 |
const avatarFallback = isUser ? 'U' : 'AI';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
const isCurrentActiveMCQMessage =
|
| 32 |
message.type === 'mcq' &&
|
|
@@ -60,7 +68,6 @@ export function ChatMessage({
|
|
| 60 |
{message.type === 'mcq' && message.mcq && (
|
| 61 |
<div className="space-y-2">
|
| 62 |
<p className="font-medium">{message.mcq.mcq}</p>
|
| 63 |
-
{/* Removed Badge rendering of options here */}
|
| 64 |
{isCurrentActiveMCQMessage && onOptionSelectActiveMCQ && (
|
| 65 |
<div className="mt-3">
|
| 66 |
<MCQOptions
|
|
@@ -94,9 +101,11 @@ export function ChatMessage({
|
|
| 94 |
<p className="italic">You chose: "{message.text}"</p>
|
| 95 |
)}
|
| 96 |
|
| 97 |
-
|
| 98 |
-
{
|
| 99 |
-
|
|
|
|
|
|
|
| 100 |
</CardContent>
|
| 101 |
</Card>
|
| 102 |
{isUser && (
|
|
|
|
| 8 |
import { Card, CardContent } from '@/components/ui/card';
|
| 9 |
import { MCQOptions } from './mcq-options';
|
| 10 |
import type { GenerateMCQOutput } from '@/ai/flows/generate-mcq';
|
| 11 |
+
import { useState, useEffect } from 'react';
|
| 12 |
|
| 13 |
interface ChatMessageProps {
|
| 14 |
message: ChatMessageType;
|
|
|
|
| 28 |
const isUser = message.sender === 'user';
|
| 29 |
const Icon = isUser ? User : Bot;
|
| 30 |
const avatarFallback = isUser ? 'U' : 'AI';
|
| 31 |
+
const [formattedTime, setFormattedTime] = useState('');
|
| 32 |
+
|
| 33 |
+
useEffect(() => {
|
| 34 |
+
if (message.timestamp) {
|
| 35 |
+
setFormattedTime(message.timestamp.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }));
|
| 36 |
+
}
|
| 37 |
+
}, [message.timestamp]);
|
| 38 |
|
| 39 |
const isCurrentActiveMCQMessage =
|
| 40 |
message.type === 'mcq' &&
|
|
|
|
| 68 |
{message.type === 'mcq' && message.mcq && (
|
| 69 |
<div className="space-y-2">
|
| 70 |
<p className="font-medium">{message.mcq.mcq}</p>
|
|
|
|
| 71 |
{isCurrentActiveMCQMessage && onOptionSelectActiveMCQ && (
|
| 72 |
<div className="mt-3">
|
| 73 |
<MCQOptions
|
|
|
|
| 101 |
<p className="italic">You chose: "{message.text}"</p>
|
| 102 |
)}
|
| 103 |
|
| 104 |
+
{formattedTime && (
|
| 105 |
+
<p className={cn("mt-1.5 text-xs", isUser ? "text-primary-foreground/70" : "text-muted-foreground")}>
|
| 106 |
+
{formattedTime}
|
| 107 |
+
</p>
|
| 108 |
+
)}
|
| 109 |
</CardContent>
|
| 110 |
</Card>
|
| 111 |
{isUser && (
|