diff --git a/website/src/components/Messages/MessageWithChildren.tsx b/website/src/components/Messages/MessageWithChildren.tsx
index 70d6c318..8fcd8658 100644
--- a/website/src/components/Messages/MessageWithChildren.tsx
+++ b/website/src/components/Messages/MessageWithChildren.tsx
@@ -1,18 +1,33 @@
-import { Box, CircularProgress, Flex, HStack, Text } from "@chakra-ui/react";
+import { Box, CircularProgress, Flex, HStack, StackDivider, Text, TextProps, StackProps } from "@chakra-ui/react";
import { useState } from "react";
import useSWR from "swr";
import fetcher from "src/lib/fetcher";
import { MessageTableEntry } from "./MessageTableEntry";
+import { boolean } from "boolean";
+
+const MessageHeaderProps: TextProps = {
+ align: "center",
+ fontSize: "xl",
+ py: "2",
+};
+
+const MessageStackProps: StackProps = {
+ spacing: "2",
+ alignItems: "start",
+ justifyContent: "center",
+ divider: ,
+};
interface MessageWithChildrenProps {
id: string;
depth?: number;
maxDepth?: number;
+ isOnlyChild?: boolean;
}
export function MessageWithChildren(props: MessageWithChildrenProps) {
- const { id, depth, maxDepth } = props;
+ const { id, depth, maxDepth, isOnlyChild = true } = props;
const [message, setMessage] = useState(null);
const [children, setChildren] = useState(null);
@@ -35,6 +50,8 @@ export function MessageWithChildren(props: MessageWithChildrenProps) {
});
const renderRecursive = maxDepth && ((depth && depth < maxDepth) || !depth);
+ const isFirst = depth === 0 || !depth;
+ const isFirstOrOnly = isFirst || boolean(isOnlyChild);
if (isLoading || isLoadingChildren) {
return ;
@@ -44,12 +61,10 @@ export function MessageWithChildren(props: MessageWithChildrenProps) {
<>
{message && (
<>
-
- {depth === 0 || !depth ? "Message" : depth === 1 ? "Children" : "Ancestor"}
-
-
-
-
+ {isFirst ? "Message" : depth === 1 ? "Children" : "Ancestor"}
+
+
+
@@ -58,24 +73,25 @@ export function MessageWithChildren(props: MessageWithChildrenProps) {
)}
{children && Array.isArray(children) && children.length > 0 ? (
renderRecursive ? (
-
+
{children.map((item, idx) => (
-
+
))}
) : (
<>
-
- {depth === 0 || !depth ? "Children" : "Ancestor"}
-
-
+ {isFirstOrOnly ? "Children" : "Ancestor"}
+
{children.map((item, idx) => (
-
-
-
-
+
+
))}
diff --git a/website/src/pages/messages/[id]/index.tsx b/website/src/pages/messages/[id]/index.tsx
index bf7e97ea..e778e74a 100644
--- a/website/src/pages/messages/[id]/index.tsx
+++ b/website/src/pages/messages/[id]/index.tsx
@@ -48,7 +48,7 @@ const MessageDetail = ({ id }) => {
>
)}
-
+