- {(!minimized || startExpanded) && (
+ {(!minimized) && (
<>
{showTabs && (
@@ -152,7 +171,6 @@ export default function ChatBox({ showAllMessagesTab = false, className = "", st
key={msg.ingest_timestamp + (msg.origins?.join(',') ?? '') + i}
msg={msg}
showErrorRow={selectedKey.isAllMessages}
- showChannelId={selectedKey.isAllMessages}
/>
))}
{hasMore && (
diff --git a/src/components/ChatMessageItem.tsx b/src/components/ChatMessageItem.tsx
index 8136318..81b4422 100644
--- a/src/components/ChatMessageItem.tsx
+++ b/src/components/ChatMessageItem.tsx
@@ -24,7 +24,7 @@ function formatLocalTime(utcString: string): string {
return utcDate.toLocaleString();
}
-export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: { msg: ChatMessage, showErrorRow?: boolean, showChannelId?: boolean }) {
+export default function ChatMessageItem({ msg, showErrorRow }: { msg: ChatMessage, showErrorRow?: boolean }) {
const { config } = useConfig();
const knownKeys = [
...(config?.meshcoreKeys?.map((k: any) => k.privateKey) || []),
@@ -32,6 +32,7 @@ export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: {
];
const [parsed, setParsed] = useState
(null);
const [error, setError] = useState(null);
+ const [originsExpanded, setOriginsExpanded] = useState(false);
useEffect(() => {
let cancelled = false;
@@ -63,22 +64,51 @@ export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: {
return () => { cancelled = true; };
}, [msg.encrypted_message, msg.mac, msg.channel_hash, knownKeys.join(",")]);
+ const origins = msg.origins && msg.origins.length > 0 ? msg.origins : [];
+ const originsCount = origins.length;
+
+ const OriginsBox = () => (
+
+
+ {originsExpanded && originsCount > 0 && (
+
+ {origins.map((origin, index) => (
+
+ {origin}
+
+ ))}
+
+ )}
+
+ );
+
if (parsed) {
return (
{formatLocalTime(new Date(parsed.timestamp * 1000).toISOString())}
type: {parsed.msgType}
- {showChannelId && (
- channel: {msg.channel_hash}
- )}
+ channel: {msg.channel_hash}
{parsed.sender}
{parsed.sender && ": "}
{parsed.text}
-
Relayed by: {msg.origins && msg.origins.length > 0 ? msg.origins.map(o => o.slice(0, 6)).join(", ") : "-"}
+
);
}
@@ -89,11 +119,9 @@ export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: {
Error: {error}
- {showChannelId && (
- channel: {msg.channel_hash}
- )}
+ channel: {msg.channel_hash}
-
Relayed by: {msg.origins && msg.origins.length > 0 ? msg.origins.map(o => o.slice(0, 6)).join(", ") : "-"}
+
);
}else{
@@ -103,14 +131,12 @@ export default function ChatMessageItem({ msg, showErrorRow, showChannelId }: {
return (
-
- {formatLocalTime(msg.ingest_timestamp)}
- {showChannelId && (
- channel: {msg.channel_hash}
- )}
-
+
+ {formatLocalTime(msg.ingest_timestamp)}
+ channel: {msg.channel_hash}
+
-
Relayed by: {msg.origins && msg.origins.length > 0 ? msg.origins.map(o => o.slice(0, 6)).join(", ") : "-"}
+
);
}
\ No newline at end of file