Skip to content
19 linesCodeBlameRaw
1import { Stack, useLocalSearchParams } from "expo-router";
2
3import { Conversation } from "@/components/chat/conversation";
4import { Screen } from "@/components/ui";
5import { useChatSidebar } from "@/lib/chat";
6
7/** A thread: the message it is under, its replies, and a box to reply in. */
8export default function ThreadScreen() {
9 const { channel, root } = useLocalSearchParams<{ channel: string; root: string }>();
10 const sidebar = useChatSidebar();
11 const entry = sidebar.data?.entries.find((one) => one.channel.id === channel);
12 const where = entry ? (entry.channel.kind === "dm" ? entry.title : `#${entry.channel.name}`) : "";
13 return (
14 <Screen>
15 <Stack.Screen options={{ title: where ? `Thread in ${where}` : "Thread" }} />
16 <Conversation channelId={channel} thread={root} title={where} />
17 </Screen>
18 );
19}