Files
Alberto-Audrix 32a36cceff
CI / lint-and-test (push) Canceled after 0s
first commit
2026-07-28 08:55:05 +07:00

46 lines
1.8 KiB
TypeScript

import React from 'react';
import { Alert, Screen } from '../../types.ts';
import { MobileBottomNav, severityMobileConfig } from './MobileLayout.tsx';
interface AlertListScreenProps {
alerts: Alert[];
onNavigate: (screen: Screen) => void;
onAlertClick: (alert: Alert) => void;
}
const AlertListScreen: React.FC<AlertListScreenProps> = ({ alerts, onNavigate, onAlertClick }) => (
<div className="bg-gray-50 h-full">
<div className="p-3 pt-8 h-full overflow-y-auto pb-16">
<div className="flex justify-between items-center">
<h1 className="text-xl font-bold text-gray-800">Notifikasi</h1>
<button className="text-gray-500">
<i className="fa-solid fa-filter"></i>
</button>
</div>
<div className="flex space-x-2 mt-3 text-xs">
<button className="bg-red-600 text-white px-3 py-1 rounded-full">Semua</button>
<button className="bg-gray-200 text-gray-700 px-3 py-1 rounded-full">Kritis</button>
<button className="bg-gray-200 text-gray-700 px-3 py-1 rounded-full">Peringatan</button>
</div>
<div className="space-y-3 mt-4">
{alerts.map((alert) => (
<button
key={alert.id}
onClick={() => onAlertClick(alert)}
className={`w-full p-3 rounded-lg flex items-start space-x-3 border-l-4 ${severityMobileConfig[alert.severity].border} bg-white shadow-sm text-left`}
>
<div className="text-2xl mt-1">{severityMobileConfig[alert.severity].icon}</div>
<div>
<p className="font-semibold text-sm leading-tight">{alert.message}</p>
<p className="text-xs text-gray-500 mt-1">{alert.timestamp}</p>
</div>
</button>
))}
</div>
</div>
<MobileBottomNav active="alerts" onNavigate={onNavigate} />
</div>
);
export default AlertListScreen;