Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
f2479fa
1
Parent(s): 041d536
backend stabilization
Browse files- api/v1/reports.py +106 -0
- frontend/apps/internal/src/components/AnalyticsDashboard.module.css +235 -441
- frontend/apps/internal/src/components/AnalyticsDashboard.tsx +189 -193
- frontend/apps/internal/src/components/TicketDetails.module.css +52 -5
- frontend/apps/internal/src/components/TicketDetails.tsx +536 -510
- frontend/packages/shared/src/hooks/useDashboard.ts +32 -4
api/v1/reports.py
CHANGED
|
@@ -376,3 +376,109 @@ async def get_daily_stats(
|
|
| 376 |
await set_cached_search(cache_key, buckets, ttl=300)
|
| 377 |
|
| 378 |
return buckets
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 376 |
await set_cached_search(cache_key, buckets, ttl=300)
|
| 377 |
|
| 378 |
return buckets
|
| 379 |
+
|
| 380 |
+
@router.get("/staff-performance/", dependencies=[Depends(require_roles(ALL_SC_ROLES))])
|
| 381 |
+
async def get_staff_performance(
|
| 382 |
+
workspace_id: str = None,
|
| 383 |
+
current_user: User = Depends(get_current_user),
|
| 384 |
+
db: AsyncSession = Depends(get_db)
|
| 385 |
+
) -> Any:
|
| 386 |
+
"""Get ticket resolution volume trend by staff member (last 30 days)."""
|
| 387 |
+
target_ws = current_user.workspace_id
|
| 388 |
+
if workspace_id and current_user.role == UserRole.SC_ADMIN:
|
| 389 |
+
from uuid import UUID
|
| 390 |
+
target_ws = UUID(workspace_id)
|
| 391 |
+
|
| 392 |
+
now = datetime.utcnow()
|
| 393 |
+
since_30d = now - timedelta(days=30)
|
| 394 |
+
|
| 395 |
+
# Group by date(resolved_at) and resolver name
|
| 396 |
+
stmt = (
|
| 397 |
+
select(
|
| 398 |
+
func.date(Ticket.resolved_at).label('day'),
|
| 399 |
+
User.full_name,
|
| 400 |
+
func.count(Ticket.id).label('count')
|
| 401 |
+
)
|
| 402 |
+
.join(User, Ticket.resolved_by == User.id)
|
| 403 |
+
.where(
|
| 404 |
+
Ticket.workspace_id == target_ws,
|
| 405 |
+
Ticket.resolved_at >= since_30d,
|
| 406 |
+
Ticket.deleted_at.is_(None)
|
| 407 |
+
)
|
| 408 |
+
.group_by(func.date(Ticket.resolved_at), User.full_name)
|
| 409 |
+
.order_by(func.date(Ticket.resolved_at))
|
| 410 |
+
)
|
| 411 |
+
result = await db.execute(stmt)
|
| 412 |
+
rows = result.all()
|
| 413 |
+
|
| 414 |
+
from collections import defaultdict
|
| 415 |
+
day_map = defaultdict(dict)
|
| 416 |
+
all_names = set()
|
| 417 |
+
|
| 418 |
+
for row in rows:
|
| 419 |
+
day_map[row.day][row.full_name] = row.count
|
| 420 |
+
all_names.add(row.full_name)
|
| 421 |
+
|
| 422 |
+
buckets = []
|
| 423 |
+
for i in range(30):
|
| 424 |
+
bucket_date = (now - timedelta(days=29 - i)).date()
|
| 425 |
+
buckets.append({
|
| 426 |
+
"label": bucket_date.strftime("%m-%d"),
|
| 427 |
+
"timestamp": bucket_date.isoformat(),
|
| 428 |
+
"performance": day_map.get(bucket_date, {})
|
| 429 |
+
})
|
| 430 |
+
|
| 431 |
+
return {"trend": buckets, "staff_names": list(all_names)}
|
| 432 |
+
|
| 433 |
+
@router.get("/escalation-trends/", dependencies=[Depends(require_roles(ALL_SC_ROLES))])
|
| 434 |
+
async def get_escalation_assignee_trends(
|
| 435 |
+
workspace_id: str = None,
|
| 436 |
+
current_user: User = Depends(get_current_user),
|
| 437 |
+
db: AsyncSession = Depends(get_db)
|
| 438 |
+
) -> Any:
|
| 439 |
+
"""Get escalation volume trend by current assignee (last 30 days)."""
|
| 440 |
+
target_ws = current_user.workspace_id
|
| 441 |
+
if workspace_id and current_user.role == UserRole.SC_ADMIN:
|
| 442 |
+
from uuid import UUID
|
| 443 |
+
target_ws = UUID(workspace_id)
|
| 444 |
+
|
| 445 |
+
now = datetime.utcnow()
|
| 446 |
+
since_30d = now - timedelta(days=30)
|
| 447 |
+
|
| 448 |
+
# Group by date(is_escalated) and assignee name
|
| 449 |
+
stmt = (
|
| 450 |
+
select(
|
| 451 |
+
func.date(Ticket.is_escalated).label('day'),
|
| 452 |
+
User.full_name,
|
| 453 |
+
func.count(Ticket.id).label('count')
|
| 454 |
+
)
|
| 455 |
+
.join(User, Ticket.assigned_to == User.id)
|
| 456 |
+
.where(
|
| 457 |
+
Ticket.workspace_id == target_ws,
|
| 458 |
+
Ticket.is_escalated >= since_30d,
|
| 459 |
+
Ticket.deleted_at.is_(None)
|
| 460 |
+
)
|
| 461 |
+
.group_by(func.date(Ticket.is_escalated), User.full_name)
|
| 462 |
+
.order_by(func.date(Ticket.is_escalated))
|
| 463 |
+
)
|
| 464 |
+
result = await db.execute(stmt)
|
| 465 |
+
rows = result.all()
|
| 466 |
+
|
| 467 |
+
from collections import defaultdict
|
| 468 |
+
day_map = defaultdict(dict)
|
| 469 |
+
all_names = set()
|
| 470 |
+
|
| 471 |
+
for row in rows:
|
| 472 |
+
day_map[row.day][row.full_name] = row.count
|
| 473 |
+
all_names.add(row.full_name)
|
| 474 |
+
|
| 475 |
+
buckets = []
|
| 476 |
+
for i in range(30):
|
| 477 |
+
bucket_date = (now - timedelta(days=29 - i)).date()
|
| 478 |
+
buckets.append({
|
| 479 |
+
"label": bucket_date.strftime("%m-%d"),
|
| 480 |
+
"timestamp": bucket_date.isoformat(),
|
| 481 |
+
"escalations": day_map.get(bucket_date, {})
|
| 482 |
+
})
|
| 483 |
+
|
| 484 |
+
return {"trend": buckets, "staff_names": list(all_names)}
|
frontend/apps/internal/src/components/AnalyticsDashboard.module.css
CHANGED
|
@@ -1,53 +1,59 @@
|
|
| 1 |
.container {
|
| 2 |
-
padding:
|
| 3 |
-
background-color: #
|
| 4 |
min-height: 100vh;
|
| 5 |
display: flex;
|
| 6 |
flex-direction: column;
|
| 7 |
gap: 32px;
|
| 8 |
-
animation: fadeIn 0.
|
| 9 |
}
|
| 10 |
|
| 11 |
@keyframes fadeIn {
|
| 12 |
-
from { opacity: 0; transform: translateY(
|
| 13 |
to { opacity: 1; transform: translateY(0); }
|
| 14 |
}
|
| 15 |
|
| 16 |
-
/* 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
.vitalsRow {
|
| 18 |
display: grid;
|
| 19 |
-
grid-template-columns: repeat(auto-fit, minmax(
|
| 20 |
-
gap:
|
| 21 |
}
|
| 22 |
|
| 23 |
.vitalCard {
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
border: 1px solid rgba(255, 255, 255, 0.5);
|
| 27 |
-
border-radius: 20px;
|
| 28 |
padding: 24px;
|
| 29 |
display: flex;
|
| 30 |
align-items: center;
|
| 31 |
gap: 20px;
|
| 32 |
-
transition: all 0.
|
| 33 |
-
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
|
| 34 |
}
|
| 35 |
|
| 36 |
.vitalCard:hover {
|
| 37 |
-
transform: translateY(-
|
| 38 |
background: white;
|
| 39 |
-
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
|
| 40 |
border-color: var(--primary);
|
|
|
|
| 41 |
}
|
| 42 |
|
| 43 |
.vitalIcon {
|
| 44 |
-
width:
|
| 45 |
-
height:
|
| 46 |
-
border-radius:
|
| 47 |
display: flex;
|
| 48 |
align-items: center;
|
| 49 |
justify-content: center;
|
| 50 |
-
font-size:
|
|
|
|
| 51 |
}
|
| 52 |
|
| 53 |
.vitalMeta {
|
|
@@ -60,14 +66,15 @@
|
|
| 60 |
font-weight: 800;
|
| 61 |
color: #64748B;
|
| 62 |
letter-spacing: 0.1em;
|
|
|
|
| 63 |
}
|
| 64 |
|
| 65 |
.vitalValue {
|
| 66 |
-
font-size:
|
| 67 |
font-weight: 900;
|
| 68 |
-
color: #
|
| 69 |
-
line-height: 1.
|
| 70 |
-
margin:
|
| 71 |
}
|
| 72 |
|
| 73 |
.vitalSub {
|
|
@@ -76,162 +83,91 @@
|
|
| 76 |
color: #94A3B8;
|
| 77 |
}
|
| 78 |
|
| 79 |
-
/*
|
| 80 |
-
.
|
| 81 |
display: grid;
|
| 82 |
-
grid-template-
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
|
|
|
|
|
|
| 88 |
}
|
| 89 |
|
| 90 |
-
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
|
| 97 |
-
}
|
| 98 |
}
|
| 99 |
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
background:
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
|
|
|
|
|
|
| 106 |
display: flex;
|
| 107 |
flex-direction: column;
|
| 108 |
gap: 24px;
|
|
|
|
| 109 |
}
|
| 110 |
|
| 111 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 112 |
display: flex;
|
| 113 |
align-items: center;
|
| 114 |
-
gap:
|
| 115 |
-
border-bottom: 1px solid #F1F5F9;
|
| 116 |
-
padding-bottom: 20px;
|
| 117 |
-
margin-bottom: 4px;
|
| 118 |
-
}
|
| 119 |
-
|
| 120 |
-
.headerIcon {
|
| 121 |
-
font-size: 24px;
|
| 122 |
-
color: #3B82F6;
|
| 123 |
-
}
|
| 124 |
-
|
| 125 |
-
.headerText h3 {
|
| 126 |
-
font-size: 14px;
|
| 127 |
-
font-weight: 900;
|
| 128 |
-
color: #1E293B;
|
| 129 |
-
letter-spacing: 0.05em;
|
| 130 |
-
margin: 0;
|
| 131 |
-
}
|
| 132 |
-
|
| 133 |
-
.headerText span {
|
| 134 |
-
font-size: 11px;
|
| 135 |
-
color: #64748B;
|
| 136 |
-
font-weight: 600;
|
| 137 |
-
}
|
| 138 |
-
|
| 139 |
-
/* AI Sentinel Specifics */
|
| 140 |
-
.sentinelArea {
|
| 141 |
-
grid-area: sentinel;
|
| 142 |
-
background: radial-gradient(circle at 70% 30%, rgba(124, 58, 237, 0.4) 0%, transparent 70%),
|
| 143 |
-
radial-gradient(circle at 10% 80%, rgba(79, 70, 229, 0.3) 0%, transparent 60%),
|
| 144 |
-
rgba(15, 23, 42, 0.98);
|
| 145 |
-
backdrop-filter: blur(32px);
|
| 146 |
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 147 |
-
color: #fff;
|
| 148 |
-
position: relative;
|
| 149 |
-
overflow: hidden;
|
| 150 |
-
box-shadow: 0 40px 100px -20px rgba(76, 29, 149, 0.3);
|
| 151 |
-
padding: 48px; /* Increased padding for premium feel */
|
| 152 |
-
}
|
| 153 |
-
|
| 154 |
-
.sentinelArea .headerText h3 {
|
| 155 |
-
color: #fff;
|
| 156 |
-
}
|
| 157 |
-
|
| 158 |
-
.sentinelArea .headerText span {
|
| 159 |
-
color: rgba(255,255,255,0.4);
|
| 160 |
-
}
|
| 161 |
-
|
| 162 |
-
.sentinelArea::after {
|
| 163 |
-
content: '';
|
| 164 |
-
position: absolute;
|
| 165 |
-
top: 0;
|
| 166 |
-
right: 0;
|
| 167 |
-
width: 150px;
|
| 168 |
-
height: 150px;
|
| 169 |
-
background: radial-gradient(circle, #3B82F610 0%, transparent 70%);
|
| 170 |
-
z-index: 0;
|
| 171 |
-
}
|
| 172 |
-
|
| 173 |
-
.sentinelContent {
|
| 174 |
-
display: grid;
|
| 175 |
-
grid-template-columns: 1fr 280px;
|
| 176 |
-
gap: 32px;
|
| 177 |
-
z-index: 1;
|
| 178 |
}
|
| 179 |
|
| 180 |
.narrativeBox {
|
| 181 |
-
|
| 182 |
-
border-right: 1px solid rgba(255, 255, 255, 0.08);
|
| 183 |
-
}
|
| 184 |
-
|
| 185 |
-
.narrativeBox strong {
|
| 186 |
-
color: #fff !important;
|
| 187 |
-
font-weight: 800;
|
| 188 |
-
background: rgba(124, 58, 237, 0.2);
|
| 189 |
-
padding: 0 4px;
|
| 190 |
-
border-radius: 4px;
|
| 191 |
}
|
| 192 |
|
| 193 |
.narrativeBox p {
|
| 194 |
-
font-size:
|
| 195 |
line-height: 1.8;
|
| 196 |
-
color: rgba(255, 255, 255, 0.95)
|
| 197 |
font-weight: 400;
|
| 198 |
-
margin-bottom: 24px;
|
| 199 |
}
|
| 200 |
|
| 201 |
-
.narrativeBox
|
| 202 |
-
color:
|
| 203 |
-
|
| 204 |
-
|
|
|
|
|
|
|
| 205 |
}
|
| 206 |
|
| 207 |
-
.
|
| 208 |
display: flex;
|
| 209 |
flex-direction: column;
|
| 210 |
-
gap:
|
| 211 |
-
}
|
| 212 |
-
|
| 213 |
-
.actionGrid label {
|
| 214 |
-
font-size: 9px;
|
| 215 |
-
font-weight: 900;
|
| 216 |
-
color: var(--neural-accent-violet);
|
| 217 |
-
letter-spacing: 0.2em;
|
| 218 |
}
|
| 219 |
|
| 220 |
.actionItem {
|
| 221 |
display: flex;
|
| 222 |
gap: 16px;
|
| 223 |
-
|
| 224 |
-
|
| 225 |
-
background: rgba(255, 255, 255, 0.05);
|
| 226 |
border-radius: 16px;
|
| 227 |
-
border: 1px solid rgba(255, 255, 255, 0.
|
| 228 |
-
transition: all 0.
|
| 229 |
}
|
| 230 |
|
| 231 |
.actionItem:hover {
|
| 232 |
-
background: rgba(255, 255, 255, 0.
|
| 233 |
-
border-color: rgba(255, 255, 255, 0.2);
|
| 234 |
transform: translateX(8px);
|
|
|
|
| 235 |
}
|
| 236 |
|
| 237 |
.actionBullet {
|
|
@@ -251,393 +187,251 @@
|
|
| 251 |
|
| 252 |
.actionItem p {
|
| 253 |
font-size: 13px;
|
| 254 |
-
font-weight:
|
| 255 |
-
color:
|
| 256 |
line-height: 1.5;
|
|
|
|
| 257 |
}
|
| 258 |
|
| 259 |
-
/*
|
| 260 |
-
.
|
| 261 |
-
|
| 262 |
-
|
| 263 |
-
|
| 264 |
-
.tableWrapper {
|
| 265 |
-
width: 100%;
|
| 266 |
-
overflow-x: auto;
|
| 267 |
-
margin-top: 8px;
|
| 268 |
-
}
|
| 269 |
-
|
| 270 |
-
.breachTable {
|
| 271 |
-
width: 100%;
|
| 272 |
-
border-collapse: separate;
|
| 273 |
-
border-spacing: 0 8px;
|
| 274 |
-
}
|
| 275 |
-
|
| 276 |
-
.breachTable th {
|
| 277 |
-
text-align: left;
|
| 278 |
-
font-size: 10px;
|
| 279 |
-
font-weight: 900;
|
| 280 |
-
color: #94A3B8;
|
| 281 |
-
letter-spacing: 0.1em;
|
| 282 |
-
padding: 0 24px 8px;
|
| 283 |
-
text-transform: uppercase;
|
| 284 |
-
}
|
| 285 |
-
|
| 286 |
-
.breachRow {
|
| 287 |
-
background: #FEF2F2;
|
| 288 |
-
border: 1px solid #FEE2E2;
|
| 289 |
-
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
| 290 |
-
cursor: pointer;
|
| 291 |
-
}
|
| 292 |
-
|
| 293 |
-
.breachRow:hover {
|
| 294 |
-
transform: scale(1.005);
|
| 295 |
-
background: #FFF1F1;
|
| 296 |
-
box-shadow: 0 4px 12px rgba(239, 68, 68, 0.08);
|
| 297 |
-
}
|
| 298 |
-
|
| 299 |
-
.breachRow td {
|
| 300 |
-
padding: 16px 24px;
|
| 301 |
-
}
|
| 302 |
-
|
| 303 |
-
.breachRow td:first-child {
|
| 304 |
-
border-top-left-radius: 16px;
|
| 305 |
-
border-bottom-left-radius: 16px;
|
| 306 |
}
|
| 307 |
|
| 308 |
-
.
|
| 309 |
-
|
| 310 |
-
border-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 311 |
}
|
| 312 |
|
| 313 |
-
.
|
| 314 |
-
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
-
|
| 319 |
}
|
| 320 |
|
| 321 |
-
.
|
| 322 |
-
|
| 323 |
-
|
| 324 |
-
.priorityBadge[data-priority="High"] { background: #F59E0B; }
|
| 325 |
-
.priorityBadge[data-priority="P2"],
|
| 326 |
-
.priorityBadge[data-priority="Medium"] { background: #3B82F6; }
|
| 327 |
-
.priorityBadge[data-priority="P3"],
|
| 328 |
-
.priorityBadge[data-priority="Low"] { background: #64748B; }
|
| 329 |
-
|
| 330 |
-
.refCell {
|
| 331 |
-
font-family: 'JetBrains Mono', monospace;
|
| 332 |
-
font-size: 12px;
|
| 333 |
-
font-weight: 700;
|
| 334 |
-
color: #64748B;
|
| 335 |
}
|
| 336 |
|
| 337 |
-
.
|
| 338 |
font-size: 14px;
|
| 339 |
-
font-weight: 800;
|
| 340 |
-
color: #991B1B;
|
| 341 |
-
}
|
| 342 |
-
|
| 343 |
-
.statusBadge {
|
| 344 |
-
font-size: 11px;
|
| 345 |
-
font-weight: 700;
|
| 346 |
-
color: #B91C1C;
|
| 347 |
-
text-transform: uppercase;
|
| 348 |
-
background: rgba(239, 68, 68, 0.08);
|
| 349 |
-
padding: 4px 12px;
|
| 350 |
-
border-radius: 20px;
|
| 351 |
-
}
|
| 352 |
-
|
| 353 |
-
.timeCell {
|
| 354 |
-
font-size: 18px;
|
| 355 |
font-weight: 900;
|
| 356 |
-
color: #
|
| 357 |
-
|
|
|
|
| 358 |
}
|
| 359 |
|
| 360 |
-
.
|
| 361 |
-
|
| 362 |
-
padding: 60px !important;
|
| 363 |
color: #64748B;
|
| 364 |
-
font-
|
| 365 |
-
font-weight: 700;
|
| 366 |
-
}
|
| 367 |
-
|
| 368 |
-
.emptyCell .shieldIcon {
|
| 369 |
-
display: block;
|
| 370 |
-
margin: 0 auto 16px;
|
| 371 |
-
font-size: 40px;
|
| 372 |
-
opacity: 0.2;
|
| 373 |
-
}
|
| 374 |
-
|
| 375 |
-
/* Markdown Support in Narrative */
|
| 376 |
-
.narrativeBox strong {
|
| 377 |
-
color: #1E293B;
|
| 378 |
-
font-weight: 800;
|
| 379 |
-
}
|
| 380 |
-
|
| 381 |
-
.narrativeBox ul, .narrativeBox ol {
|
| 382 |
-
margin: 12px 0;
|
| 383 |
-
padding-left: 20px;
|
| 384 |
}
|
| 385 |
|
| 386 |
-
.
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
|
|
|
|
| 390 |
}
|
| 391 |
|
| 392 |
-
/*
|
| 393 |
-
.
|
| 394 |
-
|
| 395 |
-
|
| 396 |
}
|
| 397 |
|
| 398 |
-
.
|
| 399 |
display: flex;
|
| 400 |
flex-direction: column;
|
| 401 |
-
gap:
|
| 402 |
}
|
| 403 |
|
| 404 |
-
.
|
| 405 |
display: flex;
|
| 406 |
flex-direction: column;
|
| 407 |
-
gap:
|
| 408 |
}
|
| 409 |
|
| 410 |
-
.
|
| 411 |
display: flex;
|
| 412 |
justify-content: space-between;
|
| 413 |
-
align-items:
|
| 414 |
-
|
| 415 |
-
|
| 416 |
-
.categoryLabel span {
|
| 417 |
-
font-size: 13px;
|
| 418 |
-
font-weight: 800;
|
| 419 |
-
color: #1E293B;
|
| 420 |
-
}
|
| 421 |
-
|
| 422 |
-
.categoryLabel label {
|
| 423 |
-
font-size: 11px;
|
| 424 |
font-weight: 700;
|
| 425 |
-
color: #
|
| 426 |
}
|
| 427 |
|
| 428 |
-
.
|
| 429 |
-
height:
|
| 430 |
-
background: #
|
| 431 |
-
border-radius:
|
| 432 |
overflow: hidden;
|
| 433 |
}
|
| 434 |
|
| 435 |
-
.
|
| 436 |
height: 100%;
|
| 437 |
-
background: linear-gradient(90deg,
|
| 438 |
-
border-radius:
|
| 439 |
-
transition: width
|
| 440 |
}
|
| 441 |
|
| 442 |
-
|
| 443 |
-
|
| 444 |
-
|
|
|
|
|
|
|
|
|
|
| 445 |
}
|
| 446 |
|
| 447 |
-
.
|
| 448 |
-
|
| 449 |
-
|
| 450 |
-
gap: 20px;
|
| 451 |
-
}
|
| 452 |
|
| 453 |
-
.
|
|
|
|
| 454 |
display: flex;
|
| 455 |
-
|
| 456 |
-
|
| 457 |
}
|
| 458 |
|
| 459 |
-
.
|
| 460 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 461 |
font-weight: 800;
|
| 462 |
-
color: #
|
| 463 |
-
padding-top: 2px;
|
| 464 |
-
white-space: nowrap;
|
| 465 |
}
|
| 466 |
|
| 467 |
-
.
|
| 468 |
-
|
| 469 |
-
|
|
|
|
|
|
|
|
|
|
| 470 |
}
|
| 471 |
|
| 472 |
-
.
|
| 473 |
font-size: 10px;
|
| 474 |
-
font-weight:
|
| 475 |
-
color: #
|
| 476 |
-
|
| 477 |
-
}
|
| 478 |
-
|
| 479 |
-
.auditContent p {
|
| 480 |
-
font-size: 12px;
|
| 481 |
-
color: #64748B;
|
| 482 |
-
margin-top: 2px;
|
| 483 |
}
|
| 484 |
|
| 485 |
-
/*
|
| 486 |
-
.
|
| 487 |
display: flex;
|
| 488 |
flex-direction: column;
|
| 489 |
-
|
| 490 |
-
justify-content: center;
|
| 491 |
-
height: 100vh;
|
| 492 |
-
gap: 20px;
|
| 493 |
-
}
|
| 494 |
-
|
| 495 |
-
.loadingPulse {
|
| 496 |
-
width: 60px;
|
| 497 |
-
height: 60px;
|
| 498 |
-
background: #3B82F6;
|
| 499 |
-
border-radius: 50%;
|
| 500 |
-
animation: pulse 1.5s ease-in-out infinite;
|
| 501 |
-
}
|
| 502 |
-
|
| 503 |
-
.loadingContainer span {
|
| 504 |
-
font-size: 14px;
|
| 505 |
-
font-weight: 800;
|
| 506 |
-
color: #3B82F6;
|
| 507 |
-
letter-spacing: 0.1em;
|
| 508 |
-
}
|
| 509 |
-
|
| 510 |
-
@keyframes pulse {
|
| 511 |
-
0% { transform: scale(0.9); opacity: 0.8; }
|
| 512 |
-
50% { transform: scale(1.1); opacity: 0.4; }
|
| 513 |
-
100% { transform: scale(0.9); opacity: 0.8; }
|
| 514 |
-
}
|
| 515 |
-
|
| 516 |
-
.miniSpinner {
|
| 517 |
-
width: 14px;
|
| 518 |
-
height: 14px;
|
| 519 |
-
border: 2px solid #3B82F630;
|
| 520 |
-
border-top-color: #3B82F6;
|
| 521 |
-
border-radius: 50%;
|
| 522 |
-
animation: spin 1s linear infinite;
|
| 523 |
-
margin-left: auto;
|
| 524 |
-
}
|
| 525 |
-
|
| 526 |
-
@keyframes spin {
|
| 527 |
-
to { transform: rotate(360deg); }
|
| 528 |
}
|
| 529 |
|
| 530 |
-
|
| 531 |
-
|
| 532 |
-
|
| 533 |
-
|
| 534 |
-
margin-top: 8px;
|
| 535 |
-
opacity: 0.6;
|
| 536 |
}
|
| 537 |
|
| 538 |
-
.
|
| 539 |
-
|
| 540 |
-
|
| 541 |
-
|
| 542 |
-
background: linear-gradient(180deg, rgba(59, 130, 246, 0.05) 0%, transparent 100%);
|
| 543 |
-
border-radius: 12px;
|
| 544 |
-
padding: 8px;
|
| 545 |
}
|
| 546 |
|
| 547 |
-
.
|
| 548 |
-
font-size:
|
| 549 |
font-weight: 900;
|
| 550 |
-
|
| 551 |
-
border-radius: 4px;
|
| 552 |
text-transform: uppercase;
|
| 553 |
letter-spacing: 0.05em;
|
| 554 |
-
margin-left: 8px;
|
| 555 |
-
}
|
| 556 |
-
|
| 557 |
-
.surge {
|
| 558 |
-
background: #FEF2F2;
|
| 559 |
-
color: #EF4444;
|
| 560 |
-
border: 1px solid #FEE2E2;
|
| 561 |
-
}
|
| 562 |
-
|
| 563 |
-
.stable {
|
| 564 |
-
background: #F0FDF4;
|
| 565 |
-
color: #16A34A;
|
| 566 |
-
border: 1px solid #DCFCE7;
|
| 567 |
-
}
|
| 568 |
-
|
| 569 |
-
.declining {
|
| 570 |
background: #F1F5F9;
|
| 571 |
-
|
| 572 |
-
border:
|
| 573 |
}
|
| 574 |
|
| 575 |
-
|
| 576 |
-
|
| 577 |
-
|
| 578 |
-
|
| 579 |
-
transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
|
| 580 |
-
cursor: pointer;
|
| 581 |
}
|
| 582 |
|
| 583 |
-
.
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
|
|
|
| 587 |
}
|
| 588 |
|
| 589 |
-
.
|
|
|
|
| 590 |
display: flex;
|
| 591 |
flex-direction: column;
|
| 592 |
-
|
|
|
|
|
|
|
|
|
|
| 593 |
}
|
| 594 |
|
| 595 |
-
.
|
| 596 |
-
|
| 597 |
-
|
| 598 |
-
|
| 599 |
-
|
| 600 |
-
|
|
|
|
|
|
|
| 601 |
}
|
| 602 |
|
| 603 |
-
.
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 607 |
}
|
| 608 |
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
color: #64748B;
|
| 613 |
-
display: flex;
|
| 614 |
-
justify-content: space-between;
|
| 615 |
}
|
| 616 |
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
color: #F59E0B;
|
| 621 |
-
text-transform: uppercase;
|
| 622 |
-
letter-spacing: 0.1em;
|
| 623 |
}
|
| 624 |
|
| 625 |
-
.
|
| 626 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 627 |
}
|
| 628 |
|
| 629 |
-
|
| 630 |
-
|
|
|
|
| 631 |
}
|
| 632 |
|
| 633 |
-
|
| 634 |
-
|
| 635 |
-
70% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0); }
|
| 636 |
-
100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
|
| 637 |
}
|
| 638 |
|
| 639 |
-
@keyframes
|
| 640 |
-
|
| 641 |
-
70% { box-shadow: 0 0 0 10px rgba(245, 158, 11, 0); }
|
| 642 |
-
100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
|
| 643 |
}
|
|
|
|
| 1 |
.container {
|
| 2 |
+
padding: 32px;
|
| 3 |
+
background-color: #f8fafc;
|
| 4 |
min-height: 100vh;
|
| 5 |
display: flex;
|
| 6 |
flex-direction: column;
|
| 7 |
gap: 32px;
|
| 8 |
+
animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1);
|
| 9 |
}
|
| 10 |
|
| 11 |
@keyframes fadeIn {
|
| 12 |
+
from { opacity: 0; transform: translateY(20px); }
|
| 13 |
to { opacity: 1; transform: translateY(0); }
|
| 14 |
}
|
| 15 |
|
| 16 |
+
/* 1. Universal Glassmorphism Utility */
|
| 17 |
+
.glass {
|
| 18 |
+
background: rgba(255, 255, 255, 0.7);
|
| 19 |
+
backdrop-filter: blur(16px);
|
| 20 |
+
border: 1px solid rgba(255, 255, 255, 0.4);
|
| 21 |
+
box-shadow: 0 8px 32px -4px rgba(0, 0, 0, 0.05);
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
/* 2. Vitals Row */
|
| 25 |
.vitalsRow {
|
| 26 |
display: grid;
|
| 27 |
+
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
|
| 28 |
+
gap: 20px;
|
| 29 |
}
|
| 30 |
|
| 31 |
.vitalCard {
|
| 32 |
+
composes: glass;
|
| 33 |
+
border-radius: 24px;
|
|
|
|
|
|
|
| 34 |
padding: 24px;
|
| 35 |
display: flex;
|
| 36 |
align-items: center;
|
| 37 |
gap: 20px;
|
| 38 |
+
transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
|
|
|
|
| 39 |
}
|
| 40 |
|
| 41 |
.vitalCard:hover {
|
| 42 |
+
transform: translateY(-8px);
|
| 43 |
background: white;
|
|
|
|
| 44 |
border-color: var(--primary);
|
| 45 |
+
box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.1);
|
| 46 |
}
|
| 47 |
|
| 48 |
.vitalIcon {
|
| 49 |
+
width: 52px;
|
| 50 |
+
height: 52px;
|
| 51 |
+
border-radius: 16px;
|
| 52 |
display: flex;
|
| 53 |
align-items: center;
|
| 54 |
justify-content: center;
|
| 55 |
+
font-size: 24px;
|
| 56 |
+
flex-shrink: 0;
|
| 57 |
}
|
| 58 |
|
| 59 |
.vitalMeta {
|
|
|
|
| 66 |
font-weight: 800;
|
| 67 |
color: #64748B;
|
| 68 |
letter-spacing: 0.1em;
|
| 69 |
+
text-transform: uppercase;
|
| 70 |
}
|
| 71 |
|
| 72 |
.vitalValue {
|
| 73 |
+
font-size: 32px;
|
| 74 |
font-weight: 900;
|
| 75 |
+
color: #0F172A;
|
| 76 |
+
line-height: 1.1;
|
| 77 |
+
margin: 6px 0;
|
| 78 |
}
|
| 79 |
|
| 80 |
.vitalSub {
|
|
|
|
| 83 |
color: #94A3B8;
|
| 84 |
}
|
| 85 |
|
| 86 |
+
/* 3. Sentinel Master (AI Narrative + Strategy) */
|
| 87 |
+
.sentinelMaster {
|
| 88 |
display: grid;
|
| 89 |
+
grid-template-columns: 1fr 340px;
|
| 90 |
+
gap: 1px; /* Divider effect */
|
| 91 |
+
background: #111827; /* Dark base */
|
| 92 |
+
border-radius: 32px;
|
| 93 |
+
overflow: hidden;
|
| 94 |
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
| 95 |
+
box-shadow: 0 40px 100px -20px rgba(76, 29, 149, 0.4);
|
| 96 |
+
position: relative;
|
| 97 |
}
|
| 98 |
|
| 99 |
+
.sentinelMaster::before {
|
| 100 |
+
content: '';
|
| 101 |
+
position: absolute;
|
| 102 |
+
top: 0; left: 0; right: 0; bottom: 0;
|
| 103 |
+
background: radial-gradient(circle at 70% 30%, rgba(124, 58, 237, 0.15) 0%, transparent 70%),
|
| 104 |
+
radial-gradient(circle at 10% 80%, rgba(79, 70, 229, 0.1) 0%, transparent 60%);
|
| 105 |
+
pointer-events: none;
|
|
|
|
| 106 |
}
|
| 107 |
|
| 108 |
+
.sentinelBody {
|
| 109 |
+
padding: 48px;
|
| 110 |
+
background: rgba(17, 24, 39, 0.8);
|
| 111 |
+
}
|
| 112 |
+
|
| 113 |
+
.strategicActions {
|
| 114 |
+
background: rgba(255, 255, 255, 0.03);
|
| 115 |
+
padding: 48px 32px;
|
| 116 |
display: flex;
|
| 117 |
flex-direction: column;
|
| 118 |
gap: 24px;
|
| 119 |
+
border-left: 1px solid rgba(255, 255, 255, 0.08);
|
| 120 |
}
|
| 121 |
|
| 122 |
+
.strategicActions label {
|
| 123 |
+
font-size: 10px;
|
| 124 |
+
font-weight: 900;
|
| 125 |
+
color: #A78BFA;
|
| 126 |
+
letter-spacing: 0.2em;
|
| 127 |
display: flex;
|
| 128 |
align-items: center;
|
| 129 |
+
gap: 8px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
}
|
| 131 |
|
| 132 |
.narrativeBox {
|
| 133 |
+
margin-top: 32px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 134 |
}
|
| 135 |
|
| 136 |
.narrativeBox p {
|
| 137 |
+
font-size: 18px;
|
| 138 |
line-height: 1.8;
|
| 139 |
+
color: rgba(255, 255, 255, 0.95);
|
| 140 |
font-weight: 400;
|
|
|
|
| 141 |
}
|
| 142 |
|
| 143 |
+
.narrativeBox strong {
|
| 144 |
+
color: #FFF;
|
| 145 |
+
background: rgba(139, 92, 246, 0.25);
|
| 146 |
+
padding: 2px 6px;
|
| 147 |
+
border-radius: 6px;
|
| 148 |
+
font-weight: 700;
|
| 149 |
}
|
| 150 |
|
| 151 |
+
.actionList {
|
| 152 |
display: flex;
|
| 153 |
flex-direction: column;
|
| 154 |
+
gap: 16px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 155 |
}
|
| 156 |
|
| 157 |
.actionItem {
|
| 158 |
display: flex;
|
| 159 |
gap: 16px;
|
| 160 |
+
padding: 20px;
|
| 161 |
+
background: rgba(255, 255, 255, 0.04);
|
|
|
|
| 162 |
border-radius: 16px;
|
| 163 |
+
border: 1px solid rgba(255, 255, 255, 0.08);
|
| 164 |
+
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
| 165 |
}
|
| 166 |
|
| 167 |
.actionItem:hover {
|
| 168 |
+
background: rgba(255, 255, 255, 0.07);
|
|
|
|
| 169 |
transform: translateX(8px);
|
| 170 |
+
border-color: rgba(167, 139, 250, 0.4);
|
| 171 |
}
|
| 172 |
|
| 173 |
.actionBullet {
|
|
|
|
| 187 |
|
| 188 |
.actionItem p {
|
| 189 |
font-size: 13px;
|
| 190 |
+
font-weight: 500;
|
| 191 |
+
color: rgba(255, 255, 255, 0.8);
|
| 192 |
line-height: 1.5;
|
| 193 |
+
margin: 0;
|
| 194 |
}
|
| 195 |
|
| 196 |
+
/* 4. Intelligence Grid (Lower Cards) */
|
| 197 |
+
.intelligenceGrid {
|
| 198 |
+
display: grid;
|
| 199 |
+
grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
|
| 200 |
+
gap: 32px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 201 |
}
|
| 202 |
|
| 203 |
+
.gridCard {
|
| 204 |
+
composes: glass;
|
| 205 |
+
border-radius: 28px;
|
| 206 |
+
padding: 32px;
|
| 207 |
+
display: flex;
|
| 208 |
+
flex-direction: column;
|
| 209 |
+
gap: 24px;
|
| 210 |
+
min-height: 380px;
|
| 211 |
}
|
| 212 |
|
| 213 |
+
.cardHeader {
|
| 214 |
+
display: flex;
|
| 215 |
+
align-items: center;
|
| 216 |
+
gap: 16px;
|
| 217 |
+
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
| 218 |
+
padding-bottom: 20px;
|
| 219 |
}
|
| 220 |
|
| 221 |
+
.headerIcon {
|
| 222 |
+
color: var(--primary);
|
| 223 |
+
flex-shrink: 0;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
}
|
| 225 |
|
| 226 |
+
.headerText h3 {
|
| 227 |
font-size: 14px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 228 |
font-weight: 900;
|
| 229 |
+
color: #0F172A;
|
| 230 |
+
letter-spacing: 0.05em;
|
| 231 |
+
margin: 0;
|
| 232 |
}
|
| 233 |
|
| 234 |
+
.headerText span {
|
| 235 |
+
font-size: 11px;
|
|
|
|
| 236 |
color: #64748B;
|
| 237 |
+
font-weight: 600;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 238 |
}
|
| 239 |
|
| 240 |
+
.cardBody {
|
| 241 |
+
flex: 1;
|
| 242 |
+
display: flex;
|
| 243 |
+
flex-direction: column;
|
| 244 |
+
gap: 24px;
|
| 245 |
}
|
| 246 |
|
| 247 |
+
/* 5. Chart Aesthetics */
|
| 248 |
+
.areaTrendWrapper {
|
| 249 |
+
width: 100%;
|
| 250 |
+
position: relative;
|
| 251 |
}
|
| 252 |
|
| 253 |
+
.categoryStack {
|
| 254 |
display: flex;
|
| 255 |
flex-direction: column;
|
| 256 |
+
gap: 16px;
|
| 257 |
}
|
| 258 |
|
| 259 |
+
.categoryRow {
|
| 260 |
display: flex;
|
| 261 |
flex-direction: column;
|
| 262 |
+
gap: 6px;
|
| 263 |
}
|
| 264 |
|
| 265 |
+
.catLabelRow {
|
| 266 |
display: flex;
|
| 267 |
justify-content: space-between;
|
| 268 |
+
align-items: center;
|
| 269 |
+
font-size: 12px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
font-weight: 700;
|
| 271 |
+
color: #334155;
|
| 272 |
}
|
| 273 |
|
| 274 |
+
.catBarBack {
|
| 275 |
+
height: 6px;
|
| 276 |
+
background: #E2E8F0;
|
| 277 |
+
border-radius: 3px;
|
| 278 |
overflow: hidden;
|
| 279 |
}
|
| 280 |
|
| 281 |
+
.catBarFill {
|
| 282 |
height: 100%;
|
| 283 |
+
background: linear-gradient(90deg, #3B82F6, #60A5FA);
|
| 284 |
+
border-radius: 3px;
|
| 285 |
+
transition: width 1s ease-out;
|
| 286 |
}
|
| 287 |
|
| 288 |
+
.velocityBadge {
|
| 289 |
+
font-size: 8px;
|
| 290 |
+
font-weight: 900;
|
| 291 |
+
padding: 2px 6px;
|
| 292 |
+
border-radius: 4px;
|
| 293 |
+
text-transform: uppercase;
|
| 294 |
}
|
| 295 |
|
| 296 |
+
.surge { background: #FEF2F2; color: #EF4444; border: 1px solid #FEE2E2; }
|
| 297 |
+
.stable { background: #F0FDF4; color: #16A34A; border: 1px solid #DCFCE7; }
|
| 298 |
+
.declining { background: #F8FAFC; color: #64748B; border: 1px solid #E2E8F0; }
|
|
|
|
|
|
|
| 299 |
|
| 300 |
+
/* 6. Talent & Thermal Metadata */
|
| 301 |
+
.staffMeta {
|
| 302 |
display: flex;
|
| 303 |
+
flex-wrap: wrap;
|
| 304 |
+
gap: 10px;
|
| 305 |
}
|
| 306 |
|
| 307 |
+
.staffPill {
|
| 308 |
+
display: flex;
|
| 309 |
+
align-items: center;
|
| 310 |
+
gap: 6px;
|
| 311 |
+
background: #F1F5F9;
|
| 312 |
+
padding: 6px 12px;
|
| 313 |
+
border-radius: 99px;
|
| 314 |
+
font-size: 10px;
|
| 315 |
font-weight: 800;
|
| 316 |
+
color: #475569;
|
|
|
|
|
|
|
| 317 |
}
|
| 318 |
|
| 319 |
+
.staffDot {
|
| 320 |
+
width: 6px;
|
| 321 |
+
height: 6px;
|
| 322 |
+
background: #10B981;
|
| 323 |
+
border-radius: 50%;
|
| 324 |
+
box-shadow: 0 0 8px rgba(16, 185, 129, 0.5);
|
| 325 |
}
|
| 326 |
|
| 327 |
+
.moreStaff {
|
| 328 |
font-size: 10px;
|
| 329 |
+
font-weight: 700;
|
| 330 |
+
color: #94A3B8;
|
| 331 |
+
padding: 6px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 332 |
}
|
| 333 |
|
| 334 |
+
/* 7. Ledger Feed */
|
| 335 |
+
.ledgerList {
|
| 336 |
display: flex;
|
| 337 |
flex-direction: column;
|
| 338 |
+
gap: 18px;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 339 |
}
|
| 340 |
|
| 341 |
+
.ledgerItem {
|
| 342 |
+
display: flex;
|
| 343 |
+
flex-direction: column;
|
| 344 |
+
gap: 4px;
|
|
|
|
|
|
|
| 345 |
}
|
| 346 |
|
| 347 |
+
.ledgerMeta {
|
| 348 |
+
display: flex;
|
| 349 |
+
justify-content: space-between;
|
| 350 |
+
align-items: center;
|
|
|
|
|
|
|
|
|
|
| 351 |
}
|
| 352 |
|
| 353 |
+
.ledgerAction {
|
| 354 |
+
font-size: 10px;
|
| 355 |
font-weight: 900;
|
| 356 |
+
color: #0F172A;
|
|
|
|
| 357 |
text-transform: uppercase;
|
| 358 |
letter-spacing: 0.05em;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 359 |
background: #F1F5F9;
|
| 360 |
+
padding: 2px 8px;
|
| 361 |
+
border-radius: 4px;
|
| 362 |
}
|
| 363 |
|
| 364 |
+
.ledgerTime {
|
| 365 |
+
font-size: 10px;
|
| 366 |
+
color: #94A3B8;
|
| 367 |
+
font-weight: 600;
|
|
|
|
|
|
|
| 368 |
}
|
| 369 |
|
| 370 |
+
.ledgerItem p {
|
| 371 |
+
font-size: 13px;
|
| 372 |
+
color: #475569;
|
| 373 |
+
margin: 0;
|
| 374 |
+
font-weight: 500;
|
| 375 |
}
|
| 376 |
|
| 377 |
+
/* 8. Pulse Components */
|
| 378 |
+
.loadingContainer {
|
| 379 |
display: flex;
|
| 380 |
flex-direction: column;
|
| 381 |
+
align-items: center;
|
| 382 |
+
justify-content: center;
|
| 383 |
+
height: 80vh;
|
| 384 |
+
position: relative;
|
| 385 |
}
|
| 386 |
|
| 387 |
+
.loadingPulse {
|
| 388 |
+
width: 80px;
|
| 389 |
+
height: 80px;
|
| 390 |
+
background: var(--primary);
|
| 391 |
+
border-radius: 50%;
|
| 392 |
+
filter: blur(40px);
|
| 393 |
+
opacity: 0.3;
|
| 394 |
+
animation: globalPulse 2s infinite ease-in-out;
|
| 395 |
}
|
| 396 |
|
| 397 |
+
.loadingGlow {
|
| 398 |
+
position: absolute;
|
| 399 |
+
width: 120px;
|
| 400 |
+
height: 120px;
|
| 401 |
+
border: 1px solid var(--primary);
|
| 402 |
+
border-radius: 50%;
|
| 403 |
+
opacity: 0.1;
|
| 404 |
+
animation: globalOrb 4s infinite linear;
|
| 405 |
}
|
| 406 |
|
| 407 |
+
@keyframes globalPulse {
|
| 408 |
+
0%, 100% { transform: scale(1); opacity: 0.3; }
|
| 409 |
+
50% { transform: scale(1.5); opacity: 0.1; }
|
|
|
|
|
|
|
|
|
|
| 410 |
}
|
| 411 |
|
| 412 |
+
@keyframes globalOrb {
|
| 413 |
+
from { transform: rotate(0deg); }
|
| 414 |
+
to { transform: rotate(360deg); }
|
|
|
|
|
|
|
|
|
|
| 415 |
}
|
| 416 |
|
| 417 |
+
.loadingContainer span {
|
| 418 |
+
margin-top: 24px;
|
| 419 |
+
font-size: 14px;
|
| 420 |
+
font-weight: 900;
|
| 421 |
+
color: var(--primary);
|
| 422 |
+
letter-spacing: 0.2em;
|
| 423 |
+
text-transform: uppercase;
|
| 424 |
}
|
| 425 |
|
| 426 |
+
/* Tooltip & Micro-interactions */
|
| 427 |
+
.miniTrendContainer {
|
| 428 |
+
margin-left: auto;
|
| 429 |
}
|
| 430 |
|
| 431 |
+
.spin {
|
| 432 |
+
animation: spin 1s linear infinite;
|
|
|
|
|
|
|
| 433 |
}
|
| 434 |
|
| 435 |
+
@keyframes spin {
|
| 436 |
+
to { transform: rotate(360deg); }
|
|
|
|
|
|
|
| 437 |
}
|
frontend/apps/internal/src/components/AnalyticsDashboard.tsx
CHANGED
|
@@ -1,54 +1,75 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
| 27 |
|
| 28 |
-
const
|
| 29 |
-
if (data.length < 2) return null;
|
| 30 |
-
const min = Math.min(...data);
|
| 31 |
-
const max = Math.max(...data);
|
| 32 |
-
const range = max - min || 1;
|
| 33 |
-
const width = 60;
|
| 34 |
-
const height = 24;
|
| 35 |
-
const points = data.map((val, i) => {
|
| 36 |
-
const x = (i / (data.length - 1)) * width;
|
| 37 |
-
const y = height - ((val - min) / range) * height;
|
| 38 |
-
return `${x},${y}`;
|
| 39 |
-
}).join(' ');
|
| 40 |
|
| 41 |
return (
|
| 42 |
-
<div className={styles.
|
| 43 |
-
<svg width=
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
fill="none"
|
| 46 |
stroke={color}
|
| 47 |
-
strokeWidth="
|
| 48 |
-
|
| 49 |
-
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 52 |
</svg>
|
| 53 |
</div>
|
| 54 |
);
|
|
@@ -56,7 +77,7 @@ const MiniTrend = ({ data, color }: { data: number[], color: string }) => {
|
|
| 56 |
|
| 57 |
export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspaceId, readOnly }) => {
|
| 58 |
const { stats, loading: statsLoading } = useDashboardStats(workspaceId);
|
| 59 |
-
const { daily, sla, loading: reportsLoading } = useReports(workspaceId);
|
| 60 |
const { audit, loading: escLoading } = useEscalations(workspaceId);
|
| 61 |
const { insights, loading: aiLoading } = useAIInsights(workspaceId);
|
| 62 |
const { narrative, loading: narrativeLoading } = useServiceNarrative(workspaceId);
|
|
@@ -68,25 +89,20 @@ export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspac
|
|
| 68 |
return (
|
| 69 |
<div className={styles.loadingContainer}>
|
| 70 |
<div className={styles.loadingPulse} />
|
| 71 |
-
<
|
|
|
|
| 72 |
</div>
|
| 73 |
);
|
| 74 |
}
|
| 75 |
|
| 76 |
-
//
|
| 77 |
const dailyVolumes = daily.map(d => d.total);
|
| 78 |
-
|
| 79 |
const categories = daily.reduce((acc: any, day: any, index: number) => {
|
| 80 |
Object.entries(day.categories).forEach(([cat, count]: [string, any]) => {
|
| 81 |
if (!acc[cat]) acc[cat] = { total: 0, weekly: 0, previous: 0 };
|
| 82 |
acc[cat].total += count;
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
if (index >= daily.length - 7) {
|
| 86 |
-
acc[cat].weekly += count;
|
| 87 |
-
} else {
|
| 88 |
-
acc[cat].previous += count;
|
| 89 |
-
}
|
| 90 |
});
|
| 91 |
return acc;
|
| 92 |
}, {});
|
|
@@ -96,49 +112,19 @@ export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspac
|
|
| 96 |
const weeklyAvg = data.weekly / 7;
|
| 97 |
const prevAvg = data.previous / 23;
|
| 98 |
const ratio = prevAvg > 0 ? weeklyAvg / prevAvg : (data.weekly > 0 ? 2 : 1);
|
| 99 |
-
|
| 100 |
let velocity: 'surge' | 'stable' | 'declining' = 'stable';
|
| 101 |
if (ratio > 1.25) velocity = 'surge';
|
| 102 |
else if (ratio < 0.75) velocity = 'declining';
|
| 103 |
-
|
| 104 |
return { name, count: data.total, velocity, ratio };
|
| 105 |
})
|
| 106 |
.sort((a, b) => b.count - a.count)
|
| 107 |
.slice(0, 5);
|
| 108 |
|
| 109 |
-
const maxCatCount = Math.max(...sortedCategories.map(c => c.count), 1);
|
| 110 |
-
|
| 111 |
-
// 2. Performance Vitals
|
| 112 |
const vitals = [
|
| 113 |
-
{
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
icon: <Activity />,
|
| 118 |
-
color: "#3B82F6",
|
| 119 |
-
trend: dailyVolumes
|
| 120 |
-
},
|
| 121 |
-
{
|
| 122 |
-
label: "SLA COMPLIANCE",
|
| 123 |
-
value: `${((sla?.sla_compliance_rate || 0) * 100).toFixed(0)}%`,
|
| 124 |
-
sub: `${sla?.on_time_tickets} On Time`,
|
| 125 |
-
icon: <Shield />,
|
| 126 |
-
color: "#10B981"
|
| 127 |
-
},
|
| 128 |
-
{
|
| 129 |
-
label: "AVG RESOLUTION",
|
| 130 |
-
value: `${stats?.performance?.avg_resolution_hours || 0}h`,
|
| 131 |
-
sub: "Lead Time",
|
| 132 |
-
icon: <Clock />,
|
| 133 |
-
color: "#8B5CF6"
|
| 134 |
-
},
|
| 135 |
-
{
|
| 136 |
-
label: "SERVICE CSAT",
|
| 137 |
-
value: stats?.performance?.csat_score ?? 0.0,
|
| 138 |
-
sub: "User Sentiment",
|
| 139 |
-
icon: <MessageSquare />,
|
| 140 |
-
color: "#F59E0B"
|
| 141 |
-
},
|
| 142 |
];
|
| 143 |
|
| 144 |
return (
|
|
@@ -146,146 +132,156 @@ export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspac
|
|
| 146 |
{/* 1. Global Vitals Row */}
|
| 147 |
<div className={styles.vitalsRow}>
|
| 148 |
{vitals.map(v => (
|
| 149 |
-
<div
|
| 150 |
-
|
| 151 |
-
|
| 152 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 153 |
<div className={styles.vitalMeta}>
|
| 154 |
<span className={styles.vitalLabel}>{v.label}</span>
|
| 155 |
<span className={styles.vitalValue}>{v.value}</span>
|
| 156 |
<span className={styles.vitalSub}>{v.sub}</span>
|
| 157 |
</div>
|
| 158 |
-
{v.trend &&
|
| 159 |
-
|
| 160 |
-
<MiniTrend data={v.trend} color={v.color} />
|
| 161 |
-
</div>
|
| 162 |
-
)}
|
| 163 |
-
</div>
|
| 164 |
))}
|
| 165 |
</div>
|
| 166 |
|
| 167 |
-
|
| 168 |
-
|
| 169 |
-
|
| 170 |
-
<div className={styles.sentinelArea}>
|
| 171 |
<div className={styles.cardHeader}>
|
| 172 |
<Cpu className={styles.headerIcon} />
|
| 173 |
<div className={styles.headerText}>
|
| 174 |
<h3>SENTINEL AI INSIGHTS</h3>
|
| 175 |
-
<span>Autonomous
|
| 176 |
</div>
|
| 177 |
-
{aiLoading && <div className={styles.miniSpinner} />}
|
| 178 |
</div>
|
| 179 |
-
|
| 180 |
-
|
| 181 |
-
|
| 182 |
-
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
-
<
|
| 190 |
-
{insights?.actions.map((action: string, i: number) => (
|
| 191 |
-
<div key={i} className={styles.actionItem}>
|
| 192 |
-
<div className={styles.actionBullet}>{i + 1}</div>
|
| 193 |
-
<p>{action}</p>
|
| 194 |
-
</div>
|
| 195 |
-
))}
|
| 196 |
</div>
|
| 197 |
-
)}
|
| 198 |
</div>
|
| 199 |
</div>
|
|
|
|
| 200 |
|
| 201 |
-
|
| 202 |
-
|
|
|
|
| 203 |
<div className={styles.cardHeader}>
|
| 204 |
-
<
|
| 205 |
<div className={styles.headerText}>
|
| 206 |
<h3>OPERATIONAL INTENSITY</h3>
|
| 207 |
-
<span>Category Mix (30D)</span>
|
| 208 |
</div>
|
| 209 |
</div>
|
| 210 |
-
|
| 211 |
-
|
| 212 |
-
<div className={styles.
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
<
|
| 216 |
-
PEAK: {Math.max(...dailyVolumes)}
|
| 217 |
-
</label>
|
| 218 |
-
</div>
|
| 219 |
-
<div style={{ height: 50 }}>
|
| 220 |
-
<svg width="100%" height="50" viewBox={`0 0 300 50`} preserveAspectRatio="none">
|
| 221 |
-
<motion.path
|
| 222 |
-
d={`M ${dailyVolumes.map((v, i) => `${(i / 29) * 300},${50 - (v / Math.max(...dailyVolumes, 1)) * 50}`).join(' L ')}`}
|
| 223 |
-
fill="none"
|
| 224 |
-
stroke="#3B82F6"
|
| 225 |
-
strokeWidth="2"
|
| 226 |
-
initial={{ pathLength: 0 }}
|
| 227 |
-
animate={{ pathLength: 1 }}
|
| 228 |
-
transition={{ duration: 1.5, ease: "easeInOut" }}
|
| 229 |
-
/>
|
| 230 |
-
<motion.path
|
| 231 |
-
d={`M ${dailyVolumes.map((v, i) => `${(i / 29) * 300},${50 - (v / Math.max(...dailyVolumes, 1)) * 50}`).join(' L ')} L 300,50 L 0,50 Z`}
|
| 232 |
-
fill="rgba(59, 130, 246, 0.1)"
|
| 233 |
-
initial={{ opacity: 0 }}
|
| 234 |
-
animate={{ opacity: 1 }}
|
| 235 |
-
transition={{ delay: 1, duration: 1 }}
|
| 236 |
-
/>
|
| 237 |
-
</svg>
|
| 238 |
-
</div>
|
| 239 |
-
</div>
|
| 240 |
-
|
| 241 |
-
{sortedCategories.map(c => (
|
| 242 |
-
<div key={c.name} className={styles.categoryBarRow}>
|
| 243 |
-
<div className={styles.categoryLabel}>
|
| 244 |
-
<div style={{ display: 'flex', alignItems: 'center' }}>
|
| 245 |
<span>{c.name}</span>
|
| 246 |
-
<span className={`${styles.velocityBadge} ${styles[c.velocity]}`}>
|
| 247 |
-
{c.velocity}
|
| 248 |
-
</span>
|
| 249 |
</div>
|
| 250 |
-
<
|
| 251 |
</div>
|
| 252 |
-
|
| 253 |
-
|
| 254 |
-
className={styles.barFill}
|
| 255 |
-
style={{ width: `${(c.count / maxCatCount) * 100}%` }}
|
| 256 |
-
/>
|
| 257 |
-
</div>
|
| 258 |
-
</div>
|
| 259 |
-
))}
|
| 260 |
</div>
|
| 261 |
</div>
|
| 262 |
|
| 263 |
-
{/* 4.
|
| 264 |
-
<div className={styles.
|
| 265 |
<div className={styles.cardHeader}>
|
| 266 |
-
<
|
| 267 |
<div className={styles.headerText}>
|
| 268 |
-
<h3>
|
| 269 |
-
<span>
|
| 270 |
</div>
|
| 271 |
</div>
|
| 272 |
-
|
| 273 |
-
|
| 274 |
-
|
| 275 |
-
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
|
| 279 |
-
|
| 280 |
-
|
| 281 |
-
|
| 282 |
-
|
| 283 |
-
|
| 284 |
-
|
|
|
|
|
|
|
|
|
|
| 285 |
</div>
|
| 286 |
</div>
|
| 287 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 288 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 289 |
</div>
|
| 290 |
</div>
|
| 291 |
);
|
|
|
|
| 1 |
+
const AreaTrend = ({
|
| 2 |
+
data,
|
| 3 |
+
valueKey,
|
| 4 |
+
color = "#3B82F6",
|
| 5 |
+
height = 60,
|
| 6 |
+
staffNames = []
|
| 7 |
+
}: {
|
| 8 |
+
data: any[],
|
| 9 |
+
valueKey: string,
|
| 10 |
+
color?: string,
|
| 11 |
+
height?: number,
|
| 12 |
+
staffNames?: string[]
|
| 13 |
+
}) => {
|
| 14 |
+
if (!data || data.length < 2) return <div style={{ height, background: 'rgba(255,255,255,0.02)', borderRadius: 8 }} />;
|
| 15 |
+
|
| 16 |
+
const width = 400;
|
| 17 |
+
// Aggregate totals for the baseline trend, or handle specific keys
|
| 18 |
+
const getPoints = (name?: string) => {
|
| 19 |
+
const rawValues = data.map(d => {
|
| 20 |
+
const val = d[valueKey];
|
| 21 |
+
if (name) {
|
| 22 |
+
return (typeof val === 'object' && val !== null) ? (val[name] || 0) : 0;
|
| 23 |
+
}
|
| 24 |
+
if (typeof val === 'number') return val;
|
| 25 |
+
return Object.values(val || {}).reduce((a: any, b: any) => (a as number) + (b as number), 0) as number;
|
| 26 |
+
});
|
| 27 |
+
const max = Math.max(...rawValues, 1);
|
| 28 |
+
return rawValues.map((v, i) => `${(i / (data.length - 1)) * width},${height - (v / max) * height}`).join(' L ');
|
| 29 |
+
};
|
| 30 |
|
| 31 |
+
const mainPoints = getPoints();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
|
| 33 |
return (
|
| 34 |
+
<div className={styles.areaTrendWrapper} style={{ height }}>
|
| 35 |
+
<svg width="100%" height={height} viewBox={`0 0 ${width} ${height}`} preserveAspectRatio="none">
|
| 36 |
+
{/* Subtle background lines for staff if provided */}
|
| 37 |
+
{staffNames.slice(0, 3).map((name, i) => (
|
| 38 |
+
<motion.path
|
| 39 |
+
key={name}
|
| 40 |
+
d={`M ${getPoints(name)}`}
|
| 41 |
+
fill="none"
|
| 42 |
+
stroke={color}
|
| 43 |
+
strokeWidth="1"
|
| 44 |
+
opacity={0.1 + (i * 0.05)}
|
| 45 |
+
initial={{ pathLength: 0 }}
|
| 46 |
+
animate={{ pathLength: 1 }}
|
| 47 |
+
transition={{ duration: 2, delay: i * 0.2 }}
|
| 48 |
+
/>
|
| 49 |
+
))}
|
| 50 |
+
{/* Main aggregate trend */}
|
| 51 |
+
<motion.path
|
| 52 |
+
d={`M ${mainPoints}`}
|
| 53 |
fill="none"
|
| 54 |
stroke={color}
|
| 55 |
+
strokeWidth="2.5"
|
| 56 |
+
initial={{ pathLength: 0 }}
|
| 57 |
+
animate={{ pathLength: 1 }}
|
| 58 |
+
transition={{ duration: 1.5, ease: "easeInOut" }}
|
| 59 |
+
/>
|
| 60 |
+
<motion.path
|
| 61 |
+
d={`M ${mainPoints} L ${width},${height} L 0,${height} Z`}
|
| 62 |
+
fill={`url(#gradient-${color.replace('#', '')})`}
|
| 63 |
+
initial={{ opacity: 0 }}
|
| 64 |
+
animate={{ opacity: 1 }}
|
| 65 |
+
transition={{ delay: 1, duration: 1 }}
|
| 66 |
/>
|
| 67 |
+
<defs>
|
| 68 |
+
<linearGradient id={`gradient-${color.replace('#', '')}`} x1="0" y1="0" x2="0" y2="1">
|
| 69 |
+
<stop offset="0%" stopColor={color} stopOpacity="0.2" />
|
| 70 |
+
<stop offset="100%" stopColor={color} stopOpacity="0" />
|
| 71 |
+
</linearGradient>
|
| 72 |
+
</defs>
|
| 73 |
</svg>
|
| 74 |
</div>
|
| 75 |
);
|
|
|
|
| 77 |
|
| 78 |
export const AnalyticsDashboard: React.FC<AnalyticsDashboardProps> = ({ workspaceId, readOnly }) => {
|
| 79 |
const { stats, loading: statsLoading } = useDashboardStats(workspaceId);
|
| 80 |
+
const { daily, sla, staff, escalations, loading: reportsLoading } = useReports(workspaceId);
|
| 81 |
const { audit, loading: escLoading } = useEscalations(workspaceId);
|
| 82 |
const { insights, loading: aiLoading } = useAIInsights(workspaceId);
|
| 83 |
const { narrative, loading: narrativeLoading } = useServiceNarrative(workspaceId);
|
|
|
|
| 89 |
return (
|
| 90 |
<div className={styles.loadingContainer}>
|
| 91 |
<div className={styles.loadingPulse} />
|
| 92 |
+
<div className={styles.loadingGlow} />
|
| 93 |
+
<span>Synchronizing Neural Analytics Grid...</span>
|
| 94 |
</div>
|
| 95 |
);
|
| 96 |
}
|
| 97 |
|
| 98 |
+
// Process Category Intensity
|
| 99 |
const dailyVolumes = daily.map(d => d.total);
|
|
|
|
| 100 |
const categories = daily.reduce((acc: any, day: any, index: number) => {
|
| 101 |
Object.entries(day.categories).forEach(([cat, count]: [string, any]) => {
|
| 102 |
if (!acc[cat]) acc[cat] = { total: 0, weekly: 0, previous: 0 };
|
| 103 |
acc[cat].total += count;
|
| 104 |
+
if (index >= daily.length - 7) acc[cat].weekly += count;
|
| 105 |
+
else acc[cat].previous += count;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 106 |
});
|
| 107 |
return acc;
|
| 108 |
}, {});
|
|
|
|
| 112 |
const weeklyAvg = data.weekly / 7;
|
| 113 |
const prevAvg = data.previous / 23;
|
| 114 |
const ratio = prevAvg > 0 ? weeklyAvg / prevAvg : (data.weekly > 0 ? 2 : 1);
|
|
|
|
| 115 |
let velocity: 'surge' | 'stable' | 'declining' = 'stable';
|
| 116 |
if (ratio > 1.25) velocity = 'surge';
|
| 117 |
else if (ratio < 0.75) velocity = 'declining';
|
|
|
|
| 118 |
return { name, count: data.total, velocity, ratio };
|
| 119 |
})
|
| 120 |
.sort((a, b) => b.count - a.count)
|
| 121 |
.slice(0, 5);
|
| 122 |
|
|
|
|
|
|
|
|
|
|
| 123 |
const vitals = [
|
| 124 |
+
{ label: "TOTAL TICKETS (30D)", value: stats?.total_tickets || 0, sub: "Active Stream", icon: <Activity />, color: "#3B82F6", trend: dailyVolumes },
|
| 125 |
+
{ label: "SLA COMPLIANCE", value: `${((sla?.sla_compliance_rate || 0) * 100).toFixed(0)}%`, sub: `${sla?.on_time_tickets} On Time`, icon: <Shield />, color: "#10B981" },
|
| 126 |
+
{ label: "AVG RESOLUTION", value: `${stats?.performance?.avg_resolution_hours || 0}h`, sub: "Lead Time", icon: <Clock />, color: "#8B5CF6" },
|
| 127 |
+
{ label: "SERVICE CSAT", value: stats?.performance?.csat_score ?? 0.0, sub: "User Sentiment", icon: <MessageSquare />, color: "#F59E0B" },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 128 |
];
|
| 129 |
|
| 130 |
return (
|
|
|
|
| 132 |
{/* 1. Global Vitals Row */}
|
| 133 |
<div className={styles.vitalsRow}>
|
| 134 |
{vitals.map(v => (
|
| 135 |
+
<motion.div
|
| 136 |
+
key={v.label}
|
| 137 |
+
className={styles.vitalCard}
|
| 138 |
+
initial={{ opacity: 0, y: 20 }}
|
| 139 |
+
animate={{ opacity: 1, y: 0 }}
|
| 140 |
+
transition={{ duration: 0.4 }}
|
| 141 |
+
>
|
| 142 |
+
<div className={styles.vitalIcon} style={{ background: `${v.color}20`, color: v.color }}>{v.icon}</div>
|
| 143 |
<div className={styles.vitalMeta}>
|
| 144 |
<span className={styles.vitalLabel}>{v.label}</span>
|
| 145 |
<span className={styles.vitalValue}>{v.value}</span>
|
| 146 |
<span className={styles.vitalSub}>{v.sub}</span>
|
| 147 |
</div>
|
| 148 |
+
{v.trend && <MiniTrend data={v.trend} color={v.color} />}
|
| 149 |
+
</motion.div>
|
|
|
|
|
|
|
|
|
|
|
|
|
| 150 |
))}
|
| 151 |
</div>
|
| 152 |
|
| 153 |
+
{/* 2. Sentinel AI Intelligence (Core Block) */}
|
| 154 |
+
<div className={styles.sentinelMaster}>
|
| 155 |
+
<div className={styles.sentinelBody}>
|
|
|
|
| 156 |
<div className={styles.cardHeader}>
|
| 157 |
<Cpu className={styles.headerIcon} />
|
| 158 |
<div className={styles.headerText}>
|
| 159 |
<h3>SENTINEL AI INSIGHTS</h3>
|
| 160 |
+
<span>Autonomous High-Fidelity Service Narrative</span>
|
| 161 |
</div>
|
|
|
|
| 162 |
</div>
|
| 163 |
+
<div className={styles.narrativeBox}>
|
| 164 |
+
<ReactMarkdown>{narrative?.insights || "Analyzing service patterns... neural pathways converging."}</ReactMarkdown>
|
| 165 |
+
</div>
|
| 166 |
+
</div>
|
| 167 |
+
<div className={styles.strategicActions}>
|
| 168 |
+
<label><TrendingUp size={12} /> STRATEGIC ACTIONS</label>
|
| 169 |
+
<div className={styles.actionList}>
|
| 170 |
+
{insights?.actions.slice(0, 3).map((action: string, i: number) => (
|
| 171 |
+
<div key={i} className={styles.actionItem}>
|
| 172 |
+
<div className={styles.actionBullet}>{i + 1}</div>
|
| 173 |
+
<p>{action}</p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
</div>
|
| 175 |
+
))}
|
| 176 |
</div>
|
| 177 |
</div>
|
| 178 |
+
</div>
|
| 179 |
|
| 180 |
+
<div className={styles.intelligenceGrid}>
|
| 181 |
+
{/* 3. Operational Intensity */}
|
| 182 |
+
<div className={styles.gridCard}>
|
| 183 |
<div className={styles.cardHeader}>
|
| 184 |
+
<Activity size={16} className={styles.headerIcon} />
|
| 185 |
<div className={styles.headerText}>
|
| 186 |
<h3>OPERATIONAL INTENSITY</h3>
|
| 187 |
+
<span>Category Mix & Volume (30D)</span>
|
| 188 |
</div>
|
| 189 |
</div>
|
| 190 |
+
<div className={styles.cardBody}>
|
| 191 |
+
<AreaTrend data={daily} valueKey="total" height={80} color="#3B82F6" />
|
| 192 |
+
<div className={styles.categoryStack}>
|
| 193 |
+
{sortedCategories.map(c => (
|
| 194 |
+
<div key={c.name} className={styles.categoryRow}>
|
| 195 |
+
<div className={styles.catLabelRow}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
<span>{c.name}</span>
|
| 197 |
+
<span className={`${styles.velocityBadge} ${styles[c.velocity]}`}>{c.velocity}</span>
|
|
|
|
|
|
|
| 198 |
</div>
|
| 199 |
+
<div className={styles.catBarBack}><div className={styles.catBarFill} style={{ width: `${(c.ratio / 2) * 100}%` }} /></div>
|
| 200 |
</div>
|
| 201 |
+
))}
|
| 202 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
</div>
|
| 204 |
</div>
|
| 205 |
|
| 206 |
+
{/* 4. Staff Performance Velocity */}
|
| 207 |
+
<div className={styles.gridCard}>
|
| 208 |
<div className={styles.cardHeader}>
|
| 209 |
+
<TrendingUp size={16} className={styles.headerIcon} />
|
| 210 |
<div className={styles.headerText}>
|
| 211 |
+
<h3>TALENT RESOLUTION VELOCITY</h3>
|
| 212 |
+
<span>Throughput Trend by Assignee</span>
|
| 213 |
</div>
|
| 214 |
</div>
|
| 215 |
+
<div className={styles.cardBody}>
|
| 216 |
+
<AreaTrend
|
| 217 |
+
data={staff?.trend || []}
|
| 218 |
+
valueKey="performance"
|
| 219 |
+
staffNames={staff?.staff_names}
|
| 220 |
+
height={80}
|
| 221 |
+
color="#10B981"
|
| 222 |
+
/>
|
| 223 |
+
<div className={styles.staffMeta}>
|
| 224 |
+
{staff?.staff_names.slice(0, 4).map(name => (
|
| 225 |
+
<div key={name} className={styles.staffPill}>
|
| 226 |
+
<div className={styles.staffDot} /> {name.split(' ')[0].toUpperCase()}
|
| 227 |
+
</div>
|
| 228 |
+
))}
|
| 229 |
+
<span className={styles.moreStaff}>+{Math.max(0, (staff?.staff_names.length || 0) - 4)} OTHERS</span>
|
| 230 |
+
</div>
|
| 231 |
</div>
|
| 232 |
</div>
|
| 233 |
|
| 234 |
+
{/* 5. Escalation Thermal Load */}
|
| 235 |
+
<div className={styles.gridCard}>
|
| 236 |
+
<div className={styles.cardHeader}>
|
| 237 |
+
<Shield size={16} className={styles.headerIcon} />
|
| 238 |
+
<div className={styles.headerText}>
|
| 239 |
+
<h3>ESCALATION THERMAL LOAD</h3>
|
| 240 |
+
<span>Hotspot Analysis by Personnel</span>
|
| 241 |
+
</div>
|
| 242 |
+
</div>
|
| 243 |
+
<div className={styles.cardBody}>
|
| 244 |
+
<AreaTrend
|
| 245 |
+
data={escalations?.trend || []}
|
| 246 |
+
valueKey="escalations"
|
| 247 |
+
staffNames={escalations?.staff_names}
|
| 248 |
+
height={80}
|
| 249 |
+
color="#F59E0B"
|
| 250 |
+
/>
|
| 251 |
+
<div className={styles.auditMiniList}>
|
| 252 |
+
{audit.slice(0, 3).map(a => (
|
| 253 |
+
<div key={a.id} className={styles.auditMiniItem}>
|
| 254 |
+
<div className={styles.auditTime}>{new Date(a.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}</div>
|
| 255 |
+
<div className={styles.auditDesc}>Escalated #{a.entity_id.slice(0,6)}</div>
|
| 256 |
+
</div>
|
| 257 |
+
))}
|
| 258 |
+
</div>
|
| 259 |
+
</div>
|
| 260 |
+
</div>
|
| 261 |
|
| 262 |
+
{/* 6. Strategic Audit Ledger */}
|
| 263 |
+
<div className={styles.gridCard}>
|
| 264 |
+
<div className={styles.cardHeader}>
|
| 265 |
+
<Terminal size={16} className={styles.headerIcon} />
|
| 266 |
+
<div className={styles.headerText}>
|
| 267 |
+
<h3>STRATEGIC AUDIT LEDGER</h3>
|
| 268 |
+
<span>Real-time Workspace Activity Feed</span>
|
| 269 |
+
</div>
|
| 270 |
+
</div>
|
| 271 |
+
<div className={styles.cardBody}>
|
| 272 |
+
<div className={styles.ledgerList}>
|
| 273 |
+
{audit.slice(0, 6).map(entry => (
|
| 274 |
+
<div key={entry.id} className={styles.ledgerItem}>
|
| 275 |
+
<div className={styles.ledgerMeta}>
|
| 276 |
+
<span className={styles.ledgerAction}>{entry.action.replace('_', ' ')}</span>
|
| 277 |
+
<span className={styles.ledgerTime}>{new Date(entry.created_at).toLocaleDateString()}</span>
|
| 278 |
+
</div>
|
| 279 |
+
<p>Modified object {entry.entity_id.slice(0, 8)}</p>
|
| 280 |
+
</div>
|
| 281 |
+
))}
|
| 282 |
+
</div>
|
| 283 |
+
</div>
|
| 284 |
+
</div>
|
| 285 |
</div>
|
| 286 |
</div>
|
| 287 |
);
|
frontend/apps/internal/src/components/TicketDetails.module.css
CHANGED
|
@@ -1106,11 +1106,58 @@
|
|
| 1106 |
flex-direction: column;
|
| 1107 |
align-items: center;
|
| 1108 |
justify-content: center;
|
| 1109 |
-
|
| 1110 |
-
|
| 1111 |
-
|
| 1112 |
-
|
| 1113 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1114 |
}
|
| 1115 |
|
| 1116 |
.neuralPulse {
|
|
|
|
| 1106 |
flex-direction: column;
|
| 1107 |
align-items: center;
|
| 1108 |
justify-content: center;
|
| 1109 |
+
padding: 40px 20px;
|
| 1110 |
+
text-align: center;
|
| 1111 |
+
min-height: 200px;
|
| 1112 |
+
}
|
| 1113 |
+
|
| 1114 |
+
.initialAnalysisBox {
|
| 1115 |
+
display: flex;
|
| 1116 |
+
flex-direction: column;
|
| 1117 |
+
gap: 24px;
|
| 1118 |
+
padding: 8px;
|
| 1119 |
+
animation: fadeIn 0.5s ease-out;
|
| 1120 |
+
}
|
| 1121 |
+
|
| 1122 |
+
.analysisModule {
|
| 1123 |
+
display: flex;
|
| 1124 |
+
flex-direction: column;
|
| 1125 |
+
gap: 8px;
|
| 1126 |
+
}
|
| 1127 |
+
|
| 1128 |
+
.analysisModule label {
|
| 1129 |
+
font-size: 10px;
|
| 1130 |
+
font-weight: 900;
|
| 1131 |
+
color: var(--primary);
|
| 1132 |
+
letter-spacing: 0.15em;
|
| 1133 |
+
text-transform: uppercase;
|
| 1134 |
+
opacity: 0.8;
|
| 1135 |
+
}
|
| 1136 |
+
|
| 1137 |
+
.analysisModule p {
|
| 1138 |
+
font-size: 14px;
|
| 1139 |
+
line-height: 1.6;
|
| 1140 |
+
color: #1e293b;
|
| 1141 |
+
margin: 0;
|
| 1142 |
+
font-weight: 500;
|
| 1143 |
+
}
|
| 1144 |
+
|
| 1145 |
+
.analysisFooter {
|
| 1146 |
+
margin-top: 12px;
|
| 1147 |
+
padding-top: 16px;
|
| 1148 |
+
border-top: 1px dashed rgba(0, 0, 0, 0.05);
|
| 1149 |
+
font-size: 11px;
|
| 1150 |
+
font-weight: 700;
|
| 1151 |
+
color: #64748b;
|
| 1152 |
+
display: flex;
|
| 1153 |
+
align-items: center;
|
| 1154 |
+
gap: 8px;
|
| 1155 |
+
font-style: italic;
|
| 1156 |
+
}
|
| 1157 |
+
|
| 1158 |
+
@keyframes fadeIn {
|
| 1159 |
+
from { opacity: 0; transform: translateY(5px); }
|
| 1160 |
+
to { opacity: 1; transform: translateY(0); }
|
| 1161 |
}
|
| 1162 |
|
| 1163 |
.neuralPulse {
|
frontend/apps/internal/src/components/TicketDetails.tsx
CHANGED
|
@@ -85,7 +85,7 @@ interface TicketDetailsProps {
|
|
| 85 |
const StatusBadge: React.FC<{ status: string }> = ({ status }) => {
|
| 86 |
const s = status?.toLowerCase() || 'open';
|
| 87 |
const getStatusConfig = (val: string) => {
|
| 88 |
-
switch(val) {
|
| 89 |
case 'open': return { color: 'var(--text-dim)', bg: 'rgba(100, 116, 139, 0.1)' };
|
| 90 |
case 'acknowledged': return { color: 'var(--primary)', bg: 'rgba(124, 58, 237, 0.1)' };
|
| 91 |
case 'in_progress': return { color: '#2563eb', bg: 'rgba(37, 99, 235, 0.1)' };
|
|
@@ -95,7 +95,7 @@ const StatusBadge: React.FC<{ status: string }> = ({ status }) => {
|
|
| 95 |
}
|
| 96 |
};
|
| 97 |
const config = getStatusConfig(s);
|
| 98 |
-
|
| 99 |
return (
|
| 100 |
<div style={{
|
| 101 |
display: 'inline-flex',
|
|
@@ -138,17 +138,17 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 138 |
const [ticketAttachments, setTicketAttachments] = useState<Attachment[]>([]);
|
| 139 |
const [isReopening, setIsReopening] = useState(false);
|
| 140 |
const [isSummarizing, setIsSummarizing] = useState(false);
|
| 141 |
-
|
| 142 |
// --- MENTION SYSTEM STATE ---
|
| 143 |
const [showMentionList, setShowMentionList] = useState(false);
|
| 144 |
const [mentionQuery, setMentionQuery] = useState("");
|
| 145 |
const [mentionTarget, setMentionTarget] = useState<'reply' | 'scratchpad' | null>(null);
|
| 146 |
const [selectedMentionIndex, setSelectedMentionIndex] = useState(0);
|
| 147 |
const [cursorPos, setCursorPos] = useState(0);
|
| 148 |
-
|
| 149 |
const filteredUsers = useMemo(() => {
|
| 150 |
if (!mentionQuery) return internalUsers.slice(0, 5);
|
| 151 |
-
return internalUsers.filter(u =>
|
| 152 |
u.full_name?.toLowerCase().includes(mentionQuery.toLowerCase())
|
| 153 |
).slice(0, 5);
|
| 154 |
}, [internalUsers, mentionQuery]);
|
|
@@ -189,12 +189,12 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 189 |
setTicket(t);
|
| 190 |
setResolutionDraft(t.resolution_text || "");
|
| 191 |
setAssigneeSearch(t.assigned_name || "Unassigned");
|
| 192 |
-
|
| 193 |
// Pre-populate scratchpad with backend-drafted internal solution if empty
|
| 194 |
if (!scratchpadText) {
|
| 195 |
setScratchpadText(t.ai_metadata?.summaries?.internal_summary || t.ai_metadata?.summaries?.customer_summary || "");
|
| 196 |
}
|
| 197 |
-
|
| 198 |
api.get(`tickets/${t.id}/attachments/`).then(res => setTicketAttachments(res.data));
|
| 199 |
}
|
| 200 |
if (messagesResp.status === 'fulfilled') setMessages(messagesResp.value.data);
|
|
@@ -284,7 +284,7 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 284 |
if (autocompleteRef.current && !autocompleteRef.current.contains(event.target as Node)) {
|
| 285 |
setShowAssigneeSuggestions(false);
|
| 286 |
}
|
| 287 |
-
|
| 288 |
// Close property strip slots if clicking outside
|
| 289 |
if (activeEditingSlot && !(event.target as HTMLElement).closest(`.${styles.propertySlot}`)) {
|
| 290 |
setActiveEditingSlot(null);
|
|
@@ -303,7 +303,7 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 303 |
const handleSocketUpdate = (event: any) => {
|
| 304 |
const data = event.detail;
|
| 305 |
if (data?.event === 'summary_updated' && data?.ticket_id === initialTicket?.id) {
|
| 306 |
-
|
| 307 |
}
|
| 308 |
};
|
| 309 |
window.addEventListener('nexus-live-event', handleSocketUpdate);
|
|
@@ -320,10 +320,16 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 320 |
|
| 321 |
if (!ticket) return null;
|
| 322 |
|
| 323 |
-
const hasAIInsight = !!(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
const internalSummary = ticket?.ai_metadata?.summaries?.internal_summary ||
|
| 325 |
ticket?.ai_metadata?.summaries?.customer_summary ||
|
| 326 |
-
auditTrail.find(a => a.output_data?.internal_summary)?.output_data?.internal_summary;
|
|
|
|
| 327 |
|
| 328 |
const handleUpdateStatus = async (newStatus: string) => {
|
| 329 |
const isFinal = ['RESOLVED', 'CLOSED'].includes(newStatus.toUpperCase());
|
|
@@ -444,7 +450,7 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 444 |
setIsGenerating(true);
|
| 445 |
const intent = rightSidebarTab === 'notes' ? "SYSTEM_INTERNAL_NOTE" : "CUSTOMER_PUBLIC_REPLY";
|
| 446 |
const lastMsg = messages.slice(-1)[0]?.content || "No recent messages.";
|
| 447 |
-
|
| 448 |
try {
|
| 449 |
const resp = await api.post('nexus/query', {
|
| 450 |
query: `Generate a ${intent === 'SYSTEM_INTERNAL_NOTE' ? 'concise technical internal note summarizing the current state and next steps' : 'professional, empathetic customer reply addressing the user concern'}.
|
|
@@ -494,9 +500,9 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 494 |
before.pop(); // Remove the @query part
|
| 495 |
const beforeStr = before.join(' ');
|
| 496 |
const afterStr = value.slice(cursorPos);
|
| 497 |
-
|
| 498 |
const newValue = `${beforeStr}${beforeStr ? ' ' : ''}@${user.full_name} ${afterStr}`;
|
| 499 |
-
|
| 500 |
if (mentionTarget === 'reply') setReplyText(newValue);
|
| 501 |
else setScratchpadText(newValue);
|
| 502 |
|
|
@@ -607,41 +613,41 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 607 |
return (
|
| 608 |
<>
|
| 609 |
<div className={styles.container}>
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
|
| 615 |
-
|
| 616 |
-
|
| 617 |
-
|
| 618 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 619 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 620 |
)}
|
| 621 |
</div>
|
| 622 |
-
</div>
|
| 623 |
|
| 624 |
-
|
| 625 |
-
{isEditingTitle ? (
|
| 626 |
-
<div className={styles.titleEditor}>
|
| 627 |
-
<input
|
| 628 |
-
className={styles.titleInput}
|
| 629 |
-
value={titleDraft}
|
| 630 |
-
onChange={(e) => setTitleDraft(e.target.value)}
|
| 631 |
-
autoFocus
|
| 632 |
-
/>
|
| 633 |
-
<button onClick={async () => { await handleUpdateField('title', titleDraft); setIsEditingTitle(false); }} className={styles.iconBtn}><ShieldCheck size={16} color="var(--success)" /></button>
|
| 634 |
-
<button onClick={() => setIsEditingTitle(false)} className={styles.iconBtn}><Trash2 size={16} color="var(--error)" /></button>
|
| 635 |
-
</div>
|
| 636 |
-
) : (
|
| 637 |
-
<h1 className={styles.mainTitle} onClick={() => { setTitleDraft(ticket.title); setIsEditingTitle(true); }}>
|
| 638 |
-
{ticket.title}
|
| 639 |
-
<Edit2 size={14} className={styles.editIcon} />
|
| 640 |
-
</h1>
|
| 641 |
-
)}
|
| 642 |
-
</div>
|
| 643 |
-
|
| 644 |
-
<div className={styles.headerActions}>
|
| 645 |
<div style={{ display: 'flex', gap: 4, marginRight: 12 }}>
|
| 646 |
<button className={styles.toggleBtn} onClick={() => setIsLeftOpen(!isLeftOpen)} title="Toggle Operations">
|
| 647 |
<PanelRight size={18} style={{ transform: 'rotate(180deg)' }} color={isLeftOpen ? 'var(--primary)' : 'var(--text-dim)'} />
|
|
@@ -659,506 +665,526 @@ export const TicketDetails: React.FC<TicketDetailsProps> = ({ initialTicket, onB
|
|
| 659 |
<button onClick={onBack} className={`${styles.btn} ${styles.btnSecondary}`} style={{ marginLeft: 8 }}>
|
| 660 |
<ChevronLeft size={16} /> BACK
|
| 661 |
</button>
|
| 662 |
-
</div>
|
| 663 |
-
</header>
|
| 664 |
-
|
| 665 |
-
<div className={styles.workspace}>
|
| 666 |
-
{/* Unified Property Strip */}
|
| 667 |
-
<div className={styles.propertyStrip}>
|
| 668 |
-
{/* Priority Slot */}
|
| 669 |
-
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'priority' ? null : 'priority')}>
|
| 670 |
-
<div className={styles.slotLabel}>TICKET PRIORITY</div>
|
| 671 |
-
<div className={styles.slotValueArea}>
|
| 672 |
-
<div className={styles.priorityDot} style={{ background: ticket.priority === 'P0' ? 'var(--error)' : ticket.priority === 'P1' ? '#f59e0b' : 'var(--primary)' }} />
|
| 673 |
-
{activeEditingSlot === 'priority' ? (
|
| 674 |
-
<select
|
| 675 |
-
className={styles.propertySelect}
|
| 676 |
-
value={ticket.priority}
|
| 677 |
-
autoFocus
|
| 678 |
-
onChange={(e) => { handleUpdatePriority(e.target.value); setActiveEditingSlot(null); }}
|
| 679 |
-
onClick={(e) => e.stopPropagation()}
|
| 680 |
-
>
|
| 681 |
-
<option value="P0">P0 - EMERGENCY</option>
|
| 682 |
-
<option value="P1">P1 - CRITICAL</option>
|
| 683 |
-
<option value="P2">P2 - MAJOR</option>
|
| 684 |
-
<option value="P3">P3 - MINOR</option>
|
| 685 |
-
</select>
|
| 686 |
-
) : (
|
| 687 |
-
<span className={styles.slotValue}>{ticket.priority}</span>
|
| 688 |
-
)}
|
| 689 |
-
</div>
|
| 690 |
</div>
|
| 691 |
-
|
| 692 |
-
|
| 693 |
-
|
| 694 |
-
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
|
| 698 |
-
|
| 699 |
-
|
| 700 |
-
|
| 701 |
-
|
| 702 |
-
|
|
|
|
|
|
|
| 703 |
autoFocus
|
| 704 |
-
onChange={(e) => {
|
| 705 |
-
|
| 706 |
-
|
| 707 |
-
|
| 708 |
-
|
| 709 |
-
<
|
| 710 |
-
|
| 711 |
-
|
| 712 |
-
|
| 713 |
-
|
| 714 |
-
|
| 715 |
-
|
| 716 |
-
</div>
|
| 717 |
-
)}
|
| 718 |
-
</div>
|
| 719 |
-
) : (
|
| 720 |
-
<span className={styles.slotValue}>{ticket.assigned_name || "Unassigned"}</span>
|
| 721 |
-
)}
|
| 722 |
-
</div>
|
| 723 |
-
</div>
|
| 724 |
-
|
| 725 |
-
{/* Status Slot */}
|
| 726 |
-
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'status' ? null : 'status')}>
|
| 727 |
-
<div className={styles.slotLabel}>OPERATIONAL STATUS</div>
|
| 728 |
-
<div className={styles.slotValueArea}>
|
| 729 |
-
{activeEditingSlot === 'status' ? (
|
| 730 |
-
<select
|
| 731 |
-
className={styles.propertySelect}
|
| 732 |
-
value={ticket.status}
|
| 733 |
-
autoFocus
|
| 734 |
-
onChange={(e) => { handleUpdateStatus(e.target.value); setActiveEditingSlot(null); }}
|
| 735 |
-
onClick={(e) => e.stopPropagation()}
|
| 736 |
-
>
|
| 737 |
-
<option value="OPEN">OPEN</option>
|
| 738 |
-
<option value="ACKNOWLEDGED">ACKNOWLEDGED</option>
|
| 739 |
-
<option value="IN_PROGRESS">IN_PROGRESS</option>
|
| 740 |
-
<option value="RESOLVED">RESOLVED</option>
|
| 741 |
-
<option value="CLOSED">CLOSED</option>
|
| 742 |
-
</select>
|
| 743 |
-
) : (
|
| 744 |
-
<StatusBadge status={ticket.status} />
|
| 745 |
-
)}
|
| 746 |
-
</div>
|
| 747 |
-
</div>
|
| 748 |
-
|
| 749 |
-
{/* ETA Slot */}
|
| 750 |
-
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'eta' ? null : 'eta')}>
|
| 751 |
-
<div className={styles.slotLabel}>ESTIMATED RESOLUTION</div>
|
| 752 |
-
<div className={styles.slotValueArea}>
|
| 753 |
-
{activeEditingSlot === 'eta' ? (
|
| 754 |
-
<input
|
| 755 |
-
className={styles.propertyInput}
|
| 756 |
-
value={ticket.eta || ""}
|
| 757 |
-
autoFocus
|
| 758 |
-
onChange={(e) => handleUpdateField('eta', e.target.value)}
|
| 759 |
-
onBlur={() => setActiveEditingSlot(null)}
|
| 760 |
-
onClick={(e) => e.stopPropagation()}
|
| 761 |
-
placeholder="e.g. 2h"
|
| 762 |
-
/>
|
| 763 |
-
) : (
|
| 764 |
-
<span className={styles.slotValue}>{formatETA(ticket.eta || "N/A")}</span>
|
| 765 |
-
)}
|
| 766 |
-
</div>
|
| 767 |
-
</div>
|
| 768 |
-
|
| 769 |
-
{/* Effort Slot */}
|
| 770 |
-
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'effort' ? null : 'effort')}>
|
| 771 |
-
<div className={styles.slotLabel}>ESTIMATED EFFORT</div>
|
| 772 |
-
<div className={styles.slotValueArea}>
|
| 773 |
-
{activeEditingSlot === 'effort' ? (
|
| 774 |
-
<input
|
| 775 |
-
className={styles.propertyInput}
|
| 776 |
-
value={ticket.estimated_effort || ""}
|
| 777 |
-
autoFocus
|
| 778 |
-
onChange={(e) => handleUpdateField('estimated_effort', e.target.value)}
|
| 779 |
-
onBlur={() => setActiveEditingSlot(null)}
|
| 780 |
-
onClick={(e) => e.stopPropagation()}
|
| 781 |
-
placeholder="e.g. 1d"
|
| 782 |
-
/>
|
| 783 |
-
) : (
|
| 784 |
-
<span className={styles.slotValue}>{ticket.estimated_effort || "N/A"}</span>
|
| 785 |
-
)}
|
| 786 |
</div>
|
| 787 |
-
</div>
|
| 788 |
-
</div>
|
| 789 |
|
| 790 |
-
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
| 795 |
-
|
| 796 |
-
|
| 797 |
-
|
| 798 |
-
|
| 799 |
-
|
| 800 |
-
|
| 801 |
-
|
| 802 |
-
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
<div
|
| 808 |
-
{
|
| 809 |
-
|
| 810 |
-
|
| 811 |
-
|
| 812 |
-
<
|
| 813 |
-
|
| 814 |
-
</span>
|
| 815 |
-
</div>
|
| 816 |
</div>
|
| 817 |
-
)
|
| 818 |
-
|
| 819 |
-
|
|
|
|
|
|
|
|
|
|
| 820 |
</div>
|
| 821 |
-
</div>
|
| 822 |
|
| 823 |
-
|
| 824 |
-
|
| 825 |
-
|
| 826 |
-
|
| 827 |
-
{
|
| 828 |
-
|
| 829 |
-
|
| 830 |
-
|
| 831 |
-
|
| 832 |
-
|
| 833 |
-
|
| 834 |
-
|
| 835 |
-
</
|
| 836 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 837 |
) : (
|
| 838 |
-
<
|
| 839 |
)}
|
|
|
|
| 840 |
</div>
|
| 841 |
-
</div>
|
| 842 |
|
| 843 |
-
|
| 844 |
-
|
| 845 |
-
|
| 846 |
-
|
| 847 |
-
|
| 848 |
-
|
| 849 |
-
|
| 850 |
-
|
| 851 |
-
|
| 852 |
-
|
| 853 |
-
|
| 854 |
-
|
| 855 |
-
|
| 856 |
-
|
| 857 |
-
|
| 858 |
-
|
| 859 |
-
|
| 860 |
-
</div>
|
| 861 |
-
</aside>
|
| 862 |
-
|
| 863 |
-
{/* Main Column (Primary Documentation Flow) */}
|
| 864 |
-
<main className={styles.mainContent}>
|
| 865 |
-
{/* AI Intelligence Summary (Prominent Top Area) */}
|
| 866 |
-
<div className={styles.aiIntelligenceCard}>
|
| 867 |
-
<div className={styles.aiHeader}>
|
| 868 |
-
<div className={styles.aiBadge}>
|
| 869 |
-
<Sparkles size={16} /> AI INTELLIGENCE SUMMARY
|
| 870 |
</div>
|
| 871 |
-
<button
|
| 872 |
-
onClick={async () => { setIsSummarizing(true); try { await api.post(`tickets/${ticket.id}/summarize/`); await refreshData(); } finally { setIsSummarizing(false); } }}
|
| 873 |
-
className={styles.btnSecondary}
|
| 874 |
-
style={{ padding: '6px 12px', fontSize: 10 }}
|
| 875 |
-
disabled={isSummarizing}
|
| 876 |
-
>
|
| 877 |
-
<RefreshCw size={12} className={isSummarizing ? styles.spin : ''} /> Regenerate
|
| 878 |
-
</button>
|
| 879 |
</div>
|
| 880 |
-
|
| 881 |
-
|
| 882 |
-
|
| 883 |
-
|
| 884 |
-
|
| 885 |
-
|
| 886 |
-
|
| 887 |
-
|
| 888 |
-
|
| 889 |
-
|
| 890 |
-
|
| 891 |
-
|
| 892 |
-
|
| 893 |
-
|
| 894 |
-
|
| 895 |
-
|
| 896 |
-
|
| 897 |
-
|
|
|
|
| 898 |
</div>
|
| 899 |
</div>
|
| 900 |
|
| 901 |
-
|
| 902 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 903 |
|
| 904 |
-
|
| 905 |
-
|
| 906 |
-
|
| 907 |
-
|
| 908 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
</div>
|
| 910 |
-
|
| 911 |
-
|
| 912 |
-
<
|
| 913 |
-
|
| 914 |
-
|
| 915 |
-
|
| 916 |
-
|
| 917 |
-
|
| 918 |
-
|
| 919 |
-
|
| 920 |
-
|
| 921 |
-
|
| 922 |
-
|
| 923 |
-
|
| 924 |
-
|
| 925 |
-
|
| 926 |
-
|
| 927 |
-
|
| 928 |
-
|
| 929 |
-
className={styles.descriptionTextarea}
|
| 930 |
-
value={descriptionDraft}
|
| 931 |
-
onChange={(e) => setDescriptionDraft(e.target.value)}
|
| 932 |
-
/>
|
| 933 |
-
<div className={styles.editorActions}>
|
| 934 |
-
<button onClick={() => setIsEditingDescription(false)} className={styles.btnSecondary}>Cancel</button>
|
| 935 |
-
<button onClick={async () => { await handleUpdateField('description', descriptionDraft); setIsEditingDescription(false); }} className={`${styles.btn} ${styles.btnPrimary}`}>Save</button>
|
| 936 |
-
</div>
|
| 937 |
-
</div>
|
| 938 |
-
) : (
|
| 939 |
-
<NexusMarkdown content={ticket.description || "No description provided."} />
|
| 940 |
-
)}
|
| 941 |
-
</div>
|
| 942 |
-
</section>
|
| 943 |
-
|
| 944 |
-
{/* Resolution Intelligence Documentation */}
|
| 945 |
-
{(ticket.resolution_text || ticket.status === 'RESOLVED') && (
|
| 946 |
-
<section className={styles.sectionBlock} style={{ marginTop: 32 }}>
|
| 947 |
-
<div className={styles.sectionTitle}>RESOLUTION INTELLIGENCE</div>
|
| 948 |
-
<div className={styles.resolutionCard}>
|
| 949 |
-
<div className={styles.aiHeader}>
|
| 950 |
-
<div className={styles.aiBadge} style={{ color: 'var(--success)' }}>
|
| 951 |
-
<ShieldCheck size={16} /> FINAL RESOLUTION VERIFIED
|
| 952 |
-
</div>
|
| 953 |
-
</div>
|
| 954 |
-
<div className={styles.intelligenceSurface}>
|
| 955 |
-
<div style={{ position: 'relative' }}>
|
| 956 |
-
<NexusMarkdown content={ticket.resolution_text || "Awaiting final documentation..."} />
|
| 957 |
-
{ticket.status === 'RESOLVED' && isStaff && (
|
| 958 |
-
<button
|
| 959 |
-
onClick={() => { setResolutionDraft(ticket.resolution_text || ""); setShowResolutionModal(true); }}
|
| 960 |
-
className={styles.btnSecondary}
|
| 961 |
-
style={{ position: 'absolute', top: -32, right: -12, fontSize: 10, padding: '4px 8px' }}
|
| 962 |
-
>Edit Resolution</button>
|
| 963 |
-
)}
|
| 964 |
-
</div>
|
| 965 |
-
</div>
|
| 966 |
</div>
|
| 967 |
-
</section>
|
| 968 |
-
)}
|
| 969 |
-
</main>
|
| 970 |
-
|
| 971 |
-
{/* Right Sidebar (Collaboration & History) */}
|
| 972 |
-
<aside className={`${styles.rightSidebar} ${!isRightOpen ? styles.rightSidebarCollapsed : ''}`}>
|
| 973 |
-
<div className={styles.sidebarTabs}>
|
| 974 |
-
<button
|
| 975 |
-
onClick={() => setRightSidebarTab('messages')}
|
| 976 |
-
className={`${styles.tabButton} ${rightSidebarTab === 'messages' ? styles.activeTab : ''}`}
|
| 977 |
-
>Messages</button>
|
| 978 |
-
<button
|
| 979 |
-
onClick={() => setRightSidebarTab('notes')}
|
| 980 |
-
className={`${styles.tabButton} ${rightSidebarTab === 'notes' ? styles.activeTab : ''}`}
|
| 981 |
-
>Internal Notes</button>
|
| 982 |
-
<button
|
| 983 |
-
onClick={() => setRightSidebarTab('history')}
|
| 984 |
-
className={`${styles.tabButton} ${rightSidebarTab === 'history' ? styles.activeTab : ''}`}
|
| 985 |
-
>History</button>
|
| 986 |
-
</div>
|
| 987 |
|
| 988 |
-
|
| 989 |
-
|
| 990 |
-
|
| 991 |
-
{
|
| 992 |
-
|
| 993 |
-
|
| 994 |
-
<div className={styles.
|
| 995 |
-
<div className={styles.
|
| 996 |
-
{
|
| 997 |
</div>
|
| 998 |
-
<div className={styles.
|
| 999 |
</div>
|
| 1000 |
-
|
| 1001 |
-
|
| 1002 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1003 |
</div>
|
| 1004 |
-
<div
|
| 1005 |
-
|
| 1006 |
-
{new Date(ev.time).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }).toUpperCase()}
|
| 1007 |
</div>
|
| 1008 |
</div>
|
| 1009 |
</div>
|
| 1010 |
-
)
|
| 1011 |
-
|
| 1012 |
-
<div className={styles.empty} style={{ padding: 24, textAlign: 'center' }}>No historical state shifts captured.</div>
|
| 1013 |
-
)}
|
| 1014 |
</div>
|
| 1015 |
-
) : (
|
| 1016 |
-
<>
|
| 1017 |
-
<div className={styles.messageThread} style={{ flex: 1, padding: 20 }}>
|
| 1018 |
-
{messages
|
| 1019 |
-
.filter(m => rightSidebarTab === 'notes' ? m.is_internal : !m.is_internal)
|
| 1020 |
-
.map((msg, i) => {
|
| 1021 |
-
const isMe = msg.sender_role !== 'customer';
|
| 1022 |
-
const isInternal = msg.is_internal;
|
| 1023 |
-
const timeStr = new Date(msg.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
| 1024 |
-
const isNoteBeingEdited = editingNoteId === msg.id;
|
| 1025 |
|
| 1026 |
-
|
| 1027 |
-
|
| 1028 |
-
|
| 1029 |
-
|
| 1030 |
-
|
| 1031 |
-
|
| 1032 |
-
|
| 1033 |
-
|
| 1034 |
-
|
| 1035 |
-
|
| 1036 |
-
|
| 1037 |
-
|
| 1038 |
-
|
| 1039 |
-
|
| 1040 |
-
|
| 1041 |
-
|
| 1042 |
-
|
| 1043 |
-
|
| 1044 |
-
|
| 1045 |
-
|
| 1046 |
-
|
| 1047 |
-
|
| 1048 |
-
onChange={(e) => setNoteEditDraft(e.target.value)}
|
| 1049 |
-
/>
|
| 1050 |
-
<div className={styles.editorActions} style={{ marginTop: 4 }}>
|
| 1051 |
-
<button onClick={() => setEditingNoteId(null)} className={styles.btnSecondary} style={{ padding: '2px 8px', fontSize: 9 }}>Cancel</button>
|
| 1052 |
-
<button onClick={() => handleUpdateNote(msg.id)} className={`${styles.btn} ${styles.btnPrimary}`} style={{ padding: '2px 8px', fontSize: 9 }}>Save</button>
|
| 1053 |
-
</div>
|
| 1054 |
-
</div>
|
| 1055 |
-
) : (
|
| 1056 |
-
<NexusMarkdown content={msg.content} isMe={isMe} />
|
| 1057 |
-
)}
|
| 1058 |
-
</div>
|
| 1059 |
-
</div>
|
| 1060 |
-
);
|
| 1061 |
-
})}
|
| 1062 |
-
<div ref={bottomRef} />
|
| 1063 |
</div>
|
| 1064 |
|
| 1065 |
-
<div className={styles.
|
| 1066 |
-
|
| 1067 |
-
className={styles.
|
| 1068 |
-
|
| 1069 |
-
|
| 1070 |
-
|
| 1071 |
-
|
| 1072 |
-
|
| 1073 |
-
|
| 1074 |
-
|
| 1075 |
-
|
| 1076 |
-
|
| 1077 |
-
else if (e.key === 'Escape') { setShowMentionList(false); }
|
| 1078 |
-
}
|
| 1079 |
-
}}
|
| 1080 |
-
/>
|
| 1081 |
-
|
| 1082 |
-
{/* Mention Dropdown */}
|
| 1083 |
-
{showMentionList && mentionTarget === (rightSidebarTab === 'notes' ? 'scratchpad' : 'reply') && filteredUsers.length > 0 && (
|
| 1084 |
-
<div className={styles.mentionOverlay}>
|
| 1085 |
-
<div className={styles.mentionHeader}>Nexus Collaborators</div>
|
| 1086 |
-
{filteredUsers.map((u, i) => (
|
| 1087 |
-
<div
|
| 1088 |
-
key={u.id}
|
| 1089 |
-
className={`${styles.mentionItem} ${i === selectedMentionIndex ? styles.mentionItemActive : ''}`}
|
| 1090 |
-
onClick={() => insertMention(u)}
|
| 1091 |
-
>
|
| 1092 |
-
<div style={{ fontWeight: 800, fontSize: 12 }}>{u.full_name}</div>
|
| 1093 |
-
<div style={{ fontSize: 9, opacity: 0.6 }}>{u.role}</div>
|
| 1094 |
-
</div>
|
| 1095 |
-
))}
|
| 1096 |
</div>
|
|
|
|
|
|
|
| 1097 |
)}
|
| 1098 |
-
|
| 1099 |
-
|
| 1100 |
-
|
| 1101 |
-
|
| 1102 |
-
|
| 1103 |
-
|
| 1104 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1105 |
</div>
|
| 1106 |
-
<button
|
| 1107 |
-
onClick={rightSidebarTab === 'messages' ? handleSendMessage : sendInternalNote}
|
| 1108 |
-
className={`${styles.btn} ${styles.btnPrimary}`}
|
| 1109 |
-
style={{ padding: '6px 16px', fontSize: 10, background: rightSidebarTab === 'notes' ? '#f59e0b' : 'var(--primary)' }}
|
| 1110 |
-
>
|
| 1111 |
-
{rightSidebarTab === 'notes' ? 'Record Note' : 'Send Reply'}
|
| 1112 |
-
</button>
|
| 1113 |
</div>
|
| 1114 |
-
</
|
| 1115 |
-
|
| 1116 |
-
|
| 1117 |
-
|
| 1118 |
-
|
| 1119 |
-
|
| 1120 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1121 |
|
| 1122 |
-
|
| 1123 |
-
|
| 1124 |
-
|
| 1125 |
-
|
| 1126 |
-
|
| 1127 |
-
|
| 1128 |
-
|
| 1129 |
-
|
| 1130 |
-
|
| 1131 |
-
|
| 1132 |
-
|
| 1133 |
-
|
| 1134 |
-
|
| 1135 |
-
|
| 1136 |
-
|
| 1137 |
-
|
| 1138 |
-
|
| 1139 |
-
|
| 1140 |
-
|
| 1141 |
-
|
| 1142 |
-
|
| 1143 |
-
|
| 1144 |
-
|
| 1145 |
-
|
| 1146 |
-
|
| 1147 |
-
|
| 1148 |
-
|
| 1149 |
-
|
| 1150 |
-
|
| 1151 |
-
|
| 1152 |
-
|
| 1153 |
-
|
| 1154 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1155 |
</div>
|
| 1156 |
-
)}
|
| 1157 |
|
| 1158 |
-
|
| 1159 |
-
|
| 1160 |
-
|
| 1161 |
-
|
| 1162 |
-
|
| 1163 |
-
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1164 |
};
|
|
|
|
| 85 |
const StatusBadge: React.FC<{ status: string }> = ({ status }) => {
|
| 86 |
const s = status?.toLowerCase() || 'open';
|
| 87 |
const getStatusConfig = (val: string) => {
|
| 88 |
+
switch (val) {
|
| 89 |
case 'open': return { color: 'var(--text-dim)', bg: 'rgba(100, 116, 139, 0.1)' };
|
| 90 |
case 'acknowledged': return { color: 'var(--primary)', bg: 'rgba(124, 58, 237, 0.1)' };
|
| 91 |
case 'in_progress': return { color: '#2563eb', bg: 'rgba(37, 99, 235, 0.1)' };
|
|
|
|
| 95 |
}
|
| 96 |
};
|
| 97 |
const config = getStatusConfig(s);
|
| 98 |
+
|
| 99 |
return (
|
| 100 |
<div style={{
|
| 101 |
display: 'inline-flex',
|
|
|
|
| 138 |
const [ticketAttachments, setTicketAttachments] = useState<Attachment[]>([]);
|
| 139 |
const [isReopening, setIsReopening] = useState(false);
|
| 140 |
const [isSummarizing, setIsSummarizing] = useState(false);
|
| 141 |
+
|
| 142 |
// --- MENTION SYSTEM STATE ---
|
| 143 |
const [showMentionList, setShowMentionList] = useState(false);
|
| 144 |
const [mentionQuery, setMentionQuery] = useState("");
|
| 145 |
const [mentionTarget, setMentionTarget] = useState<'reply' | 'scratchpad' | null>(null);
|
| 146 |
const [selectedMentionIndex, setSelectedMentionIndex] = useState(0);
|
| 147 |
const [cursorPos, setCursorPos] = useState(0);
|
| 148 |
+
|
| 149 |
const filteredUsers = useMemo(() => {
|
| 150 |
if (!mentionQuery) return internalUsers.slice(0, 5);
|
| 151 |
+
return internalUsers.filter(u =>
|
| 152 |
u.full_name?.toLowerCase().includes(mentionQuery.toLowerCase())
|
| 153 |
).slice(0, 5);
|
| 154 |
}, [internalUsers, mentionQuery]);
|
|
|
|
| 189 |
setTicket(t);
|
| 190 |
setResolutionDraft(t.resolution_text || "");
|
| 191 |
setAssigneeSearch(t.assigned_name || "Unassigned");
|
| 192 |
+
|
| 193 |
// Pre-populate scratchpad with backend-drafted internal solution if empty
|
| 194 |
if (!scratchpadText) {
|
| 195 |
setScratchpadText(t.ai_metadata?.summaries?.internal_summary || t.ai_metadata?.summaries?.customer_summary || "");
|
| 196 |
}
|
| 197 |
+
|
| 198 |
api.get(`tickets/${t.id}/attachments/`).then(res => setTicketAttachments(res.data));
|
| 199 |
}
|
| 200 |
if (messagesResp.status === 'fulfilled') setMessages(messagesResp.value.data);
|
|
|
|
| 284 |
if (autocompleteRef.current && !autocompleteRef.current.contains(event.target as Node)) {
|
| 285 |
setShowAssigneeSuggestions(false);
|
| 286 |
}
|
| 287 |
+
|
| 288 |
// Close property strip slots if clicking outside
|
| 289 |
if (activeEditingSlot && !(event.target as HTMLElement).closest(`.${styles.propertySlot}`)) {
|
| 290 |
setActiveEditingSlot(null);
|
|
|
|
| 303 |
const handleSocketUpdate = (event: any) => {
|
| 304 |
const data = event.detail;
|
| 305 |
if (data?.event === 'summary_updated' && data?.ticket_id === initialTicket?.id) {
|
| 306 |
+
refreshData();
|
| 307 |
}
|
| 308 |
};
|
| 309 |
window.addEventListener('nexus-live-event', handleSocketUpdate);
|
|
|
|
| 320 |
|
| 321 |
if (!ticket) return null;
|
| 322 |
|
| 323 |
+
const hasAIInsight = !!(
|
| 324 |
+
ticket?.ai_metadata?.summaries?.internal_summary ||
|
| 325 |
+
ticket?.ai_metadata?.summaries?.customer_summary ||
|
| 326 |
+
ticket?.ai_metadata?.initial_analysis
|
| 327 |
+
);
|
| 328 |
+
|
| 329 |
const internalSummary = ticket?.ai_metadata?.summaries?.internal_summary ||
|
| 330 |
ticket?.ai_metadata?.summaries?.customer_summary ||
|
| 331 |
+
auditTrail.find(a => (a.output_data as any)?.internal_summary)?.output_data?.internal_summary;
|
| 332 |
+
|
| 333 |
|
| 334 |
const handleUpdateStatus = async (newStatus: string) => {
|
| 335 |
const isFinal = ['RESOLVED', 'CLOSED'].includes(newStatus.toUpperCase());
|
|
|
|
| 450 |
setIsGenerating(true);
|
| 451 |
const intent = rightSidebarTab === 'notes' ? "SYSTEM_INTERNAL_NOTE" : "CUSTOMER_PUBLIC_REPLY";
|
| 452 |
const lastMsg = messages.slice(-1)[0]?.content || "No recent messages.";
|
| 453 |
+
|
| 454 |
try {
|
| 455 |
const resp = await api.post('nexus/query', {
|
| 456 |
query: `Generate a ${intent === 'SYSTEM_INTERNAL_NOTE' ? 'concise technical internal note summarizing the current state and next steps' : 'professional, empathetic customer reply addressing the user concern'}.
|
|
|
|
| 500 |
before.pop(); // Remove the @query part
|
| 501 |
const beforeStr = before.join(' ');
|
| 502 |
const afterStr = value.slice(cursorPos);
|
| 503 |
+
|
| 504 |
const newValue = `${beforeStr}${beforeStr ? ' ' : ''}@${user.full_name} ${afterStr}`;
|
| 505 |
+
|
| 506 |
if (mentionTarget === 'reply') setReplyText(newValue);
|
| 507 |
else setScratchpadText(newValue);
|
| 508 |
|
|
|
|
| 613 |
return (
|
| 614 |
<>
|
| 615 |
<div className={styles.container}>
|
| 616 |
+
<header className={styles.header}>
|
| 617 |
+
<div style={{ display: 'flex', alignItems: 'center', gap: 16 }}>
|
| 618 |
+
<div className={styles.breadcrumbs}>
|
| 619 |
+
<span className={styles.breadcrumbLink} onClick={onBack} style={{ cursor: 'pointer' }}>TICKETS</span>
|
| 620 |
+
<ChevronRight size={12} />
|
| 621 |
+
<span className={styles.breadcrumbCurrent}>NODE_ID: {ticket.id?.slice(0, 8).toUpperCase()}</span>
|
| 622 |
+
{ticket.is_escalated && (
|
| 623 |
+
<div className={styles.escalationBadge}>
|
| 624 |
+
<ShieldAlert size={12} /> ESCALATED
|
| 625 |
+
</div>
|
| 626 |
+
)}
|
| 627 |
+
</div>
|
| 628 |
+
</div>
|
| 629 |
+
|
| 630 |
+
<div className={styles.headerTitleArea}>
|
| 631 |
+
{isEditingTitle ? (
|
| 632 |
+
<div className={styles.titleEditor}>
|
| 633 |
+
<input
|
| 634 |
+
className={styles.titleInput}
|
| 635 |
+
value={titleDraft}
|
| 636 |
+
onChange={(e) => setTitleDraft(e.target.value)}
|
| 637 |
+
autoFocus
|
| 638 |
+
/>
|
| 639 |
+
<button onClick={async () => { await handleUpdateField('title', titleDraft); setIsEditingTitle(false); }} className={styles.iconBtn}><ShieldCheck size={16} color="var(--success)" /></button>
|
| 640 |
+
<button onClick={() => setIsEditingTitle(false)} className={styles.iconBtn}><Trash2 size={16} color="var(--error)" /></button>
|
| 641 |
</div>
|
| 642 |
+
) : (
|
| 643 |
+
<h1 className={styles.mainTitle} onClick={() => { setTitleDraft(ticket.title); setIsEditingTitle(true); }}>
|
| 644 |
+
{ticket.title}
|
| 645 |
+
<Edit2 size={14} className={styles.editIcon} />
|
| 646 |
+
</h1>
|
| 647 |
)}
|
| 648 |
</div>
|
|
|
|
| 649 |
|
| 650 |
+
<div className={styles.headerActions}>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 651 |
<div style={{ display: 'flex', gap: 4, marginRight: 12 }}>
|
| 652 |
<button className={styles.toggleBtn} onClick={() => setIsLeftOpen(!isLeftOpen)} title="Toggle Operations">
|
| 653 |
<PanelRight size={18} style={{ transform: 'rotate(180deg)' }} color={isLeftOpen ? 'var(--primary)' : 'var(--text-dim)'} />
|
|
|
|
| 665 |
<button onClick={onBack} className={`${styles.btn} ${styles.btnSecondary}`} style={{ marginLeft: 8 }}>
|
| 666 |
<ChevronLeft size={16} /> BACK
|
| 667 |
</button>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 668 |
</div>
|
| 669 |
+
</header>
|
| 670 |
+
|
| 671 |
+
<div className={styles.workspace}>
|
| 672 |
+
{/* Unified Property Strip */}
|
| 673 |
+
<div className={styles.propertyStrip}>
|
| 674 |
+
{/* Priority Slot */}
|
| 675 |
+
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'priority' ? null : 'priority')}>
|
| 676 |
+
<div className={styles.slotLabel}>TICKET PRIORITY</div>
|
| 677 |
+
<div className={styles.slotValueArea}>
|
| 678 |
+
<div className={styles.priorityDot} style={{ background: ticket.priority === 'P0' ? 'var(--error)' : ticket.priority === 'P1' ? '#f59e0b' : 'var(--primary)' }} />
|
| 679 |
+
{activeEditingSlot === 'priority' ? (
|
| 680 |
+
<select
|
| 681 |
+
className={styles.propertySelect}
|
| 682 |
+
value={ticket.priority}
|
| 683 |
autoFocus
|
| 684 |
+
onChange={(e) => { handleUpdatePriority(e.target.value); setActiveEditingSlot(null); }}
|
| 685 |
+
onClick={(e) => e.stopPropagation()}
|
| 686 |
+
>
|
| 687 |
+
<option value="P0">P0 - EMERGENCY</option>
|
| 688 |
+
<option value="P1">P1 - CRITICAL</option>
|
| 689 |
+
<option value="P2">P2 - MAJOR</option>
|
| 690 |
+
<option value="P3">P3 - MINOR</option>
|
| 691 |
+
</select>
|
| 692 |
+
) : (
|
| 693 |
+
<span className={styles.slotValue}>{ticket.priority}</span>
|
| 694 |
+
)}
|
| 695 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 696 |
</div>
|
|
|
|
|
|
|
| 697 |
|
| 698 |
+
{/* Assignee Slot */}
|
| 699 |
+
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'assignee' ? null : 'assignee')}>
|
| 700 |
+
<div className={styles.slotLabel}>ASSIGNED AGENT</div>
|
| 701 |
+
<div className={styles.slotValueArea}>
|
| 702 |
+
<div className={styles.assigneeAvatar}>{ticket.assigned_name?.[0] || 'N'}</div>
|
| 703 |
+
{activeEditingSlot === 'assignee' ? (
|
| 704 |
+
<div style={{ position: 'relative', flex: 1 }} onClick={(e) => e.stopPropagation()} ref={autocompleteRef}>
|
| 705 |
+
<input
|
| 706 |
+
type="text"
|
| 707 |
+
className={styles.propertyInput}
|
| 708 |
+
value={assigneeSearch}
|
| 709 |
+
autoFocus
|
| 710 |
+
onChange={(e) => { setAssigneeSearch(e.target.value); setShowAssigneeSuggestions(true); }}
|
| 711 |
+
onFocus={() => setShowAssigneeSuggestions(true)}
|
| 712 |
+
placeholder="Search analyst..."
|
| 713 |
+
/>
|
| 714 |
+
{showAssigneeSuggestions && (
|
| 715 |
+
<div className={styles.autocompleteSuggestions} style={{ top: 40 }}>
|
| 716 |
+
{internalUsers.filter(u => u.full_name?.toLowerCase().includes(assigneeSearch.toLowerCase())).map(u => (
|
| 717 |
+
<div key={u.id} className={styles.suggestionItem} onClick={() => { handleUpdateAssignee(u.id); setActiveEditingSlot(null); setShowAssigneeSuggestions(false); }}>
|
| 718 |
+
<div style={{ fontWeight: 700, fontSize: 12 }}>{u.full_name}</div>
|
| 719 |
+
<div style={{ fontSize: 9, opacity: 0.7 }}>{u.role}</div>
|
| 720 |
+
</div>
|
| 721 |
+
))}
|
|
|
|
|
|
|
| 722 |
</div>
|
| 723 |
+
)}
|
| 724 |
+
</div>
|
| 725 |
+
) : (
|
| 726 |
+
<span className={styles.slotValue}>{ticket.assigned_name || "Unassigned"}</span>
|
| 727 |
+
)}
|
| 728 |
+
</div>
|
| 729 |
</div>
|
|
|
|
| 730 |
|
| 731 |
+
{/* Status Slot */}
|
| 732 |
+
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'status' ? null : 'status')}>
|
| 733 |
+
<div className={styles.slotLabel}>OPERATIONAL STATUS</div>
|
| 734 |
+
<div className={styles.slotValueArea}>
|
| 735 |
+
{activeEditingSlot === 'status' ? (
|
| 736 |
+
<select
|
| 737 |
+
className={styles.propertySelect}
|
| 738 |
+
value={ticket.status}
|
| 739 |
+
autoFocus
|
| 740 |
+
onChange={(e) => { handleUpdateStatus(e.target.value); setActiveEditingSlot(null); }}
|
| 741 |
+
onClick={(e) => e.stopPropagation()}
|
| 742 |
+
>
|
| 743 |
+
<option value="OPEN">OPEN</option>
|
| 744 |
+
<option value="ACKNOWLEDGED">ACKNOWLEDGED</option>
|
| 745 |
+
<option value="IN_PROGRESS">IN_PROGRESS</option>
|
| 746 |
+
<option value="RESOLVED">RESOLVED</option>
|
| 747 |
+
<option value="CLOSED">CLOSED</option>
|
| 748 |
+
</select>
|
| 749 |
) : (
|
| 750 |
+
<StatusBadge status={ticket.status} />
|
| 751 |
)}
|
| 752 |
+
</div>
|
| 753 |
</div>
|
|
|
|
| 754 |
|
| 755 |
+
{/* ETA Slot */}
|
| 756 |
+
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'eta' ? null : 'eta')}>
|
| 757 |
+
<div className={styles.slotLabel}>ESTIMATED RESOLUTION</div>
|
| 758 |
+
<div className={styles.slotValueArea}>
|
| 759 |
+
{activeEditingSlot === 'eta' ? (
|
| 760 |
+
<input
|
| 761 |
+
className={styles.propertyInput}
|
| 762 |
+
value={ticket.eta || ""}
|
| 763 |
+
autoFocus
|
| 764 |
+
onChange={(e) => handleUpdateField('eta', e.target.value)}
|
| 765 |
+
onBlur={() => setActiveEditingSlot(null)}
|
| 766 |
+
onClick={(e) => e.stopPropagation()}
|
| 767 |
+
placeholder="e.g. 2h"
|
| 768 |
+
/>
|
| 769 |
+
) : (
|
| 770 |
+
<span className={styles.slotValue}>{formatETA(ticket.eta || "N/A")}</span>
|
| 771 |
+
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 772 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 773 |
</div>
|
| 774 |
+
|
| 775 |
+
{/* Effort Slot */}
|
| 776 |
+
<div className={styles.propertySlot} onClick={() => setActiveEditingSlot(activeEditingSlot === 'effort' ? null : 'effort')}>
|
| 777 |
+
<div className={styles.slotLabel}>ESTIMATED EFFORT</div>
|
| 778 |
+
<div className={styles.slotValueArea}>
|
| 779 |
+
{activeEditingSlot === 'effort' ? (
|
| 780 |
+
<input
|
| 781 |
+
className={styles.propertyInput}
|
| 782 |
+
value={ticket.estimated_effort || ""}
|
| 783 |
+
autoFocus
|
| 784 |
+
onChange={(e) => handleUpdateField('estimated_effort', e.target.value)}
|
| 785 |
+
onBlur={() => setActiveEditingSlot(null)}
|
| 786 |
+
onClick={(e) => e.stopPropagation()}
|
| 787 |
+
placeholder="e.g. 1d"
|
| 788 |
+
/>
|
| 789 |
+
) : (
|
| 790 |
+
<span className={styles.slotValue}>{ticket.estimated_effort || "N/A"}</span>
|
| 791 |
+
)}
|
| 792 |
+
</div>
|
| 793 |
</div>
|
| 794 |
</div>
|
| 795 |
|
| 796 |
+
<div className={styles.horizontalWorkspace}>
|
| 797 |
+
{/* Left Sidebar (Diagnostics & Forensics) */}
|
| 798 |
+
<aside className={`${styles.leftSidebar} ${!isLeftOpen ? styles.leftSidebarCollapsed : ''}`}>
|
| 799 |
+
{/* Forensic Trail */}
|
| 800 |
+
<div className={styles.sidebarSection}>
|
| 801 |
+
<div className={styles.propertyLabel}>FORENSIC TRAIL</div>
|
| 802 |
+
<div className={styles.timeline} style={{ marginTop: 12 }}>
|
| 803 |
+
{(() => {
|
| 804 |
+
const liveSteps = ticket.ai_metadata?.processed_steps || auditTrail || [];
|
| 805 |
+
if (liveSteps.length === 0) return <div className={styles.empty}>Awaiting initiation...</div>;
|
| 806 |
+
|
| 807 |
+
return liveSteps.map((step: any, i: number) => {
|
| 808 |
+
const isError = step.status === 'error';
|
| 809 |
+
const isLast = i === liveSteps.length - 1;
|
| 810 |
+
const stepName = (step.name || step.agent_name || 'NEURAL_NODE').toUpperCase();
|
| 811 |
|
| 812 |
+
return (
|
| 813 |
+
<div key={i} className={styles.timelineItem} style={{ gap: 12 }}>
|
| 814 |
+
{!isLast && <div className={styles.timelineLine} style={{ left: 5, top: 16, bottom: -12 }} />}
|
| 815 |
+
<div className={`${styles.timelineDot} ${isLast && !isError ? styles.current : (!isError ? styles.verified : '')} ${isError ? styles.error : ''}`} style={{ width: 12, height: 12, border: '3px solid var(--border-hi)' }} />
|
| 816 |
+
<div className={styles.traceInfo}>
|
| 817 |
+
<span className={styles.traceLabel} style={{ fontSize: 10 }}>{stepName}</span>
|
| 818 |
+
<span className={`${styles.traceDetail} ${!isError && !isLast ? styles.verified : ''}`} style={{ fontSize: 8 }}>
|
| 819 |
+
{isError ? 'Interrupted' : 'Cycle Verified'}
|
| 820 |
+
</span>
|
| 821 |
+
</div>
|
| 822 |
+
</div>
|
| 823 |
+
);
|
| 824 |
+
});
|
| 825 |
+
})()}
|
| 826 |
+
</div>
|
| 827 |
</div>
|
| 828 |
+
|
| 829 |
+
{/* Semantic Proximity */}
|
| 830 |
+
<div className={styles.sidebarSection}>
|
| 831 |
+
<div className={styles.propertyLabel}>SEMANTIC PROXIMITY</div>
|
| 832 |
+
<div style={{ display: 'flex', flexDirection: 'column', gap: 12, marginTop: 12 }}>
|
| 833 |
+
{ticket.ai_metadata?.similar_tickets && ticket.ai_metadata.similar_tickets.length > 0 ? (
|
| 834 |
+
ticket.ai_metadata.similar_tickets.map((sim: { id: string; title: string; similarity: number; status: string }, i: number) => (
|
| 835 |
+
<div key={i} className={styles.propertyValue} style={{ cursor: 'pointer', padding: '8px 12px' }} onClick={() => window.location.href = `?ticket_id=${sim.id}`}>
|
| 836 |
+
<div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 4 }}>
|
| 837 |
+
<span style={{ fontSize: 8, fontWeight: 900, color: 'var(--primary)', letterSpacing: '0.05em' }}>{(sim.similarity * 100).toFixed(0)}% MATCH</span>
|
| 838 |
+
<StatusBadge status={sim.status} />
|
| 839 |
+
</div>
|
| 840 |
+
<div style={{ fontSize: 11, fontWeight: 700, color: 'var(--text-main)', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{sim.title}</div>
|
| 841 |
+
</div>
|
| 842 |
+
))
|
| 843 |
+
) : (
|
| 844 |
+
<div className={styles.empty}>No semantic overlaps.</div>
|
| 845 |
+
)}
|
| 846 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 847 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 848 |
|
| 849 |
+
{/* Evidence Hub */}
|
| 850 |
+
<div className={styles.sidebarSection}>
|
| 851 |
+
<div className={styles.propertyLabel}>EVIDENCE HUB</div>
|
| 852 |
+
<div className={styles.evidenceGrid} style={{ marginTop: 16 }}>
|
| 853 |
+
{ticketAttachments.length > 0 ? (
|
| 854 |
+
ticketAttachments.map((att, i) => (
|
| 855 |
+
<div key={i} className={styles.evidenceItem} onClick={() => handleFileDownload(att.id, att.file_name)}>
|
| 856 |
+
<div className={styles.evidenceIcon}>
|
| 857 |
+
<span style={{ fontSize: 18 }}>{getFileIcon(att.file_name || "unknown")}</span>
|
| 858 |
</div>
|
| 859 |
+
<div className={styles.evidenceName}>{att.file_name || "Unnamed Artifact"}</div>
|
| 860 |
</div>
|
| 861 |
+
))
|
| 862 |
+
) : (
|
| 863 |
+
<div className={styles.empty}>No artifacts captured.</div>
|
| 864 |
+
)}
|
| 865 |
+
</div>
|
| 866 |
+
</div>
|
| 867 |
+
</aside>
|
| 868 |
+
|
| 869 |
+
{/* Main Column (Primary Documentation Flow) */}
|
| 870 |
+
<main className={styles.mainContent}>
|
| 871 |
+
{/* AI Intelligence Summary (Prominent Top Area) */}
|
| 872 |
+
<div className={styles.aiIntelligenceCard}>
|
| 873 |
+
<div className={styles.aiHeader}>
|
| 874 |
+
<div className={styles.aiBadge}>
|
| 875 |
+
<Sparkles size={16} /> AI INTELLIGENCE SUMMARY
|
| 876 |
+
</div>
|
| 877 |
+
<button
|
| 878 |
+
onClick={async () => { setIsSummarizing(true); try { await api.post(`tickets/${ticket.id}/summarize/`); await refreshData(); } finally { setIsSummarizing(false); } }}
|
| 879 |
+
className={styles.btnSecondary}
|
| 880 |
+
style={{ padding: '6px 12px', fontSize: 10 }}
|
| 881 |
+
disabled={isSummarizing}
|
| 882 |
+
>
|
| 883 |
+
<RefreshCw size={12} className={isSummarizing ? styles.spin : ''} /> Regenerate
|
| 884 |
+
</button>
|
| 885 |
+
</div>
|
| 886 |
+
<div className={`${styles.intelligenceSurface} ${(!hasAIInsight || isSummarizing) ? styles.neuralSurface : ''}`}>
|
| 887 |
+
{internalSummary && !isSummarizing ? (
|
| 888 |
+
<NexusMarkdown content={internalSummary} />
|
| 889 |
+
) : (ticket?.ai_metadata?.initial_analysis && !isSummarizing) ? (
|
| 890 |
+
<div className={styles.initialAnalysisBox}>
|
| 891 |
+
<div className={styles.analysisModule}>
|
| 892 |
+
<label>ROOT CAUSE ANALYSIS</label>
|
| 893 |
+
<p>{(ticket as any).ai_metadata.initial_analysis.rca}</p>
|
| 894 |
+
</div>
|
| 895 |
+
<div className={styles.analysisModule}>
|
| 896 |
+
<label>PROPOSED SOLUTION</label>
|
| 897 |
+
<p>{(ticket as any).ai_metadata.initial_analysis.technical_solution}</p>
|
| 898 |
+
</div>
|
| 899 |
+
{(ticket as any).ai_metadata.initial_analysis.relevant_article && (
|
| 900 |
+
<div className={styles.analysisModule}>
|
| 901 |
+
<label>RELEVANT KNOWLEDGE BASE</label>
|
| 902 |
+
<p>Ref: {(ticket as any).ai_metadata.initial_analysis.relevant_article}</p>
|
| 903 |
+
</div>
|
| 904 |
+
)}
|
| 905 |
+
<div className={styles.analysisFooter}>
|
| 906 |
+
<Sparkles size={12} /> Full intelligence summary crystallization in progress...
|
| 907 |
+
</div>
|
| 908 |
+
</div>
|
| 909 |
+
) : (
|
| 910 |
+
<div className={styles.neuralLoading}>
|
| 911 |
+
<div className={styles.neuralPulse} />
|
| 912 |
+
<div className={styles.neuralGlow} />
|
| 913 |
+
<div className={styles.neuralText}>
|
| 914 |
+
<Sparkles size={16} className={styles.spin} style={{ marginBottom: 12, opacity: 0.8 }} />
|
| 915 |
+
<div style={{ fontWeight: 900, fontSize: 14, letterSpacing: '0.04em', textTransform: 'uppercase' }}>
|
| 916 |
+
{isSummarizing ? "Synthesizing Neural Gist..." : "Initiating Intelligence Scrypt..."}
|
| 917 |
</div>
|
| 918 |
+
<div style={{ fontSize: 11, opacity: 0.6, marginTop: 6, fontWeight: 600 }}>
|
| 919 |
+
{isSummarizing ? "Synchronizing high-fidelity forensic data across worker nodes." : "Neural trail detected. Waiting for crystallization cycle."}
|
|
|
|
| 920 |
</div>
|
| 921 |
</div>
|
| 922 |
</div>
|
| 923 |
+
)}
|
| 924 |
+
</div>
|
|
|
|
|
|
|
| 925 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 926 |
|
| 927 |
+
{/* Status Banners */}
|
| 928 |
+
{/* Escalation is now a compact badge in the header */}
|
| 929 |
+
|
| 930 |
+
{ticket.status === 'CLOSED' && ticket.duplicate_of_id && (
|
| 931 |
+
<div className={`${styles.banner} ${styles.duplicateBanner}`}>
|
| 932 |
+
<div style={{ display: 'flex', alignItems: 'center', gap: 12 }}>
|
| 933 |
+
<span style={{ fontSize: 16 }}>🖇️</span>
|
| 934 |
+
<span style={{ fontSize: 13, fontWeight: 700 }}>DUPLICATE DETECTED: LINKED TO #{ticket.duplicate_of_id.slice(0, 8)}</span>
|
| 935 |
+
</div>
|
| 936 |
+
<button onClick={handleReopenDuplicate} disabled={isReopening} className={styles.btnPrimary} style={{ fontSize: 10, padding: '6px 16px' }}>
|
| 937 |
+
{isReopening ? 'REOPENING...' : 'REOPEN & RETRIAGE'}
|
| 938 |
+
</button>
|
| 939 |
+
</div>
|
| 940 |
+
)}
|
| 941 |
+
|
| 942 |
+
{/* Ticket Description Area */}
|
| 943 |
+
<section className={styles.sectionBlock}>
|
| 944 |
+
<div className={styles.dossierHeader} style={{ marginBottom: 12 }}>
|
| 945 |
+
<div className={styles.sectionTitle}>TICKET DESCRIPTION</div>
|
| 946 |
+
{isStaff && !isEditingDescription && (
|
| 947 |
+
<button onClick={() => { setDescriptionDraft(ticket.description || ""); setIsEditingDescription(true); }} className={styles.btnSecondary} style={{ padding: '4px 8px', fontSize: 10 }}>Edit Description</button>
|
| 948 |
+
)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 949 |
</div>
|
| 950 |
|
| 951 |
+
<div className={styles.propertyValue} style={{ padding: '24px' }}>
|
| 952 |
+
{isEditingDescription ? (
|
| 953 |
+
<div className={styles.descriptionEditor}>
|
| 954 |
+
<textarea
|
| 955 |
+
className={styles.descriptionTextarea}
|
| 956 |
+
value={descriptionDraft}
|
| 957 |
+
onChange={(e) => setDescriptionDraft(e.target.value)}
|
| 958 |
+
/>
|
| 959 |
+
<div className={styles.editorActions}>
|
| 960 |
+
<button onClick={() => setIsEditingDescription(false)} className={styles.btnSecondary}>Cancel</button>
|
| 961 |
+
<button onClick={async () => { await handleUpdateField('description', descriptionDraft); setIsEditingDescription(false); }} className={`${styles.btn} ${styles.btnPrimary}`}>Save</button>
|
| 962 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 963 |
</div>
|
| 964 |
+
) : (
|
| 965 |
+
<NexusMarkdown content={ticket.description || "No description provided."} />
|
| 966 |
)}
|
| 967 |
+
</div>
|
| 968 |
+
</section>
|
| 969 |
+
|
| 970 |
+
{/* Resolution Intelligence Documentation */}
|
| 971 |
+
{(ticket.resolution_text || ticket.status === 'RESOLVED') && (
|
| 972 |
+
<section className={styles.sectionBlock} style={{ marginTop: 32 }}>
|
| 973 |
+
<div className={styles.sectionTitle}>RESOLUTION INTELLIGENCE</div>
|
| 974 |
+
<div className={styles.resolutionCard}>
|
| 975 |
+
<div className={styles.aiHeader}>
|
| 976 |
+
<div className={styles.aiBadge} style={{ color: 'var(--success)' }}>
|
| 977 |
+
<ShieldCheck size={16} /> FINAL RESOLUTION VERIFIED
|
| 978 |
+
</div>
|
| 979 |
+
</div>
|
| 980 |
+
<div className={styles.intelligenceSurface}>
|
| 981 |
+
<div style={{ position: 'relative' }}>
|
| 982 |
+
<NexusMarkdown content={ticket.resolution_text || "Awaiting final documentation..."} />
|
| 983 |
+
{ticket.status === 'RESOLVED' && isStaff && (
|
| 984 |
+
<button
|
| 985 |
+
onClick={() => { setResolutionDraft(ticket.resolution_text || ""); setShowResolutionModal(true); }}
|
| 986 |
+
className={styles.btnSecondary}
|
| 987 |
+
style={{ position: 'absolute', top: -32, right: -12, fontSize: 10, padding: '4px 8px' }}
|
| 988 |
+
>Edit Resolution</button>
|
| 989 |
+
)}
|
| 990 |
+
</div>
|
| 991 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 992 |
</div>
|
| 993 |
+
</section>
|
| 994 |
+
)}
|
| 995 |
+
</main>
|
| 996 |
+
|
| 997 |
+
{/* Right Sidebar (Collaboration & History) */}
|
| 998 |
+
<aside className={`${styles.rightSidebar} ${!isRightOpen ? styles.rightSidebarCollapsed : ''}`}>
|
| 999 |
+
<div className={styles.sidebarTabs}>
|
| 1000 |
+
<button
|
| 1001 |
+
onClick={() => setRightSidebarTab('messages')}
|
| 1002 |
+
className={`${styles.tabButton} ${rightSidebarTab === 'messages' ? styles.activeTab : ''}`}
|
| 1003 |
+
>Messages</button>
|
| 1004 |
+
<button
|
| 1005 |
+
onClick={() => setRightSidebarTab('notes')}
|
| 1006 |
+
className={`${styles.tabButton} ${rightSidebarTab === 'notes' ? styles.activeTab : ''}`}
|
| 1007 |
+
>Internal Notes</button>
|
| 1008 |
+
<button
|
| 1009 |
+
onClick={() => setRightSidebarTab('history')}
|
| 1010 |
+
className={`${styles.tabButton} ${rightSidebarTab === 'history' ? styles.activeTab : ''}`}
|
| 1011 |
+
>History</button>
|
| 1012 |
+
</div>
|
| 1013 |
|
| 1014 |
+
<div style={{ flex: 1, overflowY: 'auto', display: 'flex', flexDirection: 'column' }}>
|
| 1015 |
+
{rightSidebarTab === 'history' ? (
|
| 1016 |
+
<div className={styles.activityFeed}>
|
| 1017 |
+
{historyEvents.length > 0 ? (
|
| 1018 |
+
historyEvents.map((ev) => (
|
| 1019 |
+
<div key={ev.id} className={styles.activityItem}>
|
| 1020 |
+
<div className={styles.activityIconContainer}>
|
| 1021 |
+
<div className={styles.activityIcon} style={{ background: `${ev.color}15`, color: ev.color, border: `1px solid ${ev.color}30` }}>
|
| 1022 |
+
{ev.icon}
|
| 1023 |
+
</div>
|
| 1024 |
+
<div className={styles.activityLine} />
|
| 1025 |
+
</div>
|
| 1026 |
+
<div className={styles.activityContent}>
|
| 1027 |
+
<div className={styles.activityHeader}>
|
| 1028 |
+
{ev.label}
|
| 1029 |
+
</div>
|
| 1030 |
+
<div className={styles.activityDetail}>{ev.detail}</div>
|
| 1031 |
+
<div className={styles.activityTime}>
|
| 1032 |
+
{new Date(ev.time).toLocaleString([], { month: 'short', day: 'numeric', hour: '2-digit', minute: '2-digit' }).toUpperCase()}
|
| 1033 |
+
</div>
|
| 1034 |
+
</div>
|
| 1035 |
+
</div>
|
| 1036 |
+
))
|
| 1037 |
+
) : (
|
| 1038 |
+
<div className={styles.empty} style={{ padding: 24, textAlign: 'center' }}>No historical state shifts captured.</div>
|
| 1039 |
+
)}
|
| 1040 |
+
</div>
|
| 1041 |
+
) : (
|
| 1042 |
+
<>
|
| 1043 |
+
<div className={styles.messageThread} style={{ flex: 1, padding: 20 }}>
|
| 1044 |
+
{messages
|
| 1045 |
+
.filter(m => rightSidebarTab === 'notes' ? m.is_internal : !m.is_internal)
|
| 1046 |
+
.map((msg, i) => {
|
| 1047 |
+
const isMe = msg.sender_role !== 'customer';
|
| 1048 |
+
const isInternal = msg.is_internal;
|
| 1049 |
+
const timeStr = new Date(msg.created_at).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
|
| 1050 |
+
const isNoteBeingEdited = editingNoteId === msg.id;
|
| 1051 |
+
|
| 1052 |
+
return (
|
| 1053 |
+
<div key={i} className={`${styles.message} ${isInternal ? styles.messageInternal : (isMe ? styles.messageMe : styles.messageExternal)}`}>
|
| 1054 |
+
<div className={styles.messageMeta}>
|
| 1055 |
+
<div style={{ display: 'flex', alignItems: 'center', gap: 6 }}>
|
| 1056 |
+
<span>{msg.sender_name || (isMe ? 'Agent' : 'User')}</span>
|
| 1057 |
+
<span>{timeStr}</span>
|
| 1058 |
+
{isInternal && <span className={styles.internalBadge}>• NOTE</span>}
|
| 1059 |
+
</div>
|
| 1060 |
+
{isInternal && isStaff && !isNoteBeingEdited && (
|
| 1061 |
+
<div className={styles.messageActions}>
|
| 1062 |
+
<button onClick={() => { setEditingNoteId(msg.id); setNoteEditDraft(msg.content); }}><History size={11} /></button>
|
| 1063 |
+
<button onClick={() => handleDeleteNote(msg.id)}><Trash2 size={11} /></button>
|
| 1064 |
+
</div>
|
| 1065 |
+
)}
|
| 1066 |
+
</div>
|
| 1067 |
+
<div className={`${styles.messageBubble} ${isInternal ? styles.messageBubbleInternal : (isMe ? styles.messageBubbleMe : styles.messageBubbleThem)}`}>
|
| 1068 |
+
{isNoteBeingEdited ? (
|
| 1069 |
+
<div className={styles.noteEditor}>
|
| 1070 |
+
<textarea
|
| 1071 |
+
className={styles.descriptionTextarea}
|
| 1072 |
+
style={{ minHeight: 60, fontSize: 12 }}
|
| 1073 |
+
value={noteEditDraft}
|
| 1074 |
+
onChange={(e) => setNoteEditDraft(e.target.value)}
|
| 1075 |
+
/>
|
| 1076 |
+
<div className={styles.editorActions} style={{ marginTop: 4 }}>
|
| 1077 |
+
<button onClick={() => setEditingNoteId(null)} className={styles.btnSecondary} style={{ padding: '2px 8px', fontSize: 9 }}>Cancel</button>
|
| 1078 |
+
<button onClick={() => handleUpdateNote(msg.id)} className={`${styles.btn} ${styles.btnPrimary}`} style={{ padding: '2px 8px', fontSize: 9 }}>Save</button>
|
| 1079 |
+
</div>
|
| 1080 |
+
</div>
|
| 1081 |
+
) : (
|
| 1082 |
+
<NexusMarkdown content={msg.content} isMe={isMe} />
|
| 1083 |
+
)}
|
| 1084 |
+
</div>
|
| 1085 |
+
</div>
|
| 1086 |
+
);
|
| 1087 |
+
})}
|
| 1088 |
+
<div ref={bottomRef} />
|
| 1089 |
+
</div>
|
| 1090 |
+
|
| 1091 |
+
<div className={styles.replyConsole} style={{ padding: 16, margin: '0 16px 16px', borderRadius: 16, background: 'var(--bg-card)', border: '1px solid var(--border-subtle)' }}>
|
| 1092 |
+
<textarea
|
| 1093 |
+
className={styles.replyTextarea}
|
| 1094 |
+
style={{ minHeight: 60, fontSize: 12 }}
|
| 1095 |
+
placeholder={rightSidebarTab === 'notes' ? "Draft internal system note..." : "Compose public resolution update..."}
|
| 1096 |
+
value={rightSidebarTab === 'notes' ? scratchpadText : replyText}
|
| 1097 |
+
onChange={(e) => handleMentionInput(e, rightSidebarTab === 'notes' ? 'scratchpad' : 'reply')}
|
| 1098 |
+
onKeyDown={(e) => {
|
| 1099 |
+
if (showMentionList && filteredUsers.length > 0) {
|
| 1100 |
+
if (e.key === 'ArrowDown') { e.preventDefault(); setSelectedMentionIndex(i => (i + 1) % filteredUsers.length); }
|
| 1101 |
+
else if (e.key === 'ArrowUp') { e.preventDefault(); setSelectedMentionIndex(i => (i - 1 + filteredUsers.length) % filteredUsers.length); }
|
| 1102 |
+
else if (e.key === 'Enter') { e.preventDefault(); insertMention(filteredUsers[selectedMentionIndex]); }
|
| 1103 |
+
else if (e.key === 'Escape') { setShowMentionList(false); }
|
| 1104 |
+
}
|
| 1105 |
+
}}
|
| 1106 |
+
/>
|
| 1107 |
+
|
| 1108 |
+
{/* Mention Dropdown */}
|
| 1109 |
+
{showMentionList && mentionTarget === (rightSidebarTab === 'notes' ? 'scratchpad' : 'reply') && filteredUsers.length > 0 && (
|
| 1110 |
+
<div className={styles.mentionOverlay}>
|
| 1111 |
+
<div className={styles.mentionHeader}>Nexus Collaborators</div>
|
| 1112 |
+
{filteredUsers.map((u, i) => (
|
| 1113 |
+
<div
|
| 1114 |
+
key={u.id}
|
| 1115 |
+
className={`${styles.mentionItem} ${i === selectedMentionIndex ? styles.mentionItemActive : ''}`}
|
| 1116 |
+
onClick={() => insertMention(u)}
|
| 1117 |
+
>
|
| 1118 |
+
<div style={{ fontWeight: 800, fontSize: 12 }}>{u.full_name}</div>
|
| 1119 |
+
<div style={{ fontSize: 9, opacity: 0.6 }}>{u.role}</div>
|
| 1120 |
+
</div>
|
| 1121 |
+
))}
|
| 1122 |
+
</div>
|
| 1123 |
+
)}
|
| 1124 |
+
|
| 1125 |
+
<div className={styles.consoleFooter} style={{ paddingTop: 8 }}>
|
| 1126 |
+
<div className={styles.toolGroup}>
|
| 1127 |
+
<button className={styles.btnSecondary} style={{ padding: 6, width: 28, height: 28, borderRadius: 8 }} onClick={() => rightSidebarTab === 'messages' ? replyFileInputRef.current?.click() : scratchpadFileInputRef.current?.click()}><Paperclip size={12} /></button>
|
| 1128 |
+
<button className={styles.btnSecondary} style={{ padding: 0, width: 28, height: 28, borderRadius: 8, display: 'flex', alignItems: 'center', justifyContent: 'center' }} onClick={generateAIAssistantDraft} disabled={isGenerating}>
|
| 1129 |
+
<Sparkles size={11} className={isGenerating ? styles.spin : ''} />
|
| 1130 |
+
</button>
|
| 1131 |
+
</div>
|
| 1132 |
+
<button
|
| 1133 |
+
onClick={rightSidebarTab === 'messages' ? handleSendMessage : sendInternalNote}
|
| 1134 |
+
className={`${styles.btn} ${styles.btnPrimary}`}
|
| 1135 |
+
style={{ padding: '6px 16px', fontSize: 10, background: rightSidebarTab === 'notes' ? '#f59e0b' : 'var(--primary)' }}
|
| 1136 |
+
>
|
| 1137 |
+
{rightSidebarTab === 'notes' ? 'Record Note' : 'Send Reply'}
|
| 1138 |
+
</button>
|
| 1139 |
+
</div>
|
| 1140 |
+
</div>
|
| 1141 |
+
</>
|
| 1142 |
+
)}
|
| 1143 |
+
</div>
|
| 1144 |
+
</aside>
|
| 1145 |
+
</div>
|
| 1146 |
</div>
|
|
|
|
| 1147 |
|
| 1148 |
+
{/* 4. Modals */}
|
| 1149 |
+
{showResolutionModal && (
|
| 1150 |
+
<div className={styles.modalOverlay}>
|
| 1151 |
+
<motion.div initial={{ scale: 0.9, opacity: 0 }} animate={{ scale: 1, opacity: 1 }} className={styles.modal}>
|
| 1152 |
+
<div style={{ display: 'flex', alignItems: 'center', gap: 12, marginBottom: 24 }}>
|
| 1153 |
+
<ShieldCheck size={20} color="var(--success)" />
|
| 1154 |
+
<h2 style={{ margin: 0, fontSize: 20, fontWeight: 900 }}>Final Resolution Documentation</h2>
|
| 1155 |
+
</div>
|
| 1156 |
+
<p style={{ color: 'var(--text-dim)', fontSize: 13, marginBottom: 20 }}>Document the root cause and implemented fix before system closure.</p>
|
| 1157 |
+
<textarea
|
| 1158 |
+
className={styles.descriptionTextarea}
|
| 1159 |
+
style={{ minHeight: 180, marginBottom: 24 }}
|
| 1160 |
+
placeholder="Technical summary of the resolution cycle..."
|
| 1161 |
+
value={resolutionDraft}
|
| 1162 |
+
onChange={(e) => setResolutionDraft(e.target.value)}
|
| 1163 |
+
/>
|
| 1164 |
+
<div style={{ display: 'flex', justifyContent: 'flex-end', gap: 12, marginTop: 32 }}>
|
| 1165 |
+
<button
|
| 1166 |
+
onClick={() => setShowResolutionModal(false)}
|
| 1167 |
+
className={styles.btnSecondary}
|
| 1168 |
+
style={{ padding: '12px 24px' }}
|
| 1169 |
+
>
|
| 1170 |
+
Cancel Action
|
| 1171 |
+
</button>
|
| 1172 |
+
<button
|
| 1173 |
+
onClick={submitResolution}
|
| 1174 |
+
className={`${styles.btn} ${styles.btnPrimary}`}
|
| 1175 |
+
style={{ padding: '12px 32px' }}
|
| 1176 |
+
>
|
| 1177 |
+
Resolve & Close Incident
|
| 1178 |
+
</button>
|
| 1179 |
+
</div>
|
| 1180 |
+
</motion.div>
|
| 1181 |
+
</div>
|
| 1182 |
+
)}
|
| 1183 |
+
|
| 1184 |
+
{/* Hidden File Inputs */}
|
| 1185 |
+
<input type="file" ref={replyFileInputRef} style={{ display: 'none' }} onChange={(e) => e.target.files?.[0] && handleUpload(e.target.files[0], 'reply')} />
|
| 1186 |
+
<input type="file" ref={scratchpadFileInputRef} style={{ display: 'none' }} onChange={(e) => e.target.files?.[0] && handleUpload(e.target.files[0], 'scratchpad')} />
|
| 1187 |
+
</div>
|
| 1188 |
+
</>
|
| 1189 |
+
);
|
| 1190 |
};
|
frontend/packages/shared/src/hooks/useDashboard.ts
CHANGED
|
@@ -40,6 +40,24 @@ export interface CSATMetrics {
|
|
| 40 |
total_responses: number;
|
| 41 |
}
|
| 42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
// Global singleton state for dashboard stats to ensure UI consistency
|
| 44 |
// Now with sessionStorage persistence for instant hydration
|
| 45 |
const CACHE_KEY = 'nexus_dash_stats_v1';
|
|
@@ -133,7 +151,9 @@ let globalReports: {
|
|
| 133 |
daily: DailyStat[];
|
| 134 |
sla: SLAMetrics | null;
|
| 135 |
csat: CSATMetrics | null;
|
| 136 |
-
|
|
|
|
|
|
|
| 137 |
let globalReportsLoading = false;
|
| 138 |
let globalReportsError: string | null = null;
|
| 139 |
let lastReportsFetch = 0;
|
|
@@ -174,6 +194,8 @@ export const useReports = (workspaceId?: string) => {
|
|
| 174 |
let dailyUrl = workspaceId ? `reports/daily-stats/?workspace_id=${workspaceId}` : 'reports/daily-stats/';
|
| 175 |
|
| 176 |
let csatUrl = workspaceId ? `reports/csat/?workspace_id=${workspaceId}` : 'reports/csat/';
|
|
|
|
|
|
|
| 177 |
|
| 178 |
if (force) {
|
| 179 |
const flag = (u: string) => u + (u.includes('?') ? '&' : '?') + 'refresh=true';
|
|
@@ -181,19 +203,25 @@ export const useReports = (workspaceId?: string) => {
|
|
| 181 |
slaUrl = flag(slaUrl);
|
| 182 |
dailyUrl = flag(dailyUrl);
|
| 183 |
csatUrl = flag(csatUrl);
|
|
|
|
|
|
|
| 184 |
}
|
| 185 |
|
| 186 |
-
const [volRes, slaRes, dRes, csatRes] = await Promise.all([
|
| 187 |
api.get(volUrl),
|
| 188 |
api.get(slaUrl),
|
| 189 |
api.get(dailyUrl),
|
| 190 |
-
api.get(csatUrl)
|
|
|
|
|
|
|
| 191 |
]);
|
| 192 |
globalReports = {
|
| 193 |
volume: volRes.data,
|
| 194 |
sla: slaRes.data,
|
| 195 |
daily: dRes.data,
|
| 196 |
-
csat: csatRes.data
|
|
|
|
|
|
|
| 197 |
};
|
| 198 |
globalReportsError = null;
|
| 199 |
lastReportsFetch = Date.now();
|
|
|
|
| 40 |
total_responses: number;
|
| 41 |
}
|
| 42 |
|
| 43 |
+
export interface StaffPerformance {
|
| 44 |
+
trend: {
|
| 45 |
+
label: string;
|
| 46 |
+
timestamp: string;
|
| 47 |
+
performance: Record<string, number>;
|
| 48 |
+
}[];
|
| 49 |
+
staff_names: string[];
|
| 50 |
+
}
|
| 51 |
+
|
| 52 |
+
export interface EscalationTrend {
|
| 53 |
+
trend: {
|
| 54 |
+
label: string;
|
| 55 |
+
timestamp: string;
|
| 56 |
+
escalations: Record<string, number>;
|
| 57 |
+
}[];
|
| 58 |
+
staff_names: string[];
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
// Global singleton state for dashboard stats to ensure UI consistency
|
| 62 |
// Now with sessionStorage persistence for instant hydration
|
| 63 |
const CACHE_KEY = 'nexus_dash_stats_v1';
|
|
|
|
| 151 |
daily: DailyStat[];
|
| 152 |
sla: SLAMetrics | null;
|
| 153 |
csat: CSATMetrics | null;
|
| 154 |
+
staff: StaffPerformance | null;
|
| 155 |
+
escalations: EscalationTrend | null;
|
| 156 |
+
} = { volume: null, daily: [], sla: null, csat: null, staff: null, escalations: null };
|
| 157 |
let globalReportsLoading = false;
|
| 158 |
let globalReportsError: string | null = null;
|
| 159 |
let lastReportsFetch = 0;
|
|
|
|
| 194 |
let dailyUrl = workspaceId ? `reports/daily-stats/?workspace_id=${workspaceId}` : 'reports/daily-stats/';
|
| 195 |
|
| 196 |
let csatUrl = workspaceId ? `reports/csat/?workspace_id=${workspaceId}` : 'reports/csat/';
|
| 197 |
+
let staffUrl = workspaceId ? `reports/staff-performance/?workspace_id=${workspaceId}` : 'reports/staff-performance/';
|
| 198 |
+
let escTrendUrl = workspaceId ? `reports/escalation-trends/?workspace_id=${workspaceId}` : 'reports/escalation-trends/';
|
| 199 |
|
| 200 |
if (force) {
|
| 201 |
const flag = (u: string) => u + (u.includes('?') ? '&' : '?') + 'refresh=true';
|
|
|
|
| 203 |
slaUrl = flag(slaUrl);
|
| 204 |
dailyUrl = flag(dailyUrl);
|
| 205 |
csatUrl = flag(csatUrl);
|
| 206 |
+
staffUrl = flag(staffUrl);
|
| 207 |
+
escTrendUrl = flag(escTrendUrl);
|
| 208 |
}
|
| 209 |
|
| 210 |
+
const [volRes, slaRes, dRes, csatRes, staffRes, escRes] = await Promise.all([
|
| 211 |
api.get(volUrl),
|
| 212 |
api.get(slaUrl),
|
| 213 |
api.get(dailyUrl),
|
| 214 |
+
api.get(csatUrl),
|
| 215 |
+
api.get(staffUrl),
|
| 216 |
+
api.get(escTrendUrl)
|
| 217 |
]);
|
| 218 |
globalReports = {
|
| 219 |
volume: volRes.data,
|
| 220 |
sla: slaRes.data,
|
| 221 |
daily: dRes.data,
|
| 222 |
+
csat: csatRes.data,
|
| 223 |
+
staff: staffRes.data,
|
| 224 |
+
escalations: escRes.data
|
| 225 |
};
|
| 226 |
globalReportsError = null;
|
| 227 |
lastReportsFetch = Date.now();
|