diff --git a/src/app/groups/[id]/page.tsx b/src/app/groups/[id]/page.tsx index 02ab880..6813b02 100644 --- a/src/app/groups/[id]/page.tsx +++ b/src/app/groups/[id]/page.tsx @@ -4,6 +4,7 @@ import { Navbar } from "@/components/Navbar"; import { MemberList } from "@/components/MemberList"; import { RoundProgress } from "@/components/RoundProgress"; import { ContributeModal } from "@/components/ContributeModal"; +import { GroupChat } from "@/components/GroupChat"; import { useState } from "react"; import { formatAmount, GroupStatus } from "@sorosave/sdk"; @@ -34,6 +35,7 @@ const MOCK_GROUP = { export default function GroupDetailPage() { const [showContributeModal, setShowContributeModal] = useState(false); + const [showChat, setShowChat] = useState(false); const group = MOCK_GROUP; return ( @@ -78,6 +80,15 @@ export default function GroupDetailPage() { Contribute )} + {group.status === GroupStatus.Forming && ( + + + {/* Messages */} +
+ {messages.length === 0 && ( +
+ + + +

No messages yet

+

Start the conversation!

+
+ )} + + {messages.map((msg) => { + const isOwn = msg.sender === address; + return ( +
+
+ {!isOwn && ( +

+ {shortenAddress(msg.sender)} +

+ )} +
+ {msg.text} +
+
+ + {formatTime(msg.timestamp)} + + + ✓ + +
+
+
+ ); + })} +
+
+ + {/* Input */} +
+ {!isConnected ? ( +

+ Connect wallet to chat +

+ ) : !isMember ? ( +

+ Join the group to chat +

+ ) : ( +
+ setInput(e.target.value)} + onKeyDown={handleKeyDown} + placeholder="Type a message..." + maxLength={500} + className="flex-1 bg-gray-100 dark:bg-gray-800 text-gray-900 dark:text-gray-100 rounded-full px-4 py-2 text-sm outline-none focus:ring-2 focus:ring-primary-500" + /> + +
+ )} +
+
+ ); +}