diff --git a/checkers-app/src/components/vote/MessageCard.tsx b/checkers-app/src/components/vote/MessageCard.tsx index 69707e2e..900b4a14 100644 --- a/checkers-app/src/components/vote/MessageCard.tsx +++ b/checkers-app/src/components/vote/MessageCard.tsx @@ -1,11 +1,13 @@ import React, { useState } from "react"; -import { Card, CardBody, Typography, Button } from "@material-tailwind/react"; +import { Card, CardBody, Typography, Button, Alert } from "@material-tailwind/react"; +import { ChatBubbleLeftEllipsisIcon, PaperAirplaneIcon } from "@heroicons/react/20/solid"; interface PropType { text: string | null; type: "image" | "text"; caption: string | null; imageUrl: string | null; + sender: string | null; } // Helper function to detect URLs and split the text @@ -44,7 +46,7 @@ const splitTextByUrls = (text: string) => { export default function MessageCard(prop: PropType) { const [isExpanded, setIsExpanded] = useState(false); const lengthBeforeTruncation = 300; - const { text, caption, imageUrl, type } = prop; + const { text, caption, imageUrl, type, sender } = prop; const toggleExpansion = () => { setIsExpanded(!isExpanded); @@ -69,6 +71,10 @@ export default function MessageCard(prop: PropType) { return ( + + +

Messageļ¼š

+
{type === "image" && displayText.length > 0 && ( Caption: @@ -109,6 +115,7 @@ export default function MessageCard(prop: PropType) { {isExpanded ? "Show Less" : "Read More"} )} +
{type === "image" && imageUrl && ( )} + + + +

Sender: {sender}

+
+
); } diff --git a/checkers-app/src/components/vote/index.tsx b/checkers-app/src/components/vote/index.tsx index 6eb8136f..6dde0991 100644 --- a/checkers-app/src/components/vote/index.tsx +++ b/checkers-app/src/components/vote/index.tsx @@ -1,5 +1,5 @@ import MessageCard from "./MessageCard"; -import { Typography, Alert } from "@material-tailwind/react"; +import { Typography } from "@material-tailwind/react"; import { useEffect, useState } from "react"; import { useParams } from "react-router-dom"; import { useUser } from "../../providers/UserContext"; @@ -64,8 +64,9 @@ export default function VotePage() { text={vote.text} imageUrl={vote.signedImageUrl} caption={vote.caption} + sender={vote.sender} /> - Sender: {vote.sender} + {vote.communityNote ? (