It does look nice, but that's not a React app
Browse files- README.md +9 -5
- index.html +448 -19
README.md
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
title: undefined
|
| 3 |
+
colorFrom: yellow
|
| 4 |
+
colorTo: gray
|
| 5 |
+
emoji: 🐳
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite-v3
|
| 10 |
---
|
| 11 |
|
| 12 |
+
# Welcome to your new DeepSite project!
|
| 13 |
+
This project was created with [DeepSite](https://deepsite.hf.co).
|
| 14 |
+
|
index.html
CHANGED
|
@@ -1,19 +1,448 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>IncidentNinja React Edition</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
</head>
|
| 9 |
+
<body>
|
| 10 |
+
<div id="root"></div>
|
| 11 |
+
<script src="https://unpkg.com/react@18/umd/react.development.js"></script>
|
| 12 |
+
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script>
|
| 13 |
+
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
|
| 14 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 15 |
+
<script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script>
|
| 16 |
+
<script type="text/babel">
|
| 17 |
+
const { useState, useEffect } = React;
|
| 18 |
+
|
| 19 |
+
const IncidentNinja = () => {
|
| 20 |
+
const [incidents, setIncidents] = useState([]);
|
| 21 |
+
const [filteredIncidents, setFilteredIncidents] = useState([]);
|
| 22 |
+
const [loading, setLoading] = useState(true);
|
| 23 |
+
const [searchTerm, setSearchTerm] = useState('');
|
| 24 |
+
const [priorityFilter, setPriorityFilter] = useState('all');
|
| 25 |
+
const [statusFilter, setStatusFilter] = useState('all');
|
| 26 |
+
const [currentPage, setCurrentPage] = useState(1);
|
| 27 |
+
const [selectedIncident, setSelectedIncident] = useState(null);
|
| 28 |
+
const [showModal, setShowModal] = useState(false);
|
| 29 |
+
const [stats, setStats] = useState({
|
| 30 |
+
total: 0,
|
| 31 |
+
highPriority: 0,
|
| 32 |
+
inProgress: 0,
|
| 33 |
+
resolved: 0
|
| 34 |
+
});
|
| 35 |
+
|
| 36 |
+
// Mock data fetch
|
| 37 |
+
useEffect(() => {
|
| 38 |
+
const fetchData = () => {
|
| 39 |
+
setLoading(true);
|
| 40 |
+
setTimeout(() => {
|
| 41 |
+
const mockData = Array.from({ length: 15 }, (_, i) => ({
|
| 42 |
+
id: `mock-id-${i}`,
|
| 43 |
+
number: `INC${100000 + i}`,
|
| 44 |
+
short_description: `Issue with ${['server', 'database', 'application', 'network', 'printer'][i % 5]}`,
|
| 45 |
+
description: `Detailed description of issue with ${['server', 'database', 'application', 'network', 'printer'][i % 5]}.`,
|
| 46 |
+
priority: [1, 2, 3][i % 3],
|
| 47 |
+
state: ['New', 'In Progress', 'Resolved', 'Closed'][i % 4],
|
| 48 |
+
created: new Date(Date.now() - (i * 3600000)).toISOString(),
|
| 49 |
+
updated: new Date(Date.now() - (i * 1800000)).toISOString(),
|
| 50 |
+
work_notes: i % 2 === 0 ? 'Working on the issue.' : 'Investigating further.'
|
| 51 |
+
}));
|
| 52 |
+
|
| 53 |
+
setIncidents(mockData);
|
| 54 |
+
setLoading(false);
|
| 55 |
+
}, 1000);
|
| 56 |
+
};
|
| 57 |
+
|
| 58 |
+
fetchData();
|
| 59 |
+
}, []);
|
| 60 |
+
|
| 61 |
+
// Filter and pagination logic
|
| 62 |
+
useEffect(() => {
|
| 63 |
+
const filtered = incidents.filter(incident => {
|
| 64 |
+
const matchesSearch = incident.short_description.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
| 65 |
+
incident.number.toLowerCase().includes(searchTerm.toLowerCase());
|
| 66 |
+
const matchesPriority = priorityFilter === 'all' || incident.priority == priorityFilter;
|
| 67 |
+
const matchesStatus = statusFilter === 'all' || incident.state === statusFilter;
|
| 68 |
+
return matchesSearch && matchesPriority && matchesStatus;
|
| 69 |
+
});
|
| 70 |
+
|
| 71 |
+
setFilteredIncidents(filtered);
|
| 72 |
+
|
| 73 |
+
// Update stats
|
| 74 |
+
setStats({
|
| 75 |
+
total: incidents.length,
|
| 76 |
+
highPriority: incidents.filter(i => i.priority === 1).length,
|
| 77 |
+
inProgress: incidents.filter(i => i.state === 'In Progress').length,
|
| 78 |
+
resolved: incidents.filter(i => i.state === 'Resolved' || i.state === 'Closed').length
|
| 79 |
+
});
|
| 80 |
+
}, [incidents, searchTerm, priorityFilter, statusFilter]);
|
| 81 |
+
|
| 82 |
+
// Vanta.js background effect
|
| 83 |
+
useEffect(() => {
|
| 84 |
+
VANTA.NET({
|
| 85 |
+
el: "#vanta-bg",
|
| 86 |
+
color: 0x6366f1,
|
| 87 |
+
backgroundColor: 0xf8fafc,
|
| 88 |
+
points: 12,
|
| 89 |
+
maxDistance: 22,
|
| 90 |
+
spacing: 18
|
| 91 |
+
});
|
| 92 |
+
}, []);
|
| 93 |
+
|
| 94 |
+
const refreshIcons = () => {
|
| 95 |
+
if (window.feather) {
|
| 96 |
+
window.feather.replace();
|
| 97 |
+
}
|
| 98 |
+
};
|
| 99 |
+
|
| 100 |
+
useEffect(() => {
|
| 101 |
+
refreshIcons();
|
| 102 |
+
}, [filteredIncidents, showModal]);
|
| 103 |
+
|
| 104 |
+
const handleIncidentClick = (incident) => {
|
| 105 |
+
setSelectedIncident(incident);
|
| 106 |
+
setShowModal(true);
|
| 107 |
+
};
|
| 108 |
+
|
| 109 |
+
const handleResolve = () => {
|
| 110 |
+
if (selectedIncident) {
|
| 111 |
+
const updatedIncidents = incidents.map(inc =>
|
| 112 |
+
inc.id === selectedIncident.id ? {...inc, state: 'Resolved'} : inc
|
| 113 |
+
);
|
| 114 |
+
setIncidents(updatedIncidents);
|
| 115 |
+
setShowModal(false);
|
| 116 |
+
}
|
| 117 |
+
};
|
| 118 |
+
|
| 119 |
+
const IncidentCard = ({ incident }) => (
|
| 120 |
+
<div
|
| 121 |
+
className={`incident-card bg-white rounded-lg shadow p-4 cursor-pointer hover:shadow-md transition-shadow duration-200 border-l-4 ${getPriorityBorderClass(incident.priority)}`}
|
| 122 |
+
onClick={() => handleIncidentClick(incident)}
|
| 123 |
+
>
|
| 124 |
+
<div className="flex justify-between items-start">
|
| 125 |
+
<div>
|
| 126 |
+
<h3 className="font-medium text-gray-900">{incident.number}</h3>
|
| 127 |
+
<p className="text-sm text-gray-500 mt-1">{incident.short_description}</p>
|
| 128 |
+
</div>
|
| 129 |
+
<span className={`px-2 py-1 text-xs rounded-full ${getPriorityBadgeClass(incident.priority)}`}>
|
| 130 |
+
{getPriorityText(incident.priority)}
|
| 131 |
+
</span>
|
| 132 |
+
</div>
|
| 133 |
+
<div className="mt-4 flex items-center justify-between">
|
| 134 |
+
<span className={`text-sm ${getStatusColorClass(incident.state)}`}>
|
| 135 |
+
<i data-feather={getStatusIcon(incident.state)} className="w-3 h-3 inline mr-1"></i>
|
| 136 |
+
{incident.state}
|
| 137 |
+
</span>
|
| 138 |
+
<span className="text-xs text-gray-500">{formatDate(incident.created)}</span>
|
| 139 |
+
</div>
|
| 140 |
+
</div>
|
| 141 |
+
);
|
| 142 |
+
|
| 143 |
+
const StatsCard = ({ title, value, icon, color }) => (
|
| 144 |
+
<div className="bg-white rounded-lg shadow p-4">
|
| 145 |
+
<div className="flex justify-between items-center">
|
| 146 |
+
<div>
|
| 147 |
+
<p className="text-sm text-gray-500">{title}</p>
|
| 148 |
+
<h3 className="text-2xl font-bold text-gray-800">{value}</h3>
|
| 149 |
+
</div>
|
| 150 |
+
<div className={`p-3 rounded-full ${color.bg} ${color.text}`}>
|
| 151 |
+
<i data-feather={icon} className="w-5 h-5"></i>
|
| 152 |
+
</div>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
);
|
| 156 |
+
|
| 157 |
+
return (
|
| 158 |
+
<div className="relative min-h-screen">
|
| 159 |
+
<div id="vanta-bg" className="fixed inset-0 z-0"></div>
|
| 160 |
+
<div className="relative z-10">
|
| 161 |
+
{/* Header */}
|
| 162 |
+
<header className="bg-white/80 backdrop-blur-md shadow-sm">
|
| 163 |
+
<div className="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8 flex justify-between items-center">
|
| 164 |
+
<div className="flex items-center space-x-2">
|
| 165 |
+
<i data-feather="alert-triangle" className="text-indigo-600 w-8 h-8"></i>
|
| 166 |
+
<h1 className="text-2xl font-bold text-gray-800">Incident<span className="text-indigo-600">Ninja</span></h1>
|
| 167 |
+
</div>
|
| 168 |
+
<div className="flex items-center space-x-4">
|
| 169 |
+
<button
|
| 170 |
+
className="flex items-center space-x-1 text-indigo-600 hover:text-indigo-800"
|
| 171 |
+
onClick={() => window.location.reload()}
|
| 172 |
+
>
|
| 173 |
+
<i data-feather="refresh-cw" className="w-5 h-5"></i>
|
| 174 |
+
<span>Refresh</span>
|
| 175 |
+
</button>
|
| 176 |
+
<div className="relative">
|
| 177 |
+
<input
|
| 178 |
+
type="text"
|
| 179 |
+
placeholder="Search incidents..."
|
| 180 |
+
className="pl-8 pr-4 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500"
|
| 181 |
+
value={searchTerm}
|
| 182 |
+
onChange={(e) => setSearchTerm(e.target.value)}
|
| 183 |
+
/>
|
| 184 |
+
<i data-feather="search" className="absolute left-2 top-2.5 text-gray-400 w-4 h-4"></i>
|
| 185 |
+
</div>
|
| 186 |
+
</div>
|
| 187 |
+
</div>
|
| 188 |
+
</header>
|
| 189 |
+
|
| 190 |
+
{/* Main Content */}
|
| 191 |
+
<main className="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8">
|
| 192 |
+
<div className="flex justify-between items-center mb-8">
|
| 193 |
+
<h2 className="text-xl font-semibold text-gray-800">Recent Incidents</h2>
|
| 194 |
+
<div className="flex space-x-2">
|
| 195 |
+
<div className="relative">
|
| 196 |
+
<select
|
| 197 |
+
className="appearance-none pl-3 pr-8 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white"
|
| 198 |
+
value={priorityFilter}
|
| 199 |
+
onChange={(e) => setPriorityFilter(e.target.value)}
|
| 200 |
+
>
|
| 201 |
+
<option value="all">All Priorities</option>
|
| 202 |
+
<option value="1">High</option>
|
| 203 |
+
<option value="2">Medium</option>
|
| 204 |
+
<option value="3">Low</option>
|
| 205 |
+
</select>
|
| 206 |
+
<i data-feather="chevron-down" className="absolute right-3 top-2.5 text-gray-500 w-4 h-4 pointer-events-none"></i>
|
| 207 |
+
</div>
|
| 208 |
+
<div className="relative">
|
| 209 |
+
<select
|
| 210 |
+
className="appearance-none pl-3 pr-8 py-2 rounded-lg border border-gray-300 focus:outline-none focus:ring-2 focus:ring-indigo-500 focus:border-indigo-500 bg-white"
|
| 211 |
+
value={statusFilter}
|
| 212 |
+
onChange={(e) => setStatusFilter(e.target.value)}
|
| 213 |
+
>
|
| 214 |
+
<option value="all">All Statuses</option>
|
| 215 |
+
<option value="New">New</option>
|
| 216 |
+
<option value="In Progress">In Progress</option>
|
| 217 |
+
<option value="Resolved">Resolved</option>
|
| 218 |
+
<option value="Closed">Closed</option>
|
| 219 |
+
</select>
|
| 220 |
+
<i data-feather="chevron-down" className="absolute right-3 top-2.5 text-gray-500 w-4 h-4 pointer-events-none"></i>
|
| 221 |
+
</div>
|
| 222 |
+
</div>
|
| 223 |
+
</div>
|
| 224 |
+
|
| 225 |
+
{/* Stats Cards */}
|
| 226 |
+
<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8">
|
| 227 |
+
<StatsCard
|
| 228 |
+
title="Total Incidents"
|
| 229 |
+
value={stats.total}
|
| 230 |
+
icon="alert-circle"
|
| 231 |
+
color={{ bg: 'bg-indigo-100', text: 'text-indigo-600' }}
|
| 232 |
+
/>
|
| 233 |
+
<StatsCard
|
| 234 |
+
title="High Priority"
|
| 235 |
+
value={stats.highPriority}
|
| 236 |
+
icon="alert-octagon"
|
| 237 |
+
color={{ bg: 'bg-red-100', text: 'text-red-600' }}
|
| 238 |
+
/>
|
| 239 |
+
<StatsCard
|
| 240 |
+
title="In Progress"
|
| 241 |
+
value={stats.inProgress}
|
| 242 |
+
icon="clock"
|
| 243 |
+
color={{ bg: 'bg-yellow-100', text: 'text-yellow-600' }}
|
| 244 |
+
/>
|
| 245 |
+
<StatsCard
|
| 246 |
+
title="Resolved"
|
| 247 |
+
value={stats.resolved}
|
| 248 |
+
icon="check-circle"
|
| 249 |
+
color={{ bg: 'bg-green-100', text: 'text-green-600' }}
|
| 250 |
+
/>
|
| 251 |
+
</div>
|
| 252 |
+
|
| 253 |
+
{/* Loading State */}
|
| 254 |
+
{loading && (
|
| 255 |
+
<div className="flex flex-col items-center justify-center py-12">
|
| 256 |
+
<div className="animate-spin border-4 border-indigo-500 border-t-transparent rounded-full w-12 h-12 mb-4"></div>
|
| 257 |
+
<p className="text-gray-600">Fetching incidents from ServiceNow...</p>
|
| 258 |
+
</div>
|
| 259 |
+
)}
|
| 260 |
+
|
| 261 |
+
{/* Incidents List */}
|
| 262 |
+
{!loading && (
|
| 263 |
+
<div className="grid grid-cols-1 gap-4">
|
| 264 |
+
{filteredIncidents.length > 0 ? (
|
| 265 |
+
filteredIncidents.map(incident => (
|
| 266 |
+
<IncidentCard key={incident.id} incident={incident} />
|
| 267 |
+
))
|
| 268 |
+
) : (
|
| 269 |
+
<div className="flex flex-col items-center justify-center py-12">
|
| 270 |
+
<i data-feather="alert-circle" className="w-16 h-16 text-gray-400 mb-4"></i>
|
| 271 |
+
<h3 className="text-lg font-medium text-gray-700 mb-2">No incidents found</h3>
|
| 272 |
+
<p className="text-gray-500 text-center max-w-md">
|
| 273 |
+
There are currently no incidents matching your criteria. Try adjusting your filters.
|
| 274 |
+
</p>
|
| 275 |
+
</div>
|
| 276 |
+
)}
|
| 277 |
+
</div>
|
| 278 |
+
)}
|
| 279 |
+
</main>
|
| 280 |
+
</div>
|
| 281 |
+
|
| 282 |
+
{/* Incident Details Modal */}
|
| 283 |
+
{showModal && selectedIncident && (
|
| 284 |
+
<div className="fixed inset-0 z-50 overflow-y-auto">
|
| 285 |
+
<div className="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
|
| 286 |
+
<div className="fixed inset-0 transition-opacity" aria-hidden="true">
|
| 287 |
+
<div className="absolute inset-0 bg-gray-500 opacity-75"></div>
|
| 288 |
+
</div>
|
| 289 |
+
<span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span>
|
| 290 |
+
<div className="inline-block align-bottom bg-white rounded-lg text-left overflow-hidden shadow-xl transform transition-all sm:my-8 sm:align-middle sm:max-w-2xl sm:w-full">
|
| 291 |
+
<div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4">
|
| 292 |
+
<div className="flex justify-between items-start">
|
| 293 |
+
<div>
|
| 294 |
+
<h3 className="text-lg leading-6 font-medium text-gray-900">
|
| 295 |
+
{selectedIncident.number}: {selectedIncident.short_description}
|
| 296 |
+
</h3>
|
| 297 |
+
<div className="mt-1 text-sm text-gray-500">
|
| 298 |
+
Created {formatDate(selectedIncident.created)}
|
| 299 |
+
</div>
|
| 300 |
+
</div>
|
| 301 |
+
<button
|
| 302 |
+
className="text-gray-400 hover:text-gray-500"
|
| 303 |
+
onClick={() => setShowModal(false)}
|
| 304 |
+
>
|
| 305 |
+
<i data-feather="x" className="w-6 h-6"></i>
|
| 306 |
+
</button>
|
| 307 |
+
</div>
|
| 308 |
+
<div className="mt-6 grid grid-cols-1 gap-y-4 gap-x-4 sm:grid-cols-2">
|
| 309 |
+
<div>
|
| 310 |
+
<label className="block text-sm font-medium text-gray-700">Priority</label>
|
| 311 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 312 |
+
<span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getPriorityBadgeClass(selectedIncident.priority)}`}>
|
| 313 |
+
{getPriorityText(selectedIncident.priority)}
|
| 314 |
+
</span>
|
| 315 |
+
</div>
|
| 316 |
+
</div>
|
| 317 |
+
<div>
|
| 318 |
+
<label className="block text-sm font-medium text-gray-700">State</label>
|
| 319 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 320 |
+
<span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusBadgeClass(selectedIncident.state)}`}>
|
| 321 |
+
{selectedIncident.state}
|
| 322 |
+
</span>
|
| 323 |
+
</div>
|
| 324 |
+
</div>
|
| 325 |
+
<div>
|
| 326 |
+
<label className="block text-sm font-medium text-gray-700">Created</label>
|
| 327 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 328 |
+
{formatDateTime(selectedIncident.created)}
|
| 329 |
+
</div>
|
| 330 |
+
</div>
|
| 331 |
+
<div>
|
| 332 |
+
<label className="block text-sm font-medium text-gray-700">Updated</label>
|
| 333 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 334 |
+
{formatDateTime(selectedIncident.updated)}
|
| 335 |
+
</div>
|
| 336 |
+
</div>
|
| 337 |
+
<div className="sm:col-span-2">
|
| 338 |
+
<label className="block text-sm font-medium text-gray-700">Description</label>
|
| 339 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 340 |
+
{selectedIncident.description || 'No description provided'}
|
| 341 |
+
</div>
|
| 342 |
+
</div>
|
| 343 |
+
<div className="sm:col-span-2">
|
| 344 |
+
<label className="block text-sm font-medium text-gray-700">Work Notes</label>
|
| 345 |
+
<div className="mt-1 text-sm text-gray-900">
|
| 346 |
+
{selectedIncident.work_notes || 'No work notes available'}
|
| 347 |
+
</div>
|
| 348 |
+
</div>
|
| 349 |
+
</div>
|
| 350 |
+
</div>
|
| 351 |
+
<div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">
|
| 352 |
+
{selectedIncident.state !== 'Resolved' && selectedIncident.state !== 'Closed' && (
|
| 353 |
+
<button
|
| 354 |
+
type="button"
|
| 355 |
+
className="w-full inline-flex justify-center rounded-md border border-transparent shadow-sm px-4 py-2 bg-indigo-600 text-base font-medium text-white hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:ml-3 sm:w-auto sm:text-sm"
|
| 356 |
+
onClick={handleResolve}
|
| 357 |
+
>
|
| 358 |
+
Mark as Resolved
|
| 359 |
+
</button>
|
| 360 |
+
)}
|
| 361 |
+
<button
|
| 362 |
+
type="button"
|
| 363 |
+
className="mt-3 w-full inline-flex justify-center rounded-md border border-gray-300 shadow-sm px-4 py-2 bg-white text-base font-medium text-gray-700 hover:bg-gray-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 sm:mt-0 sm:ml-3 sm:w-auto sm:text-sm"
|
| 364 |
+
onClick={() => setShowModal(false)}
|
| 365 |
+
>
|
| 366 |
+
Close
|
| 367 |
+
</button>
|
| 368 |
+
</div>
|
| 369 |
+
</div>
|
| 370 |
+
</div>
|
| 371 |
+
</div>
|
| 372 |
+
)}
|
| 373 |
+
</div>
|
| 374 |
+
);
|
| 375 |
+
};
|
| 376 |
+
|
| 377 |
+
// Helper functions
|
| 378 |
+
function getPriorityText(priority) {
|
| 379 |
+
switch(priority) {
|
| 380 |
+
case 1: return 'High';
|
| 381 |
+
case 2: return 'Medium';
|
| 382 |
+
case 3: return 'Low';
|
| 383 |
+
default: return 'Unknown';
|
| 384 |
+
}
|
| 385 |
+
}
|
| 386 |
+
|
| 387 |
+
function getPriorityBorderClass(priority) {
|
| 388 |
+
switch(priority) {
|
| 389 |
+
case 1: return 'border-red-500';
|
| 390 |
+
case 2: return 'border-yellow-500';
|
| 391 |
+
case 3: return 'border-green-500';
|
| 392 |
+
default: return 'border-gray-500';
|
| 393 |
+
}
|
| 394 |
+
}
|
| 395 |
+
|
| 396 |
+
function getPriorityBadgeClass(priority) {
|
| 397 |
+
switch(priority) {
|
| 398 |
+
case 1: return 'bg-red-100 text-red-800';
|
| 399 |
+
case 2: return 'bg-yellow-100 text-yellow-800';
|
| 400 |
+
case 3: return 'bg-green-100 text-green-800';
|
| 401 |
+
default: return 'bg-gray-100 text-gray-800';
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
|
| 405 |
+
function getStatusColorClass(status) {
|
| 406 |
+
switch(status) {
|
| 407 |
+
case 'New': return 'text-blue-600';
|
| 408 |
+
case 'In Progress': return 'text-yellow-600';
|
| 409 |
+
case 'Resolved': return 'text-green-600';
|
| 410 |
+
case 'Closed': return 'text-gray-600';
|
| 411 |
+
default: return 'text-gray-600';
|
| 412 |
+
}
|
| 413 |
+
}
|
| 414 |
+
|
| 415 |
+
function getStatusBadgeClass(status) {
|
| 416 |
+
switch(status) {
|
| 417 |
+
case 'New': return 'bg-blue-100 text-blue-800';
|
| 418 |
+
case 'In Progress': return 'bg-yellow-100 text-yellow-800';
|
| 419 |
+
case 'Resolved': return 'bg-green-100 text-green-800';
|
| 420 |
+
case 'Closed': return 'bg-gray-100 text-gray-800';
|
| 421 |
+
default: return 'bg-gray-100 text-gray-800';
|
| 422 |
+
}
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
function getStatusIcon(status) {
|
| 426 |
+
switch(status) {
|
| 427 |
+
case 'New': return 'plus-circle';
|
| 428 |
+
case 'In Progress': return 'clock';
|
| 429 |
+
case 'Resolved': return 'check-circle';
|
| 430 |
+
case 'Closed': return 'lock';
|
| 431 |
+
default: return 'alert-circle';
|
| 432 |
+
}
|
| 433 |
+
}
|
| 434 |
+
|
| 435 |
+
function formatDate(isoString) {
|
| 436 |
+
const date = new Date(isoString);
|
| 437 |
+
return date.toLocaleDateString();
|
| 438 |
+
}
|
| 439 |
+
|
| 440 |
+
function formatDateTime(isoString) {
|
| 441 |
+
const date = new Date(isoString);
|
| 442 |
+
return date.toLocaleString();
|
| 443 |
+
}
|
| 444 |
+
|
| 445 |
+
ReactDOM.render(<IncidentNinja />, document.getElementById('root'));
|
| 446 |
+
</script>
|
| 447 |
+
</body>
|
| 448 |
+
</html>
|