feat(conversation-selector): add conversation status badges to conversation selector and include status in sample data

This commit is contained in:
2025-12-18 08:16:46 +00:00
parent c8554418de
commit d61c3b6643
4 changed files with 58 additions and 1 deletions

View File

@@ -1,5 +1,12 @@
# Changelog # Changelog
## 2025-12-18 - 1.6.0 - feat(conversation-selector)
add conversation status badges to conversation selector and include status in sample data
- Introduce TConversationStatus type and add optional status property to IConversation
- Render status badges in sio-conversation-selector with CSS classes and a getBadgeLabel helper
- Update sample conversations in sio-combox.ts to include statuses: 'new', 'needs-action', 'waiting', 'resolved'
## 2025-12-17 - 1.5.0 - feat(combox) ## 2025-12-17 - 1.5.0 - feat(combox)
Introduce singleton SioCombox attached to document.body with open/close/toggle API and animated show/hide; integrate SioFab to use the singleton and update styles/positioning Introduce singleton SioCombox attached to document.body with open/close/toggle API and animated show/hide; integrate SioFab to use the singleton and update styles/positioning

View File

@@ -3,6 +3,6 @@
*/ */
export const commitinfo = { export const commitinfo = {
name: '@social.io/catalog', name: '@social.io/catalog',
version: '1.5.0', version: '1.6.0',
description: 'catalog for social.io' description: 'catalog for social.io'
} }

View File

@@ -79,24 +79,28 @@ export class SioCombox extends DeesElement {
lastMessage: 'Thanks for your help with the login issue!', lastMessage: 'Thanks for your help with the login issue!',
time: '2 min ago', time: '2 min ago',
unread: true, unread: true,
status: 'new',
}, },
{ {
id: '2', id: '2',
title: 'Billing Question', title: 'Billing Question',
lastMessage: 'I need help understanding my invoice', lastMessage: 'I need help understanding my invoice',
time: '1 hour ago', time: '1 hour ago',
status: 'needs-action',
}, },
{ {
id: '3', id: '3',
title: 'Feature Request', title: 'Feature Request',
lastMessage: 'That would be great! Looking forward to it', lastMessage: 'That would be great! Looking forward to it',
time: 'Yesterday', time: 'Yesterday',
status: 'waiting',
}, },
{ {
id: '4', id: '4',
title: 'General Inquiry', title: 'General Inquiry',
lastMessage: 'Thank you for the information', lastMessage: 'Thank you for the information',
time: '2 days ago', time: '2 days ago',
status: 'resolved',
} }
]; ];

View File

@@ -16,6 +16,8 @@ import { spacing, radius, shadows, transitions } from './00tokens.js';
import { fontFamilies, typography } from './00fonts.js'; import { fontFamilies, typography } from './00fonts.js';
// Types // Types
export type TConversationStatus = 'new' | 'waiting' | 'needs-action' | 'resolved';
export interface IConversation { export interface IConversation {
id: string; id: string;
title: string; title: string;
@@ -23,6 +25,7 @@ export interface IConversation {
time: string; time: string;
unread?: boolean; unread?: boolean;
avatar?: string; avatar?: string;
status?: TConversationStatus;
} }
declare global { declare global {
@@ -232,6 +235,38 @@ export class SioConversationSelector extends DeesElement {
} }
} }
.badge {
display: inline-flex;
align-items: center;
padding: 2px ${unsafeCSS(spacing["2"])};
font-size: 0.625rem;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.025em;
border-radius: ${unsafeCSS(radius.full)};
white-space: nowrap;
}
.badge.new {
background: ${bdTheme('primary')}20;
color: ${bdTheme('primary')};
}
.badge.waiting {
background: ${bdTheme('muted')};
color: ${bdTheme('mutedForeground')};
}
.badge.needs-action {
background: hsl(38 92% 50% / 0.15);
color: hsl(38 92% 40%);
}
.badge.resolved {
background: ${bdTheme('success')}20;
color: ${bdTheme('success')};
}
.empty-state { .empty-state {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
@@ -331,6 +366,7 @@ export class SioConversationSelector extends DeesElement {
<span class="conversation-title"> <span class="conversation-title">
${conv.title} ${conv.title}
${conv.unread ? html`<span class="unread-dot"></span>` : ''} ${conv.unread ? html`<span class="unread-dot"></span>` : ''}
${conv.status ? html`<span class="badge ${conv.status}">${this.getBadgeLabel(conv.status)}</span>` : ''}
</span> </span>
<span class="conversation-time">${conv.time}</span> <span class="conversation-time">${conv.time}</span>
</div> </div>
@@ -389,4 +425,14 @@ export class SioConversationSelector extends DeesElement {
composed: true composed: true
})); }));
} }
private getBadgeLabel(status: TConversationStatus): string {
const labels: Record<TConversationStatus, string> = {
'new': 'New',
'waiting': 'Waiting',
'needs-action': 'Action',
'resolved': 'Resolved',
};
return labels[status];
}
} }