diff --git a/www/components/messagebox.tsx b/www/components/messagebox.tsx index f7f25fc..c2bdd7e 100644 --- a/www/components/messagebox.tsx +++ b/www/components/messagebox.tsx @@ -3,12 +3,12 @@ import Image from 'next/image'; import icon from '@/public/bloomicon.jpg'; import usericon from '@/public/usericon.svg'; import Skeleton from 'react-loading-skeleton'; -import { FaLightbulb } from 'react-icons/fa'; -import { API } from '@/utils/api'; import MarkdownWrapper from './markdownWrapper'; +import { FaLightbulb, FaThumbsDown, FaThumbsUp } from 'react-icons/fa'; +import { API, type Message } from '@/utils/api'; +import Spinner from './spinner'; -export type Reaction = "thumbs_up" | "thumbs_down" | null; - +export type Reaction = 'thumbs_up' | 'thumbs_down' | null; interface MessageBoxProps { isUser?: boolean; @@ -23,8 +23,6 @@ interface MessageBoxProps { onReactionAdded: (messageId: string, reaction: Reaction) => Promise; } -export type Reaction = "thumbs_up" | "thumbs_down" | null; - export default function MessageBox({ isUser, userId, @@ -42,7 +40,7 @@ export default function MessageBox({ const { id: messageId, text, metadata } = message; const reaction = metadata?.reaction || null; - const shouldShowButtons = messageId !== ""; + const shouldShowButtons = messageId !== ''; const handleReaction = async (newReaction: Exclude) => { if (!messageId || !conversationId || !userId || !URL) return; @@ -53,11 +51,11 @@ export default function MessageBox({ const reactionToSend = reaction === newReaction ? null : newReaction; await onReactionAdded( messageId, - reactionToSend as Exclude, + reactionToSend as Exclude ); } catch (err) { console.error(err); - setError("Failed to update reaction."); + setError('Failed to update reaction.'); } finally { setPendingReaction(null); } @@ -108,15 +106,16 @@ export default function MessageBox({ {!loading && !isUser && shouldShowButtons && (