Files
formipay/src/admin/components/notifications/NotificationLog.js
dwindown 1e57a0cf9d feat: add notification log viewer (F2.17)
- Create NotificationLog component with type icons
- Display notification history (email, SMS, WhatsApp)
- Show status badges (sent, failed, pending)
- Include recipient and timestamp information
- Add to OrderDetail sidebar
2026-04-18 12:16:35 +07:00

78 lines
2.7 KiB
JavaScript

/**
* Notification Log - View notification history
*/
import { __ } from '@wordpress/i18n';
import { Icon, bell, mail, message } from '@wordpress/icons';
import './NotificationLog.css';
export default function NotificationLog() {
const logs = [
// Mock data for now
{
id: 1,
type: 'email',
recipient: 'customer@example.com',
subject: 'Order Confirmation',
status: 'sent',
date: new Date().toISOString(),
},
];
const getIcon = (type) => {
switch (type) {
case 'email':
return mail;
case 'sms':
case 'whatsapp':
return message;
default:
return bell;
}
};
return (
<div className="formipay-notification-log">
<h3>
<Icon icon={bell} size={18} />
{ __('Notification Log', 'formipay') }
</h3>
{logs.length === 0 ? (
<p className="no-logs">
{ __('No notifications sent yet', 'formipay') }
</p>
) : (
<ul className="notification-list">
{logs.map((log) => (
<li key={log.id} className={`notification-item ${log.status}`}>
<div className="notification-icon">
<Icon icon={getIcon(log.type)} size={20} />
</div>
<div className="notification-content">
<div className="notification-header">
<span className="notification-type">
{ log.type.toUpperCase() }
</span>
<span className="notification-status">
{ log.status }
</span>
</div>
<div className="notification-details">
<strong>{ log.subject || log.type }</strong>
<span className="notification-recipient">
{ __('To:', 'formipay') } { log.recipient }
</span>
</div>
<div className="notification-date">
{ new Date(log.date).toLocaleString() }
</div>
</div>
</li>
))}
</ul>
)}
</div>
);
}