|
| 1 | +""" |
| 2 | +Create a simple multi-page HTML dashboard with direct links |
| 3 | +""" |
| 4 | + |
| 5 | +def create_dashboard_html(): |
| 6 | + """Create the main dashboard HTML with navigation""" |
| 7 | + |
| 8 | + charts = [ |
| 9 | + { |
| 10 | + "name": "Threat Perception", |
| 11 | + "file": "threat-perception-analysis.html", |
| 12 | + "description": "Central Asian Regional Threat Perception Analysis" |
| 13 | + }, |
| 14 | + { |
| 15 | + "name": "Supplier Influence", |
| 16 | + "file": "chart1-supplier-influence.html", |
| 17 | + "description": "Defense Supplier Influence 3D Surface" |
| 18 | + }, |
| 19 | + { |
| 20 | + "name": "Defense Systems", |
| 21 | + "file": "chart3-defense-systems.html", |
| 22 | + "description": "Defense Systems Analysis" |
| 23 | + }, |
| 24 | + { |
| 25 | + "name": "Multi-Country Radar", |
| 26 | + "file": "chart4-multi-country-radar.html", |
| 27 | + "description": "Multi-Country Radar Comparison" |
| 28 | + }, |
| 29 | + { |
| 30 | + "name": "Priorities Heatmap", |
| 31 | + "file": "chart5-priorities-heatmap.html", |
| 32 | + "description": "Defense Priorities Heatmap" |
| 33 | + }, |
| 34 | + { |
| 35 | + "name": "Supplier Connections", |
| 36 | + "file": "chart7-supplier-connections.html", |
| 37 | + "description": "Supplier Connections Sankey Diagram" |
| 38 | + }, |
| 39 | + ] |
| 40 | + |
| 41 | + # Create navigation HTML |
| 42 | + nav_items = "" |
| 43 | + for i, chart in enumerate(charts): |
| 44 | + nav_items += f' <li class="nav-item"><a class="nav-link" href="{chart["file"]}">{chart["name"]}</a></li>\n' |
| 45 | + |
| 46 | + # Create index/home page |
| 47 | + index_html = f"""<!DOCTYPE html> |
| 48 | +<html lang="en"> |
| 49 | +<head> |
| 50 | + <meta charset="UTF-8"> |
| 51 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| 52 | + <title>Geopolitical Dashboard</title> |
| 53 | + <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"> |
| 54 | + <style> |
| 55 | + body {{ |
| 56 | + background: linear-gradient(135deg, #0d1b2a 0%, #1a1a2e 100%); |
| 57 | + color: #fff; |
| 58 | + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; |
| 59 | + min-height: 100vh; |
| 60 | + }} |
| 61 | + .navbar {{ |
| 62 | + background-color: #0d1b2a; |
| 63 | + border-bottom: 2px solid #1e90ff; |
| 64 | + }} |
| 65 | + .navbar-brand {{ |
| 66 | + font-weight: bold; |
| 67 | + font-size: 1.5rem; |
| 68 | + color: #1e90ff !important; |
| 69 | + }} |
| 70 | + .nav-link {{ |
| 71 | + color: #aaa !important; |
| 72 | + transition: color 0.3s; |
| 73 | + margin: 0 5px; |
| 74 | + }} |
| 75 | + .nav-link:hover {{ |
| 76 | + color: #1e90ff !important; |
| 77 | + }} |
| 78 | + .hero {{ |
| 79 | + text-align: center; |
| 80 | + padding: 60px 20px; |
| 81 | + }} |
| 82 | + .hero h1 {{ |
| 83 | + font-size: 3rem; |
| 84 | + font-weight: bold; |
| 85 | + color: #1e90ff; |
| 86 | + margin-bottom: 20px; |
| 87 | + text-shadow: 0 2px 10px rgba(30, 144, 255, 0.3); |
| 88 | + }} |
| 89 | + .hero p {{ |
| 90 | + font-size: 1.3rem; |
| 91 | + color: #aaa; |
| 92 | + margin-bottom: 40px; |
| 93 | + }} |
| 94 | + .charts-grid {{ |
| 95 | + display: grid; |
| 96 | + grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); |
| 97 | + gap: 20px; |
| 98 | + padding: 40px 20px; |
| 99 | + }} |
| 100 | + .chart-card {{ |
| 101 | + background-color: #0d1b2a; |
| 102 | + border: 2px solid #1e90ff; |
| 103 | + border-radius: 8px; |
| 104 | + padding: 20px; |
| 105 | + transition: all 0.3s; |
| 106 | + cursor: pointer; |
| 107 | + text-decoration: none; |
| 108 | + color: #fff; |
| 109 | + }} |
| 110 | + .chart-card:hover {{ |
| 111 | + transform: translateY(-5px); |
| 112 | + box-shadow: 0 8px 20px rgba(30, 144, 255, 0.3); |
| 113 | + border-color: #00d4ff; |
| 114 | + }} |
| 115 | + .chart-card h3 {{ |
| 116 | + color: #1e90ff; |
| 117 | + margin-bottom: 10px; |
| 118 | + }} |
| 119 | + .chart-card p {{ |
| 120 | + color: #aaa; |
| 121 | + font-size: 0.95rem; |
| 122 | + }} |
| 123 | + .footer {{ |
| 124 | + background-color: #0d1b2a; |
| 125 | + border-top: 2px solid #1e90ff; |
| 126 | + padding: 20px; |
| 127 | + text-align: center; |
| 128 | + color: #aaa; |
| 129 | + margin-top: 40px; |
| 130 | + }} |
| 131 | + </style> |
| 132 | +</head> |
| 133 | +<body> |
| 134 | + <nav class="navbar navbar-expand-lg navbar-dark"> |
| 135 | + <div class="container-fluid"> |
| 136 | + <a class="navbar-brand" href="index.html">🌍 Geopolitical Dashboard</a> |
| 137 | + <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav"> |
| 138 | + <span class="navbar-toggler-icon"></span> |
| 139 | + </button> |
| 140 | + <div class="collapse navbar-collapse" id="navbarNav"> |
| 141 | + <ul class="navbar-nav ms-auto"> |
| 142 | +{nav_items} </ul> |
| 143 | + </div> |
| 144 | + </div> |
| 145 | + </nav> |
| 146 | +
|
| 147 | + <div class="hero"> |
| 148 | + <h1>🌍 Geopolitical Analysis Dashboard</h1> |
| 149 | + <p>Central Asian Regional Threat Perception & Defense Analysis</p> |
| 150 | + </div> |
| 151 | +
|
| 152 | + <div class="container-fluid"> |
| 153 | + <div class="charts-grid"> |
| 154 | +""" |
| 155 | + |
| 156 | + for i, chart in enumerate(charts): |
| 157 | + index_html += f""" <a href="{chart["file"]}" class="chart-card"> |
| 158 | + <h3>{chart["name"]}</h3> |
| 159 | + <p>{chart["description"]}</p> |
| 160 | + </a> |
| 161 | +""" |
| 162 | + |
| 163 | + index_html += """ </div> |
| 164 | + </div> |
| 165 | +
|
| 166 | + <div class="footer"> |
| 167 | + <p>© 2025 Geopolitical Analysis Dashboard | Built with Plotly & Bootstrap</p> |
| 168 | + <p>Created by: A.K. Faver</p> |
| 169 | + </div> |
| 170 | +
|
| 171 | + <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script> |
| 172 | +</body> |
| 173 | +</html>""" |
| 174 | + |
| 175 | + with open("index.html", "w") as f: |
| 176 | + f.write(index_html) |
| 177 | + print("✅ Created index.html - Dashboard Home") |
| 178 | + |
| 179 | +if __name__ == '__main__': |
| 180 | + print("=" * 70) |
| 181 | + print("CREATING SIMPLE MULTI-PAGE HTML DASHBOARD") |
| 182 | + print("=" * 70) |
| 183 | + print() |
| 184 | + create_dashboard_html() |
| 185 | + print() |
| 186 | + print("=" * 70) |
| 187 | + print("✅ DASHBOARD CREATED!") |
| 188 | + print("=" * 70) |
0 commit comments