diff --git a/ui/colony/src/App.tsx b/ui/colony/src/App.tsx index 3a22e50..e171469 100644 --- a/ui/colony/src/App.tsx +++ b/ui/colony/src/App.tsx @@ -43,7 +43,7 @@ export default function App() { const [activeChannelId, setActiveChannelId] = useState(null); const [messages, setMessages] = useState([]); const [loading, setLoading] = useState(false); - const [replyTo, setReplyTo] = useState(null); + const [replyTo, setReplyTo] = useState<{ id: string; username: string; content: string } | null>(null); const [sheetOpen, setSheetOpen] = useState(false); const scrollRef = useRef(null); const prevMsgCountRef = useRef(0); @@ -178,7 +178,12 @@ export default function App() { key={msg.id} message={msg} replyTarget={msg.reply_to ? messagesById.get(msg.reply_to) : undefined} - onReply={setReplyTo} + onReply={(id) => { + const target = messagesById.get(id); + if (target) { + setReplyTo({ id, username: target.user.display_name, content: target.content }); + } + }} /> )) )} diff --git a/ui/colony/src/components/ComposeBox.tsx b/ui/colony/src/components/ComposeBox.tsx index b4ebe6e..0336dce 100644 --- a/ui/colony/src/components/ComposeBox.tsx +++ b/ui/colony/src/components/ComposeBox.tsx @@ -4,9 +4,15 @@ import type { User } from "@/types/User"; import { postMessage, getUsers, getCurrentUsername } from "@/api"; import { cn } from "@/lib/utils"; +interface ReplyContext { + id: string; + username: string; + content: string; +} + interface Props { channelId: string; - replyTo: string | null; + replyTo: ReplyContext | null; onClearReply: () => void; onMessageSent: () => void; } @@ -95,7 +101,7 @@ export function ComposeBox({ await postMessage(channelId, { content: content.trim(), type: msgType, - reply_to: replyTo ?? undefined, + reply_to: replyTo?.id ?? undefined, }); setContent(""); setMsgType("text"); @@ -122,11 +128,12 @@ export function ComposeBox({ {replyTo && (
^ - #{replyTo.slice(0, 8)} + {replyTo.username} + {replyTo.content}