diff --git a/packages/dashboard/src/pages/contacts/[id].tsx b/packages/dashboard/src/pages/contacts/[id].tsx
index a6084d4..b739707 100644
--- a/packages/dashboard/src/pages/contacts/[id].tsx
+++ b/packages/dashboard/src/pages/contacts/[id].tsx
@@ -33,7 +33,7 @@ interface EventValues {
*/
export default function Index() {
const router = useRouter();
-
+ const [selectedEmail, setSelectedEmail] = useState(null);
if (!router.isReady) {
return ;
}
@@ -400,53 +400,69 @@ export default function Index() {
{contact.triggers.length > 0 || contact.emails.length > 0 ? (
- {[...contact.triggers, ...contact.emails]
- .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
- .map((t, index) => {
- if (t.messageId) {
- const email = t as Email;
+{[...contact.triggers, ...contact.emails]
+ .sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime())
+ .map((t, index) => {
+ if (t.messageId) {
+ const email = t as Email;
+ const expanded = selectedEmail?.id === email.id;
- return (
- -
-
- {contact.triggers.length + contact.emails.length - 1 !== index && (
-
- )}
-
-
-
-
-
-
Transactional email {email.subject} delivered
-
-
-
-
-
-
-
-
- );
- }
+ return (
+ -
+ {contact.triggers.length + contact.emails.length - 1 !== index && (
+
+ )}
+
+
+
+
+
setSelectedEmail(expanded ? null : email)}
+ >
+ Transactional email {email.subject} delivered
+
+
+
+
+
+
+
+ {/* Expanded panel for all screen sizes */}
+ {expanded && (
+
+
+
+ Status:{" "}
+ {email.status}
+
+
+ Sent:{" "}
+ {dayjs(email.createdAt).format("YYYY-MM-DD HH:mm")}
+
+
+
Body:
+
+ {email.body || No body available}
+
+
+
+
+ )}
+
+
+ );
+ }
if (t.action) {
return (