diff --git a/src/components/mail/tray/TrayList.tsx b/src/components/mail/tray/TrayList.tsx
index 0f06e97..09ded8b 100644
--- a/src/components/mail/tray/TrayList.tsx
+++ b/src/components/mail/tray/TrayList.tsx
@@ -9,7 +9,7 @@ export interface TrayListProps {
from: {
name: string;
avatar: string;
- };
+ }[];
subject: string;
createdAt: string;
body: string;
@@ -95,7 +95,8 @@ const TrayList = ({
{mails.map((email) => (
f.name)}
active={activeEmail === email.id}
selected={checked || selectedEmails.includes(email.id)}
onClick={onMailSelected}
diff --git a/src/components/mail/tray/__test__/MessageCheap.test.tsx b/src/components/mail/tray/__test__/MessageCheap.test.tsx
index eb9b24a..5949915 100644
--- a/src/components/mail/tray/__test__/MessageCheap.test.tsx
+++ b/src/components/mail/tray/__test__/MessageCheap.test.tsx
@@ -112,4 +112,23 @@ describe('MessageCheap', () => {
expect(mockOnClick).not.toHaveBeenCalled();
});
+
+ it('should render participants count badge when there is a conversation', () => {
+ render();
+
+ expect(screen.getByText('2')).toBeInTheDocument();
+ });
+
+ it('should render joined participant names when there is a conversation', () => {
+ render();
+
+ expect(screen.getByText('Bea Donell & John Appleseed')).toBeInTheDocument();
+ });
+
+ it('should render single sender name when participants has 0 or 1 entries', () => {
+ render();
+
+ expect(screen.getByText('John Doe')).toBeInTheDocument();
+ expect(screen.queryByText('1')).not.toBeInTheDocument();
+ });
});
diff --git a/src/components/mail/tray/__test__/TrayList.test.tsx b/src/components/mail/tray/__test__/TrayList.test.tsx
index 5396a82..77251ed 100644
--- a/src/components/mail/tray/__test__/TrayList.test.tsx
+++ b/src/components/mail/tray/__test__/TrayList.test.tsx
@@ -7,10 +7,12 @@ import TrayList from '../TrayList';
const mockMails = [
{
id: '1',
- from: {
- name: 'John Doe',
- avatar: 'https://example.com/avatar1.jpg',
- },
+ from: [
+ {
+ name: 'John Doe',
+ avatar: 'https://example.com/avatar1.jpg',
+ },
+ ],
subject: 'Test Subject 1',
createdAt: '2024-01-15',
body: 'This is test email 1',
@@ -18,10 +20,12 @@ const mockMails = [
},
{
id: '2',
- from: {
- name: 'Jane Smith',
- avatar: 'https://example.com/avatar2.jpg',
- },
+ from: [
+ {
+ name: 'Jane Smith',
+ avatar: 'https://example.com/avatar2.jpg',
+ },
+ ],
subject: 'Test Subject 2',
createdAt: '2024-01-16',
body: 'This is test email 2',
diff --git a/src/stories/components/mail/tray/Tray.stories.tsx b/src/stories/components/mail/tray/Tray.stories.tsx
index 6f7daf1..4ab56e8 100644
--- a/src/stories/components/mail/tray/Tray.stories.tsx
+++ b/src/stories/components/mail/tray/Tray.stories.tsx
@@ -5,7 +5,7 @@ import TrayList from '../../../../components/mail/tray/TrayList';
const mockMails = [
{
id: '1',
- from: { name: 'John Doe', avatar: '' },
+ from: [{ name: 'John Doe', avatar: '' }],
subject: 'Meeting tomorrow',
createdAt: '10:30 AM',
body: 'Hi, just a reminder about our meeting tomorrow at 3pm.',
@@ -13,7 +13,7 @@ const mockMails = [
},
{
id: '2',
- from: { name: 'Jane Smith', avatar: '' },
+ from: [{ name: 'Jane Smith', avatar: '' }],
subject: 'Project update',
createdAt: '9:15 AM',
body: 'The project is progressing well. Here are the latest updates...',
@@ -21,7 +21,7 @@ const mockMails = [
},
{
id: '3',
- from: { name: 'Mike Johnson', avatar: '' },
+ from: [{ name: 'Mike Johnson', avatar: '' }],
subject: 'Invoice #1234',
createdAt: 'Yesterday',
body: 'Please find attached the invoice for last month services.',
@@ -29,7 +29,7 @@ const mockMails = [
},
{
id: '4',
- from: { name: 'Sarah Wilson', avatar: '' },
+ from: [{ name: 'Sarah Wilson', avatar: '' }],
subject: 'Welcome to the team!',
createdAt: 'Yesterday',
body: 'We are excited to have you on board. Let me know if you need anything.',
@@ -37,7 +37,7 @@ const mockMails = [
},
{
id: '5',
- from: { name: 'Tech Support', avatar: '' },
+ from: [{ name: 'Tech Support', avatar: '' }],
subject: 'Your ticket has been resolved',
createdAt: 'Feb 20',
body: 'Your support ticket #5678 has been resolved. Please let us know if you have any questions.',