File size: 37,903 Bytes
b8426a4 |
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 |
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>PoliScan AI | Political Analytics Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.network-node {
transition: all 0.3s ease;
}
.network-node:hover {
transform: scale(1.1);
box-shadow: 0 0 15px rgba(59, 130, 246, 0.6);
}
.chatbot-message {
max-width: 80%;
animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
}
.pulse {
animation: pulse 2s infinite;
}
@keyframes pulse {
0% { opacity: 1; }
50% { opacity: 0.5; }
100% { opacity: 1; }
}
.knowledge-graph {
background: radial-gradient(circle at center, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
}
</style>
</head>
<body class="bg-gray-50 text-gray-800 font-sans">
<div class="min-h-screen flex flex-col">
<!-- Header -->
<header class="bg-white shadow-sm">
<div class="container mx-auto px-4 py-3 flex justify-between items-center">
<div class="flex items-center space-x-2">
<div class="bg-blue-500 text-white p-2 rounded-lg">
<i class="fas fa-chart-line text-xl"></i>
</div>
<h1 class="text-xl font-bold text-blue-600">Nagara Institute <span class="text-blue-400"></span></h1>
</div>
<div class="flex items-center space-x-4">
<div class="hidden md:flex items-center space-x-1 text-sm">
<span class="bg-blue-100 text-blue-800 px-3 py-1 rounded-full">Live Data</span>
<span class="text-gray-500">Last updated: 2 min ago</span>
</div>
<button class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg text-sm font-medium transition">
<i class="fas fa-download mr-1"></i> Export Report
</button>
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 container mx-auto px-4 py-6">
<div class="grid grid-cols-1 lg:grid-cols-4 gap-6">
<!-- Sidebar -->
<div class="lg:col-span-1 bg-white rounded-xl shadow-sm p-4">
<div class="mb-6">
<h2 class="font-semibold text-gray-700 mb-3">Political Focus</h2>
<div class="space-y-2">
<button class="w-full text-left px-3 py-2 bg-blue-50 text-blue-600 rounded-lg font-medium flex items-center justify-between">
<span>Presidential Race</span>
<i class="fas fa-chevron-right text-sm"></i>
</button>
<button class="w-full text-left px-3 py-2 hover:bg-gray-50 rounded-lg font-medium flex items-center justify-between">
<span>Congressional</span>
<i class="fas fa-chevron-right text-sm"></i>
</button>
<button class="w-full text-left px-3 py-2 hover:bg-gray-50 rounded-lg font-medium flex items-center justify-between">
<span>State Elections</span>
<i class="fas fa-chevron-right text-sm"></i>
</button>
<button class="w-full text-left px-3 py-2 hover:bg-gray-50 rounded-lg font-medium flex items-center justify-between">
<span>Policy Issues</span>
<i class="fas fa-chevron-right text-sm"></i>
</button>
</div>
</div>
<div class="mb-6">
<h2 class="font-semibold text-gray-700 mb-3">Time Frame</h2>
<div class="grid grid-cols-2 gap-2">
<button class="px-3 py-1.5 bg-blue-600 text-white text-sm rounded-lg">24h</button>
<button class="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-sm rounded-lg">7d</button>
<button class="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-sm rounded-lg">30d</button>
<button class="px-3 py-1.5 bg-gray-100 hover:bg-gray-200 text-sm rounded-lg">Custom</button>
</div>
</div>
<div class="mb-6">
<h2 class="font-semibold text-gray-700 mb-3">Key Metrics</h2>
<div class="space-y-3">
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Engagement Score</span>
<span class="text-sm font-medium text-green-600">+12%</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Sentiment Ratio</span>
<span class="text-sm font-medium text-blue-600">3.2:1</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Influence Reach</span>
<span class="text-sm font-medium text-purple-600">2.4M</span>
</div>
<div class="flex items-center justify-between">
<span class="text-sm text-gray-600">Topic Velocity</span>
<span class="text-sm font-medium text-orange-600">High</span>
</div>
</div>
</div>
<div class="p-3 bg-blue-50 rounded-lg">
<h3 class="text-sm font-medium text-blue-800 mb-1">AI Insight</h3>
<p class="text-xs text-blue-700">Our models detect rising interest in healthcare policy among undecided voters in swing states.</p>
</div>
</div>
<!-- Main Dashboard -->
<div class="lg:col-span-3 space-y-6">
<!-- Overview Cards -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="bg-white p-4 rounded-xl shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-500">Total Mentions</p>
<h3 class="text-2xl font-bold">24,892</h3>
</div>
<div class="bg-green-100 p-3 rounded-full">
<i class="fas fa-comment-dots text-green-600"></i>
</div>
</div>
<p class="text-xs text-green-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 14% from yesterday</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-500">Positive Sentiment</p>
<h3 class="text-2xl font-bold">68%</h3>
</div>
<div class="bg-blue-100 p-3 rounded-full">
<i class="fas fa-smile text-blue-600"></i>
</div>
</div>
<p class="text-xs text-blue-600 mt-2"><i class="fas fa-arrow-up mr-1"></i> 5% from yesterday</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-500">Key Influencers</p>
<h3 class="text-2xl font-bold">142</h3>
</div>
<div class="bg-purple-100 p-3 rounded-full">
<i class="fas fa-user-tie text-purple-600"></i>
</div>
</div>
<p class="text-xs text-purple-600 mt-2">Engaging 82% of audience</p>
</div>
<div class="bg-white p-4 rounded-xl shadow-sm">
<div class="flex items-center justify-between">
<div>
<p class="text-sm text-gray-500">Opponent Ratio</p>
<h3 class="text-2xl font-bold">1.8:1</h3>
</div>
<div class="bg-red-100 p-3 rounded-full">
<i class="fas fa-balance-scale-right text-red-600"></i>
</div>
</div>
<p class="text-xs text-red-600 mt-2"><i class="fas fa-arrow-down mr-1"></i> 0.3 from last week</p>
</div>
</div>
<!-- Sentiment Analysis -->
<div class="bg-white p-5 rounded-xl shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Sentiment Analysis</h2>
<div class="flex space-x-2">
<button class="px-3 py-1 bg-gray-100 hover:bg-gray-200 text-sm rounded-lg">By Region</button>
<button class="px-3 py-1 bg-gray-100 hover:bg-gray-200 text-sm rounded-lg">By Demographics</button>
</div>
</div>
<div class="h-64">
<canvas id="sentimentChart"></canvas>
</div>
</div>
<!-- Network Analysis -->
<div class="bg-white p-5 rounded-xl shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Influence Network</h2>
<div class="text-sm text-gray-500">
<i class="fas fa-info-circle mr-1"></i> Size indicates reach, color indicates sentiment
</div>
</div>
<div class="knowledge-graph h-64 rounded-lg relative overflow-hidden flex items-center justify-center">
<div class="absolute inset-0 flex items-center justify-center">
<div class="w-48 h-48 rounded-full bg-blue-100 opacity-30"></div>
</div>
<!-- Mock network nodes -->
<div class="network-node absolute w-12 h-12 bg-green-400 rounded-full flex items-center justify-center shadow-md cursor-pointer" style="top: 30%; left: 20%">
<i class="fas fa-user text-white"></i>
</div>
<div class="network-node absolute w-16 h-16 bg-blue-400 rounded-full flex items-center justify-center shadow-md cursor-pointer" style="top: 40%; left: 50%">
<i class="fas fa-user-tie text-white"></i>
</div>
<div class="network-node absolute w-14 h-14 bg-yellow-400 rounded-full flex items-center justify-center shadow-md cursor-pointer" style="top: 60%; left: 30%">
<i class="fas fa-user-graduate text-white"></i>
</div>
<div class="network-node absolute w-10 h-10 bg-red-400 rounded-full flex items-center justify-center shadow-md cursor-pointer" style="top: 25%; left: 70%">
<i class="fas fa-user-shield text-white"></i>
</div>
<div class="network-node absolute w-8 h-8 bg-purple-400 rounded-full flex items-center justify-center shadow-md cursor-pointer" style="top: 70%; left: 70%">
<i class="fas fa-user-md text-white"></i>
</div>
<!-- Lines connecting nodes -->
<svg class="absolute inset-0 w-full h-full" style="z-index: 0;">
<line x1="20%" y1="30%" x2="50%" y2="40%" stroke="#93c5fd" stroke-width="2" stroke-dasharray="5,5" />
<line x1="50%" y1="40%" x2="30%" y2="60%" stroke="#93c5fd" stroke-width="2" stroke-dasharray="5,5" />
<line x1="50%" y1="40%" x2="70%" y2="25%" stroke="#93c5fd" stroke-width="2" stroke-dasharray="5,5" />
<line x1="50%" y1="40%" x2="70%" y2="70%" stroke="#93c5fd" stroke-width="2" stroke-dasharray="5,5" />
</svg>
</div>
<div class="mt-4 grid grid-cols-2 md:grid-cols-5 gap-2 text-xs">
<div class="flex items-center">
<div class="w-3 h-3 bg-green-400 rounded-full mr-1"></div>
<span>Strong Supporters</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 bg-blue-400 rounded-full mr-1"></div>
<span>Key Influencers</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 bg-yellow-400 rounded-full mr-1"></div>
<span>Neutral Voices</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 bg-red-400 rounded-full mr-1"></div>
<span>Opposition</span>
</div>
<div class="flex items-center">
<div class="w-3 h-3 bg-purple-400 rounded-full mr-1"></div>
<span>Media</span>
</div>
</div>
</div>
<!-- Political Profile Classification -->
<div class="bg-white p-5 rounded-xl shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Indonesian Political Profiles</h2>
<div class="text-sm text-gray-500">
<i class="fas fa-user-tag mr-1"></i> Latent Profile Analysis
</div>
</div>
<div class="grid grid-cols-2 md:grid-cols-4 gap-4">
<div class="border rounded-lg p-3 text-center">
<div class="w-12 h-12 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-landmark text-blue-600"></i>
</div>
<h3 class="font-medium">Democratic Reformists</h3>
<p class="text-xs text-gray-500">23% of population</p>
<div class="mt-2 text-xs">
<span class="inline-block bg-blue-100 text-blue-800 px-2 py-1 rounded">Progressive</span>
</div>
</div>
<div class="border rounded-lg p-3 text-center">
<div class="w-12 h-12 bg-green-100 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-mosque text-green-600"></i>
</div>
<h3 class="font-medium">Muslim Socialists</h3>
<p class="text-xs text-gray-500">18% of population</p>
<div class="mt-2 text-xs">
<span class="inline-block bg-green-100 text-green-800 px-2 py-1 rounded">Religious</span>
<span class="inline-block bg-yellow-100 text-yellow-800 px-2 py-1 rounded ml-1">Economic Left</span>
</div>
</div>
<div class="border rounded-lg p-3 text-center">
<div class="w-12 h-12 bg-purple-100 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-university text-purple-600"></i>
</div>
<h3 class="font-medium">Technocratic Centrists</h3>
<p class="text-xs text-gray-500">31% of population</p>
<div class="mt-2 text-xs">
<span class="inline-block bg-purple-100 text-purple-800 px-2 py-1 rounded">Moderate</span>
</div>
</div>
<div class="border rounded-lg p-3 text-center">
<div class="w-12 h-12 bg-red-100 rounded-full flex items-center justify-center mx-auto mb-2">
<i class="fas fa-shield-alt text-red-600"></i>
</div>
<h3 class="font-medium">National Conservatives</h3>
<p class="text-xs text-gray-500">28% of population</p>
<div class="mt-2 text-xs">
<span class="inline-block bg-red-100 text-red-800 px-2 py-1 rounded">Traditional</span>
<span class="inline-block bg-gray-100 text-gray-800 px-2 py-1 rounded ml-1">Patriotic</span>
</div>
</div>
</div>
<div class="mt-4 text-xs text-gray-500">
<i class="fas fa-info-circle mr-1"></i> Profiles derived from AI analysis of 1.2M social media profiles and survey responses
</div>
</div>
<!-- Trending Topics -->
<div class="grid grid-cols-1 lg:grid-cols-2 gap-6">
<div class="bg-white p-5 rounded-xl shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Trending Topics</h2>
<div class="text-sm text-blue-600">
<i class="fas fa-bolt mr-1"></i> Rising Fast
</div>
</div>
<div class="space-y-3">
<div class="flex items-start">
<div class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-medium mr-3 mt-1">1</div>
<div>
<h3 class="font-medium">Healthcare Reform</h3>
<p class="text-xs text-gray-500">+42% mentions in last 6h</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-medium mr-3 mt-1">2</div>
<div>
<h3 class="font-medium">Tax Policy</h3>
<p class="text-xs text-gray-500">+28% mentions in last 6h</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-blue-100 text-blue-800 px-2 py-1 rounded text-xs font-medium mr-3 mt-1">3</div>
<div>
<h3 class="font-medium">Climate Change</h3>
<p class="text-xs text-gray-500">+19% mentions in last 6h</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-gray-100 text-gray-800 px-2 py-1 rounded text-xs font-medium mr-3 mt-1">4</div>
<div>
<h3 class="font-medium">Education</h3>
<p class="text-xs text-gray-500">+12% mentions in last 6h</p>
</div>
</div>
<div class="flex items-start">
<div class="bg-gray-100 text-gray-800 px-2 py-1 rounded text-xs font-medium mr-3 mt-1">5</div>
<div>
<h3 class="font-medium">Immigration</h3>
<p class="text-xs text-gray-500">+8% mentions in last 6h</p>
</div>
</div>
</div>
</div>
<!-- Superusers -->
<div class="bg-white p-5 rounded-xl shadow-sm">
<div class="flex justify-between items-center mb-4">
<h2 class="font-semibold text-lg">Top Influencers</h2>
<div class="text-sm text-gray-500">
<i class="fas fa-star mr-1 text-yellow-500"></i> Impact Score
</div>
</div>
<div class="space-y-3">
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-blue-500 flex items-center justify-center text-white mr-3">
<i class="fas fa-user"></i>
</div>
<div class="flex-1">
<h3 class="font-medium">@PoliticalAnalyst</h3>
<p class="text-xs text-gray-500">Engagement: 92% • Reach: 1.2M</p>
</div>
<div class="text-sm font-medium text-green-600">9.8</div>
</div>
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-purple-500 flex items-center justify-center text-white mr-3">
<i class="fas fa-user-tie"></i>
</div>
<div class="flex-1">
<h3 class="font-medium">@NewsAnchor</h3>
<p class="text-xs text-gray-500">Engagement: 87% • Reach: 950K</p>
</div>
<div class="text-sm font-medium text-green-600">9.2</div>
</div>
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-green-500 flex items-center justify-center text-white mr-3">
<i class="fas fa-user-graduate"></i>
</div>
<div class="flex-1">
<h3 class="font-medium">@PolicyWonk</h3>
<p class="text-xs text-gray-500">Engagement: 84% • Reach: 780K</p>
</div>
<div class="text-sm font-medium text-green-600">8.9</div>
</div>
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-yellow-500 flex items-center justify-center text-white mr-3">
<i class="fas fa-user-md"></i>
</div>
<div class="flex-1">
<h3 class="font-medium">@EconProfessor</h3>
<p class="text-xs text-gray-500">Engagement: 79% • Reach: 650K</p>
</div>
<div class="text-sm font-medium text-blue-600">8.3</div>
</div>
<div class="flex items-center">
<div class="w-8 h-8 rounded-full bg-red-500 flex items-center justify-center text-white mr-3">
<i class="fas fa-user-shield"></i>
</div>
<div class="flex-1">
<h3 class="font-medium">@OppositionVoice</h3>
<p class="text-xs text-gray-500">Engagement: 72% • Reach: 1.1M</p>
</div>
<div class="text-sm font-medium text-blue-600">8.1</div>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
<!-- Chatbot -->
<div class="fixed bottom-6 right-6 z-50">
<div class="relative">
<!-- Chatbot Button -->
<button id="chatbotToggle" class="w-14 h-14 bg-blue-600 rounded-full shadow-lg flex items-center justify-center text-white hover:bg-blue-700 transition">
<i class="fas fa-robot text-xl"></i>
<span class="absolute -top-1 -right-1 w-5 h-5 bg-red-500 rounded-full flex items-center justify-center text-xs pulse">AI</span>
</button>
<!-- Chatbot Window -->
<div id="chatbotWindow" class="hidden absolute bottom-16 right-0 w-80 bg-white rounded-t-xl rounded-bl-xl shadow-xl overflow-hidden flex flex-col" style="height: 400px;">
<!-- Header -->
<div class="bg-blue-600 text-white p-3 flex items-center justify-between">
<div class="flex items-center">
<i class="fas fa-robot mr-2"></i>
<span class="font-medium">PoliScan AI Assistant</span>
</div>
<button id="closeChatbot" class="text-white hover:text-blue-200">
<i class="fas fa-times"></i>
</button>
</div>
<!-- Messages -->
<div id="chatbotMessages" class="flex-1 p-4 overflow-y-auto space-y-3">
<div class="chatbot-message bg-blue-50 text-blue-800 p-3 rounded-lg rounded-tl-none">
<p>Hello! I'm your PoliScan AI assistant. How can I help you analyze today's political landscape?</p>
</div>
<div class="chatbot-message bg-blue-50 text-blue-800 p-3 rounded-lg rounded-tl-none">
<p>You can ask me things like:<br>
- "What's the sentiment on healthcare policy?"<br>
- "Show me key influencers in the Midwest"<br>
- "What topics are trending among young voters?"</p>
</div>
</div>
<!-- Input -->
<div class="p-3 border-t">
<div class="flex">
<input id="chatbotInput" type="text" placeholder="Ask about the data..." class="flex-1 border rounded-l-lg px-3 py-2 text-sm focus:outline-none focus:ring-1 focus:ring-blue-500">
<button id="sendMessage" class="bg-blue-600 text-white px-4 py-2 rounded-r-lg hover:bg-blue-700 transition">
<i class="fas fa-paper-plane"></i>
</button>
</div>
<p class="text-xs text-gray-500 mt-1">AI-powered political insights</p>
</div>
</div>
</div>
</div>
<script>
// Initialize charts
document.addEventListener('DOMContentLoaded', function() {
// Sentiment Chart
const sentimentCtx = document.getElementById('sentimentChart').getContext('2d');
const sentimentChart = new Chart(sentimentCtx, {
type: 'bar',
data: {
labels: ['Healthcare', 'Economy', 'Education', 'Immigration', 'Climate', 'Foreign Policy'],
datasets: [
{
label: 'Positive',
data: [65, 58, 42, 38, 72, 55],
backgroundColor: '#4ade80',
borderRadius: 4
},
{
label: 'Neutral',
data: [20, 25, 35, 30, 15, 25],
backgroundColor: '#93c5fd',
borderRadius: 4
},
{
label: 'Negative',
data: [15, 17, 23, 32, 13, 20],
backgroundColor: '#f87171',
borderRadius: 4
}
]
},
options: {
responsive: true,
maintainAspectRatio: false,
scales: {
x: {
stacked: true,
grid: {
display: false
}
},
y: {
stacked: true,
beginAtZero: true,
max: 100,
ticks: {
callback: function(value) {
return value + '%';
}
}
}
},
plugins: {
legend: {
position: 'top',
},
tooltip: {
callbacks: {
label: function(context) {
return context.dataset.label + ': ' + context.raw + '%';
}
}
}
}
}
});
// Chatbot functionality
const chatbotToggle = document.getElementById('chatbotToggle');
const chatbotWindow = document.getElementById('chatbotWindow');
const closeChatbot = document.getElementById('closeChatbot');
const chatbotMessages = document.getElementById('chatbotMessages');
const chatbotInput = document.getElementById('chatbotInput');
const sendMessage = document.getElementById('sendMessage');
chatbotToggle.addEventListener('click', function() {
chatbotWindow.classList.toggle('hidden');
});
closeChatbot.addEventListener('click', function() {
chatbotWindow.classList.add('hidden');
});
function addBotMessage(message) {
const messageDiv = document.createElement('div');
messageDiv.className = 'chatbot-message bg-blue-50 text-blue-800 p-3 rounded-lg rounded-tl-none';
messageDiv.innerHTML = `<p>${message}</p>`;
chatbotMessages.appendChild(messageDiv);
chatbotMessages.scrollTop = chatbotMessages.scrollHeight;
}
function addUserMessage(message) {
const messageDiv = document.createElement('div');
messageDiv.className = 'chatbot-message ml-auto bg-gray-100 text-gray-800 p-3 rounded-lg rounded-tr-none';
messageDiv.innerHTML = `<p>${message}</p>`;
chatbotMessages.appendChild(messageDiv);
chatbotMessages.scrollTop = chatbotMessages.scrollHeight;
}
sendMessage.addEventListener('click', function() {
const message = chatbotInput.value.trim();
if (message) {
addUserMessage(message);
chatbotInput.value = '';
// Simulate AI response
setTimeout(() => {
const responses = [
"Our sentiment analysis shows 68% positive mentions about healthcare policy in swing states.",
"The top 3 influencers discussing this topic are @PoliticalAnalyst, @NewsAnchor, and @PolicyWonk.",
"Healthcare mentions have increased by 42% in the last 6 hours, primarily among voters aged 35-54.",
"Our network analysis identifies 12 key nodes amplifying this message with a combined reach of 4.2M.",
"Would you like me to generate a detailed report on this trend?"
];
addBotMessage(responses[Math.floor(Math.random() * responses.length)]);
}, 800);
}
});
chatbotInput.addEventListener('keypress', function(e) {
if (e.key === 'Enter') {
sendMessage.click();
}
});
// Make network nodes interactive
const networkNodes = document.querySelectorAll('.network-node');
networkNodes.forEach(node => {
node.addEventListener('click', function() {
const tooltip = document.createElement('div');
tooltip.className = 'absolute bg-white p-2 rounded shadow-lg text-xs z-50';
tooltip.style.top = '-40px';
tooltip.style.left = '50%';
tooltip.style.transform = 'translateX(-50%)';
tooltip.innerHTML = 'Influence Score: 8.7<br>Reach: 1.1M';
// Remove any existing tooltip
const existingTooltip = this.querySelector('.tooltip');
if (existingTooltip) {
existingTooltip.remove();
}
tooltip.classList.add('tooltip');
this.appendChild(tooltip);
// Remove tooltip after 3 seconds
setTimeout(() => {
tooltip.remove();
}, 3000);
});
});
});
</script>
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=daffafrs/nagara-institute-prototype" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
</html> |