It does look nice, but that's not a React app
Browse filesFiles changed (2)
- README.md+9-5
- index.html+448-19
12345678910---title: Undefinedemoji: 🏃colorFrom: greencolorTo: yellowsdk: staticpinned: false---Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference1234567891011121314---title: undefinedcolorFrom: yellowcolorTo: grayemoji: 🐳sdk: staticpinned: falsetags:- deepsite-v3---# Welcome to your new DeepSite project!This project was created with [DeepSite](https://deepsite.hf.co).
12345678910111213141516171819<!doctype html><html><head><meta charset="utf-8" /><meta name="viewport" content="width=device-width" /><title>My static Space</title><link rel="stylesheet" href="style.css" /></head><body><div class="card"><h1>Welcome to your static Space!</h1><p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p><p>Also don't forget to check the<a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.</p></div></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>IncidentNinja React Edition</title><script src="https://cdn.tailwindcss.com"></script></head><body><div id="root"></div><script src="https://unpkg.com/react@18/umd/react.development.js"></script><script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script><script src="https://unpkg.com/@babel/standalone/babel.min.js"></script><script src="https://unpkg.com/feather-icons"></script><script src="https://cdn.jsdelivr.net/npm/vanta@latest/dist/vanta.net.min.js"></script><script type="text/babel">const { useState, useEffect } = React;const IncidentNinja = () => {const [incidents, setIncidents] = useState([]);const [filteredIncidents, setFilteredIncidents] = useState([]);const [loading, setLoading] = useState(true);const [searchTerm, setSearchTerm] = useState('');const [priorityFilter, setPriorityFilter] = useState('all');const [statusFilter, setStatusFilter] = useState('all');const [currentPage, setCurrentPage] = useState(1);const [selectedIncident, setSelectedIncident] = useState(null);const [showModal, setShowModal] = useState(false);const [stats, setStats] = useState({total: 0,highPriority: 0,inProgress: 0,resolved: 0});// Mock data fetchuseEffect(() => {const fetchData = () => {setLoading(true);setTimeout(() => {const mockData = Array.from({ length: 15 }, (_, i) => ({id: `mock-id-${i}`,number: `INC${100000 + i}`,short_description: `Issue with ${['server', 'database', 'application', 'network', 'printer'][i % 5]}`,description: `Detailed description of issue with ${['server', 'database', 'application', 'network', 'printer'][i % 5]}.`,priority: [1, 2, 3][i % 3],state: ['New', 'In Progress', 'Resolved', 'Closed'][i % 4],created: new Date(Date.now() - (i * 3600000)).toISOString(),updated: new Date(Date.now() - (i * 1800000)).toISOString(),work_notes: i % 2 === 0 ? 'Working on the issue.' : 'Investigating further.'}));setIncidents(mockData);setLoading(false);}, 1000);};fetchData();}, []);// Filter and pagination logicuseEffect(() => {const filtered = incidents.filter(incident => {const matchesSearch = incident.short_description.toLowerCase().includes(searchTerm.toLowerCase()) ||incident.number.toLowerCase().includes(searchTerm.toLowerCase());const matchesPriority = priorityFilter === 'all' || incident.priority == priorityFilter;const matchesStatus = statusFilter === 'all' || incident.state === statusFilter;return matchesSearch && matchesPriority && matchesStatus;});setFilteredIncidents(filtered);// Update statssetStats({total: incidents.length,highPriority: incidents.filter(i => i.priority === 1).length,inProgress: incidents.filter(i => i.state === 'In Progress').length,resolved: incidents.filter(i => i.state === 'Resolved' || i.state === 'Closed').length});}, [incidents, searchTerm, priorityFilter, statusFilter]);// Vanta.js background effectuseEffect(() => {VANTA.NET({el: "#vanta-bg",color: 0x6366f1,backgroundColor: 0xf8fafc,points: 12,maxDistance: 22,spacing: 18});}, []);const refreshIcons = () => {if (window.feather) {window.feather.replace();}};useEffect(() => {refreshIcons();}, [filteredIncidents, showModal]);const handleIncidentClick = (incident) => {setSelectedIncident(incident);setShowModal(true);};const handleResolve = () => {if (selectedIncident) {const updatedIncidents = incidents.map(inc =>inc.id === selectedIncident.id ? {...inc, state: 'Resolved'} : inc);setIncidents(updatedIncidents);setShowModal(false);}};const IncidentCard = ({ incident }) => (<divclassName={`incident-card bg-white rounded-lg shadow p-4 cursor-pointer hover:shadow-md transition-shadow duration-200 border-l-4 ${getPriorityBorderClass(incident.priority)}`}onClick={() => handleIncidentClick(incident)}><div className="flex justify-between items-start"><div><h3 className="font-medium text-gray-900">{incident.number}</h3><p className="text-sm text-gray-500 mt-1">{incident.short_description}</p></div><span className={`px-2 py-1 text-xs rounded-full ${getPriorityBadgeClass(incident.priority)}`}>{getPriorityText(incident.priority)}</span></div><div className="mt-4 flex items-center justify-between"><span className={`text-sm ${getStatusColorClass(incident.state)}`}><i data-feather={getStatusIcon(incident.state)} className="w-3 h-3 inline mr-1"></i>{incident.state}</span><span className="text-xs text-gray-500">{formatDate(incident.created)}</span></div></div>);const StatsCard = ({ title, value, icon, color }) => (<div className="bg-white rounded-lg shadow p-4"><div className="flex justify-between items-center"><div><p className="text-sm text-gray-500">{title}</p><h3 className="text-2xl font-bold text-gray-800">{value}</h3></div><div className={`p-3 rounded-full ${color.bg} ${color.text}`}><i data-feather={icon} className="w-5 h-5"></i></div></div></div>);return (<div className="relative min-h-screen"><div id="vanta-bg" className="fixed inset-0 z-0"></div><div className="relative z-10">{/* Header */}<header className="bg-white/80 backdrop-blur-md shadow-sm"><div className="max-w-7xl mx-auto px-4 py-6 sm:px-6 lg:px-8 flex justify-between items-center"><div className="flex items-center space-x-2"><i data-feather="alert-triangle" className="text-indigo-600 w-8 h-8"></i><h1 className="text-2xl font-bold text-gray-800">Incident<span className="text-indigo-600">Ninja</span></h1></div><div className="flex items-center space-x-4"><buttonclassName="flex items-center space-x-1 text-indigo-600 hover:text-indigo-800"onClick={() => window.location.reload()}><i data-feather="refresh-cw" className="w-5 h-5"></i><span>Refresh</span></button><div className="relative"><inputtype="text"placeholder="Search incidents..."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"value={searchTerm}onChange={(e) => setSearchTerm(e.target.value)}/><i data-feather="search" className="absolute left-2 top-2.5 text-gray-400 w-4 h-4"></i></div></div></div></header>{/* Main Content */}<main className="max-w-7xl mx-auto px-4 py-8 sm:px-6 lg:px-8"><div className="flex justify-between items-center mb-8"><h2 className="text-xl font-semibold text-gray-800">Recent Incidents</h2><div className="flex space-x-2"><div className="relative"><selectclassName="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"value={priorityFilter}onChange={(e) => setPriorityFilter(e.target.value)}><option value="all">All Priorities</option><option value="1">High</option><option value="2">Medium</option><option value="3">Low</option></select><i data-feather="chevron-down" className="absolute right-3 top-2.5 text-gray-500 w-4 h-4 pointer-events-none"></i></div><div className="relative"><selectclassName="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"value={statusFilter}onChange={(e) => setStatusFilter(e.target.value)}><option value="all">All Statuses</option><option value="New">New</option><option value="In Progress">In Progress</option><option value="Resolved">Resolved</option><option value="Closed">Closed</option></select><i data-feather="chevron-down" className="absolute right-3 top-2.5 text-gray-500 w-4 h-4 pointer-events-none"></i></div></div></div>{/* Stats Cards */}<div className="grid grid-cols-1 md:grid-cols-4 gap-4 mb-8"><StatsCardtitle="Total Incidents"value={stats.total}icon="alert-circle"color={{ bg: 'bg-indigo-100', text: 'text-indigo-600' }}/><StatsCardtitle="High Priority"value={stats.highPriority}icon="alert-octagon"color={{ bg: 'bg-red-100', text: 'text-red-600' }}/><StatsCardtitle="In Progress"value={stats.inProgress}icon="clock"color={{ bg: 'bg-yellow-100', text: 'text-yellow-600' }}/><StatsCardtitle="Resolved"value={stats.resolved}icon="check-circle"color={{ bg: 'bg-green-100', text: 'text-green-600' }}/></div>{/* Loading State */}{loading && (<div className="flex flex-col items-center justify-center py-12"><div className="animate-spin border-4 border-indigo-500 border-t-transparent rounded-full w-12 h-12 mb-4"></div><p className="text-gray-600">Fetching incidents from ServiceNow...</p></div>)}{/* Incidents List */}{!loading && (<div className="grid grid-cols-1 gap-4">{filteredIncidents.length > 0 ? (filteredIncidents.map(incident => (<IncidentCard key={incident.id} incident={incident} />))) : (<div className="flex flex-col items-center justify-center py-12"><i data-feather="alert-circle" className="w-16 h-16 text-gray-400 mb-4"></i><h3 className="text-lg font-medium text-gray-700 mb-2">No incidents found</h3><p className="text-gray-500 text-center max-w-md">There are currently no incidents matching your criteria. Try adjusting your filters.</p></div>)}</div>)}</main></div>{/* Incident Details Modal */}{showModal && selectedIncident && (<div className="fixed inset-0 z-50 overflow-y-auto"><div className="flex items-center justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0"><div className="fixed inset-0 transition-opacity" aria-hidden="true"><div className="absolute inset-0 bg-gray-500 opacity-75"></div></div><span className="hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden="true">​</span><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"><div className="bg-white px-4 pt-5 pb-4 sm:p-6 sm:pb-4"><div className="flex justify-between items-start"><div><h3 className="text-lg leading-6 font-medium text-gray-900">{selectedIncident.number}: {selectedIncident.short_description}</h3><div className="mt-1 text-sm text-gray-500">Created {formatDate(selectedIncident.created)}</div></div><buttonclassName="text-gray-400 hover:text-gray-500"onClick={() => setShowModal(false)}><i data-feather="x" className="w-6 h-6"></i></button></div><div className="mt-6 grid grid-cols-1 gap-y-4 gap-x-4 sm:grid-cols-2"><div><label className="block text-sm font-medium text-gray-700">Priority</label><div className="mt-1 text-sm text-gray-900"><span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getPriorityBadgeClass(selectedIncident.priority)}`}>{getPriorityText(selectedIncident.priority)}</span></div></div><div><label className="block text-sm font-medium text-gray-700">State</label><div className="mt-1 text-sm text-gray-900"><span className={`inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium ${getStatusBadgeClass(selectedIncident.state)}`}>{selectedIncident.state}</span></div></div><div><label className="block text-sm font-medium text-gray-700">Created</label><div className="mt-1 text-sm text-gray-900">{formatDateTime(selectedIncident.created)}</div></div><div><label className="block text-sm font-medium text-gray-700">Updated</label><div className="mt-1 text-sm text-gray-900">{formatDateTime(selectedIncident.updated)}</div></div><div className="sm:col-span-2"><label className="block text-sm font-medium text-gray-700">Description</label><div className="mt-1 text-sm text-gray-900">{selectedIncident.description || 'No description provided'}</div></div><div className="sm:col-span-2"><label className="block text-sm font-medium text-gray-700">Work Notes</label><div className="mt-1 text-sm text-gray-900">{selectedIncident.work_notes || 'No work notes available'}</div></div></div></div><div className="bg-gray-50 px-4 py-3 sm:px-6 sm:flex sm:flex-row-reverse">{selectedIncident.state !== 'Resolved' && selectedIncident.state !== 'Closed' && (<buttontype="button"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"onClick={handleResolve}>Mark as Resolved</button>)}<buttontype="button"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"onClick={() => setShowModal(false)}>Close</button></div></div></div></div>)}</div>);};// Helper functionsfunction getPriorityText(priority) {switch(priority) {case 1: return 'High';case 2: return 'Medium';case 3: return 'Low';default: return 'Unknown';}}function getPriorityBorderClass(priority) {switch(priority) {case 1: return 'border-red-500';case 2: return 'border-yellow-500';case 3: return 'border-green-500';default: return 'border-gray-500';}}function getPriorityBadgeClass(priority) {switch(priority) {case 1: return 'bg-red-100 text-red-800';case 2: return 'bg-yellow-100 text-yellow-800';case 3: return 'bg-green-100 text-green-800';default: return 'bg-gray-100 text-gray-800';}}function getStatusColorClass(status) {switch(status) {case 'New': return 'text-blue-600';case 'In Progress': return 'text-yellow-600';case 'Resolved': return 'text-green-600';case 'Closed': return 'text-gray-600';default: return 'text-gray-600';}}function getStatusBadgeClass(status) {switch(status) {case 'New': return 'bg-blue-100 text-blue-800';case 'In Progress': return 'bg-yellow-100 text-yellow-800';case 'Resolved': return 'bg-green-100 text-green-800';case 'Closed': return 'bg-gray-100 text-gray-800';default: return 'bg-gray-100 text-gray-800';}}function getStatusIcon(status) {switch(status) {case 'New': return 'plus-circle';case 'In Progress': return 'clock';case 'Resolved': return 'check-circle';case 'Closed': return 'lock';default: return 'alert-circle';}}function formatDate(isoString) {const date = new Date(isoString);return date.toLocaleDateString();}function formatDateTime(isoString) {const date = new Date(isoString);return date.toLocaleString();}ReactDOM.render(<IncidentNinja />, document.getElementById('root'));</script></body></html>
README.md+9-5
index.html+448-19