Skip to content

Real-time dashboard for monitoring global news, markets, and geopolitical events

TypeScript

Add mobile responsive design with hamburger menu

Sean Thielen-Esparza45f189ed2f31
diff --git a/index.html b/index.html
index beaa0b8..270492c 100644
--- a/index.html
+++ b/index.html
@@ -15,9 +15,26 @@
<span class="status" id="status">Ready</span>
</div>
<div class="header-right">
- <button class="refresh-btn monitors-btn" onclick="openMonitorForm()">+ Monitor</button>
- <button class="settings-btn" onclick="toggleSettings()">Panels</button>
- <button class="refresh-btn" id="refreshBtn" onclick="refreshAll()">Refresh</button>
+ <!-- Hamburger menu (hidden on desktop) -->
+ <button class="hamburger-btn" id="hamburgerBtn" onclick="toggleMobileMenu()" aria-label="Menu">
+ <span class="hamburger-line"></span>
+ <span class="hamburger-line"></span>
+ <span class="hamburger-line"></span>
+ </button>
+
+ <!-- Mobile menu dropdown -->
+ <div class="mobile-menu" id="mobileMenu">
+ <button class="refresh-btn monitors-btn" onclick="openMonitorForm(); closeMobileMenu()">+ Monitor</button>
+ <button class="settings-btn" onclick="toggleSettings(); closeMobileMenu()">Panels</button>
+ <button class="refresh-btn" onclick="refreshAll(); closeMobileMenu()">Refresh</button>
+ </div>
+
+ <!-- Desktop nav (hidden on mobile) -->
+ <div class="desktop-nav">
+ <button class="refresh-btn monitors-btn" onclick="openMonitorForm()">+ Monitor</button>
+ <button class="settings-btn" onclick="toggleSettings()">Panels</button>
+ <button class="refresh-btn" id="refreshBtn" onclick="refreshAll()">Refresh</button>
+ </div>
</div>
</header>
diff --git a/js/main.js b/js/main.js
index 7a0cf25..aad02e1 100644
--- a/js/main.js
+++ b/js/main.js
@@ -42,6 +42,41 @@ window.saveMonitor = () => saveMonitor(refreshAll);
window.editMonitor = editMonitor;
window.deleteMonitor = (id) => deleteMonitor(id, refreshAll);
+// Mobile menu functions
+function getMobileMenuElements() {
+ return {
+ menu: document.getElementById('mobileMenu'),
+ btn: document.getElementById('hamburgerBtn')
+ };
+}
+
+function toggleMobileMenu() {
+ const { menu, btn } = getMobileMenuElements();
+ menu?.classList.toggle('open');
+ btn?.classList.toggle('active');
+}
+
+function closeMobileMenu() {
+ const { menu, btn } = getMobileMenuElements();
+ menu?.classList.remove('open');
+ btn?.classList.remove('active');
+}
+
+// Close mobile menu on outside click or resize to desktop
+document.addEventListener('click', (e) => {
+ const { menu, btn } = getMobileMenuElements();
+ const isOpen = menu?.classList.contains('open');
+ const clickedOutside = !menu?.contains(e.target) && !btn?.contains(e.target);
+ if (isOpen && clickedOutside) closeMobileMenu();
+});
+
+window.addEventListener('resize', () => {
+ if (window.innerWidth > 768) closeMobileMenu();
+});
+
+window.toggleMobileMenu = toggleMobileMenu;
+window.closeMobileMenu = closeMobileMenu;
+
// Staged refresh - loads critical data first for faster perceived startup
async function refreshAll() {
console.log('refreshAll started');
diff --git a/styles.css b/styles.css
index e5cfc87..4ff6faa 100644
--- a/styles.css
+++ b/styles.css
@@ -4826,3 +4826,336 @@
.custom-hotspot-popup-close:hover {
color: var(--text);
}
+
+/* ==========================================
+ MOBILE RESPONSIVE STYLES
+ ========================================== */
+
+/* Hamburger Menu Button */
+.hamburger-btn {
+ display: none;
+ flex-direction: column;
+ justify-content: space-between;
+ width: 28px;
+ height: 20px;
+ background: transparent;
+ border: none;
+ cursor: pointer;
+ padding: 0;
+ z-index: 1001;
+}
+
+.hamburger-line {
+ display: block;
+ width: 100%;
+ height: 2px;
+ background: var(--text);
+ transition: all 0.3s ease;
+}
+
+.hamburger-btn.active .hamburger-line:nth-child(1) {
+ transform: rotate(45deg) translate(5px, 6px);
+}
+
+.hamburger-btn.active .hamburger-line:nth-child(2) {
+ opacity: 0;
+}
+
+.hamburger-btn.active .hamburger-line:nth-child(3) {
+ transform: rotate(-45deg) translate(5px, -6px);
+}
+
+/* Mobile Menu Dropdown */
+.mobile-menu {
+ display: none;
+ position: fixed;
+ top: 50px;
+ right: 0;
+ background: var(--bg);
+ border: 1px solid var(--border);
+ border-top: none;
+ padding: 1rem;
+ flex-direction: column;
+ gap: 0.75rem;
+ z-index: 1000;
+ min-width: 180px;
+ box-shadow: -2px 4px 12px rgba(0,0,0,0.5);
+}
+
+.mobile-menu.open {
+ display: flex;
+}
+
+.mobile-menu button {
+ width: 100%;
+ min-height: 44px;
+ padding: 0.75rem 1rem;
+ font-size: 0.75rem;
+}
+
+/* Desktop navigation wrapper */
+.desktop-nav {
+ display: flex;
+ align-items: center;
+ gap: 0.75rem;
+}
+
+/* ==========================================
+ TABLET BREAKPOINT (768px)
+ ========================================== */
+@media (max-width: 768px) {
+ /* Header adjustments */
+ .header {
+ padding: 0.5rem 1rem;
+ position: sticky;
+ top: 0;
+ }
+
+ .header-left {
+ gap: 0.75rem;
+ }
+
+ .title {
+ font-size: 0.7rem;
+ }
+
+ .status {
+ display: none;
+ }
+
+ /* Show hamburger, hide desktop nav */
+ .hamburger-btn {
+ display: flex;
+ }
+
+ .desktop-nav {
+ display: none;
+ }
+
+ /* Map height reduction */
+ .panel[data-panel="map"] {
+ height: 350px !important;
+ }
+
+ #mapSvg {
+ height: 100% !important;
+ }
+
+ /* Hide map legend on mobile */
+ #mapLegend {
+ display: none;
+ }
+
+ /* Panel content adjustments */
+ .panel-content {
+ max-height: 320px;
+ }
+
+ /* Touch-friendly item targets */
+ .item {
+ padding: 0.75rem 1rem;
+ min-height: 44px;
+ }
+
+ .item-title {
+ font-size: 0.75rem;
+ line-height: 1.4;
+ }
+
+ .item-source,
+ .item-time {
+ font-size: 0.6rem;
+ }
+
+ /* Panel header touch targets */
+ .panel-header {
+ padding: 0.6rem 1rem;
+ min-height: 44px;
+ cursor: default;
+ }
+
+ .panel-title {
+ font-size: 0.6rem;
+ }
+
+ .panel-count {
+ font-size: 0.55rem;
+ }
+
+ /* Hide resize handles on mobile */
+ .panel-resize-handle {
+ display: none;
+ }
+
+ /* Settings modal improvements */
+ .settings-content {
+ width: 95%;
+ max-width: none;
+ max-height: 90vh;
+ padding: 1rem;
+ }
+
+ .settings-close {
+ min-height: 48px;
+ font-size: 0.75rem;
+ }
+
+ /* Monitor form modal improvements */
+ .monitor-form {
+ width: 95%;
+ max-width: none;
+ padding: 1rem;
+ }
+
+ .monitor-form-input {
+ font-size: 16px;
+ padding: 0.6rem;
+ min-height: 44px;
+ }
+
+ .monitor-form-actions button {
+ min-height: 48px;
+ }
+
+ /* Toggle switch size increase for touch */
+ .toggle-switch {
+ width: 44px;
+ height: 24px;
+ border-radius: 12px;
+ }
+
+ .toggle-switch::after {
+ width: 20px;
+ height: 20px;
+ }
+
+ .toggle-switch.on::after {
+ transform: translateX(20px);
+ }
+
+ /* Market items */
+ .market-item {
+ padding: 0.6rem 1rem;
+ min-height: 40px;
+ }
+
+ /* Grid sections - single column on mobile */
+ .correlation-sections,
+ .narrative-sections {
+ grid-template-columns: 1fr;
+ gap: 0.5rem;
+ }
+
+ .correlation-section-header,
+ .narrative-section-header {
+ padding: 0.5rem;
+ }
+}
+
+/* ==========================================
+ SMALL PHONE BREAKPOINT (480px)
+ ========================================== */
+@media (max-width: 480px) {
+ /* Header compact mode */
+ .header {
+ padding: 0.5rem 0.75rem;
+ }
+
+ .title {
+ font-size: 0.65rem;
+ letter-spacing: 0.05em;
+ }
+
+ .header-left {
+ gap: 0.5rem;
+ }
+
+ /* Map smaller on phones */
+ .panel[data-panel="map"] {
+ height: 280px !important;
+ }
+
+ /* Tighter panel content */
+ .panel-content {
+ max-height: 280px;
+ }
+
+ /* Items */
+ .item {
+ padding: 0.6rem 0.75rem;
+ }
+
+ .item-title {
+ font-size: 0.7rem;
+ }
+
+ /* Mobile menu full width */
+ .mobile-menu {
+ left: 0;
+ min-width: 100%;
+ border-inline: none;
+ }
+
+ /* Full-screen modals on small phones */
+ .settings-modal.open,
+ .monitor-form-overlay.open {
+ align-items: flex-start;
+ padding-top: 0;
+ }
+
+ .settings-content,
+ .monitor-form {
+ width: 100%;
+ height: 100vh;
+ max-height: 100vh;
+ border: none;
+ border-radius: 0;
+ }
+
+ /* Wide panel items */
+ .polymarket-item,
+ .contract-item,
+ .intel-item {
+ padding: 0.5rem 0.75rem;
+ }
+
+ /* Sector heatmap adjustments */
+ .sector-item {
+ min-width: 50px;
+ font-size: 0.55rem;
+ padding: 0.4rem 0.3rem;
+ }
+
+ /* Commodity items */
+ .commodity-item {
+ min-width: 70px;
+ }
+}
+
+/* ==========================================
+ TOUCH DEVICE ENHANCEMENTS
+ ========================================== */
+@media (hover: none) and (pointer: coarse) {
+ /* Disable hover states, enable active states for touch feedback */
+ .item:hover,
+ .panel-header:hover {
+ background: transparent;
+ }
+
+ .item:active,
+ .panel-header:active {
+ background: var(--surface);
+ }
+
+ /* Hide map tooltip on touch - unusable */
+ #mapTooltip {
+ display: none !important;
+ }
+
+ /* Larger touch targets */
+ button,
+ .toggle-switch,
+ [onclick] {
+ min-height: 44px;
+ }
+}