diff --git a/README.md b/README.md index 147602b..7df175d 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ Active momentum day trading requires spotting low-float runners the split second **NewsAlerts bridges this gap with a focused, zero-bloat institutional trading terminal designed for pure execution speed:** -- โšก **Zero-Latency Inbound Alerts**: Plays an instant audio chime (with interactive volume control & one-click pause) and sends Telegram push notifications the exact second a ticker breaches your screening criteria. +- โšก **Zero-Latency Inbound Alerts & Dual Topbar Toggles**: Instant audio chimes (with interactive volume control & dedicated in-app audio bell) alongside independent Telegram push notifications with a dedicated 1-click topbar toggle (Telegram paper plane + bell) to silence mobile phone alerts when operating directly at your desk. - ๐ŸŒŠ **Running Momentum Tape**: Warrior-Trading style High of Day (HOD) and Squeeze Breakout prints with 4-day local disk persistence for weekend and off-hours trade review. - ๐ŸŽฏ **Interactive Strategy Builder & Tape Quick-Filter**: Construct customized momentum rules (`+ Add Strategy`) with trigger selectors, float ranges, and surge velocities in Settings, with instant one-click toggles right from the tape header (`Strategies 11/13`). - ๐Ÿ“‹ **TradingView Cloud Watchlist Sync & 1-Click Quick-Add**: Real-time cloud watchlist selector bar docked directly above news headlines, paired with 1-click quick-add (`+`) buttons next to tickers in the Screener, Tape, and News header. Features 3-second green/red flickering feedback and instant cloud sync directly into your TradingView Desktop app. @@ -52,7 +52,7 @@ Active momentum day trading requires spotting low-float runners the split second NewsAlerts Real-Time Momentum Terminal
- Live institutional terminal capture (v2.11.0): Real-time screener with 1-click watchlist quick-add, high-of-day momentum tape, TradingView cloud watchlist selector, interactive topbar ๐Ÿšซ Banned / Closing-Only filter, catalyst news wire, and BamSEC SEC filings intelligence. + Live institutional terminal capture (v2.12.0): Real-time screener with 1-click watchlist quick-add, high-of-day momentum tape, TradingView cloud watchlist selector, dual in-app audio & Telegram alert toggles, interactive topbar ๐Ÿšซ Banned / Closing-Only filter, catalyst news wire, and BamSEC SEC filings intelligence.

diff --git a/VERSION b/VERSION index 9e5bb77..d8b6989 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.11.2 +2.12.0 diff --git a/app/api.py b/app/api.py index 233ae1b..ab8045f 100644 --- a/app/api.py +++ b/app/api.py @@ -104,7 +104,7 @@ def save_config(self, cfg: dict): bot_token=ac.get("telegram_bot_token", ""), chat_id=ac.get("telegram_chat_id", ""), enabled=bool(ac.get("telegram_enabled", True)), - paused=is_paused + paused=False ) a.sounds.muted = is_paused if "volume" in ac: diff --git a/app/main.py b/app/main.py index bea0cdb..bd5f312 100644 --- a/app/main.py +++ b/app/main.py @@ -73,7 +73,7 @@ def __init__(self) -> None: bot_token=ac.get("telegram_bot_token", ""), chat_id=ac.get("telegram_chat_id", ""), enabled=bool(ac.get("telegram_enabled", True)), - paused=is_paused + paused=False ) self.sounds = SoundPlayer(volume=int(ac.get("volume", 80))) self.sounds.muted = is_paused diff --git a/app/screener.py b/app/screener.py index f28209e..5667103 100644 --- a/app/screener.py +++ b/app/screener.py @@ -211,7 +211,7 @@ def _poll_screen(self, screen: dict, c: dict, active: bool) -> None: for t in alert_syms: if t in by_t: row_data = by_t[t] - if self.telegram and c["alerts"].get("telegram_enabled", True) and not is_paused: + if self.telegram and c["alerts"].get("telegram_enabled", True): cached = self.news.cached(t) fresh = NewsService.recent(cached, c["news"]["recency_hours"]) if cached else [] latest_title = fresh[0]["title"] if fresh else "" diff --git a/app/tape.py b/app/tape.py index bfd5eb0..c882161 100644 --- a/app/tape.py +++ b/app/tape.py @@ -192,7 +192,7 @@ def tick(self) -> None: self.sounds.play(c["alerts"]["sound_tape"]) # Send Telegram push alert for matching tape momentum events - tg_on = c["alerts"].get("telegram_enabled", True) and c["alerts"].get("telegram_tape_enabled", True) and not is_paused + tg_on = c["alerts"].get("telegram_enabled", True) and c["alerts"].get("telegram_tape_enabled", True) if self.telegram and tg_on: tg_cd = float(c["alerts"].get("telegram_tape_cooldown_sec", 60)) for ev in unbanned_events: diff --git a/assets/hero.jpg b/assets/hero.jpg index 460fe94..eef2987 100644 Binary files a/assets/hero.jpg and b/assets/hero.jpg differ diff --git a/assets/social_preview.png b/assets/social_preview.png index 8e2f357..aadafea 100644 Binary files a/assets/social_preview.png and b/assets/social_preview.png differ diff --git a/docs/RELEASES.md b/docs/RELEASES.md index c62808f..9645d0c 100644 --- a/docs/RELEASES.md +++ b/docs/RELEASES.md @@ -37,6 +37,7 @@ All official releases are produced deterministically through GitHub Actions: ## Release History +- [v2.12.0 Release Notes](releases/v2.12.0.md) โ€” Introduced Dual Independent Alert Controls Architecture with dedicated topbar Telegram alert toggle icon (Telegram paper airplane + bell) decoupled from in-app audio chimes for instant desk/mobile alert switching (Resolves #65). - [v2.11.2 Release Notes](releases/v2.11.2.md) โ€” Refactored documentation feature showcase tables in `README.md` and `docs/SPEC.md` to prominent 68/32 image-first HTML tables for instant visual clarity, and added dedicated cross-platform `make env`, `make env-win`, `make env-linux`, `make env-mac`, and `build.ps1 -Task env` targets (Resolves #63). - [v2.11.1 Release Notes](releases/v2.11.1.md) โ€” Added toggleable opt-out capability for BamSEC SEC filings in Settings (opt-in by default), with complete DOM element unmounting, background scraper and network call suppression, and instant reactive live update on save (Resolves #61). - [v2.11.0 Release Notes](releases/v2.11.0.md) โ€” Integrated real-time BamSEC (by AlphaSense) SEC EDGAR filings intelligence into the News pane with both Collapsible Accordion Drawer and Sub-Tabs layouts, color-coded badges for material news, offerings & dilution, ownership, and financials, one-click browser launching, and F11 full-screen showcase protocol (Resolves #57). diff --git a/docs/SPEC.md b/docs/SPEC.md index 06fbf82..f370e04 100644 --- a/docs/SPEC.md +++ b/docs/SPEC.md @@ -500,7 +500,7 @@ Optional tape sound (default off โ€” the tape is noisy). - **Rich Message Format**: Includes Symbol, Strategy name, Session, Price, Change %, Volume, Float, Relative Volume (daily + 5m%), Short Borrow Status (`HTB` / `ETB` / `NO BORROW` / `N/A`), 52w range position, and a direct TradingView chart link. - **Per-Symbol Cooldown**: A per-ticker cooldown (default 60s, configurable in Settings) prevents rapid duplicate push notifications when a runner repeatedly prints new HODs in seconds. -## 9. Sounds & Alert Controls +## 9. Sounds & Dual Alert Controls Architecture - **System Sounds**: Lists all `.wav` files in `C:\Windows\Media` (Windows Notify, Ding, chimes, Alarm01โ€“10, etc.). - **Separate Sound Pickers**: **New screener symbol**, **New news**, **Tape event**; โ–ถ test button each. - **Async Throttled Playback**: Played async via `winsound.PlaySound(path, SND_FILENAME | SND_ASYNC)`; throttled to 1 per 1.5 s. @@ -509,10 +509,19 @@ Optional tape sound (default off โ€” the tape is noisy). - Clicking or dragging across the triangle instantly adjusts the volume. - Per-process waveform audio volume synchronized seamlessly via Windows WinMM `waveOutSetVolume` without external dependencies. - Clicking the speaker icon quickly toggles mute / restores prior volume level. -- **Unified Alert Pause (The Bell Button)**: - - Single master toggle for active alerts vs. paused alerts. - - Clicking the bell button **both mutes audio chimes AND suspends sending push notifications to Telegram** (for both Screener new symbols and Tape momentum alerts). - - Visual status feedback: when active, shows normal green-tinted bell; when paused, shows slashed bell (`bellOff`) with pulsing red warning indicator. +- **Dual Independent Alert Toggles**: + - **In-App Audio Alerts Bell (`#btn-mute`)**: + - Dedicated audio alert toggle button in the topbar. + - Clicking toggles local workstation waveform audio chimes on or off (`alerts.mute`). + - Visual feedback: Vibrant green bell (`#38efb0`) when active; red-tinted slashed bell (`#ff6b7e`) with pulsing glow (`pausePulse`) when muted. + - Decoupled from Telegram: muting local audio does NOT silence mobile/desktop Telegram push notifications. + - **Telegram Push Alerts Bell (`#btn-telegram`)**: + - Dedicated Telegram alert toggle button in the topbar adjacent to the audio bell. + - Custom icon featuring the iconic Telegram paper airplane combined with a bell badge. + - Clicking toggles Telegram push notification dispatch on or off (`alerts.telegram_enabled`). + - Visual feedback: Vibrant Telegram Blue (`#29b6f6`) when active; red-tinted slashed Telegram+bell (`#ff6b7e`) with pulsing glow (`pausePulse`) when paused. + - Directly synchronized with Settings → Alerts → *Enable Telegram Alerts*. + - Designed specifically for active desk workflows: traders sitting in front of the terminal can silence mobile Telegram notifications with 1 click while preserving local audio alert chimes. ## 10. Settings & Integrations TradingView `sessionid`/`sessionid_sign` & real-time connection status ยท poll intervals ยท re-entry window ยท alert volume (0%โ€“100%) ยท unified pause alerts toggle ยท news recency & provider ยท sounds ยท tape universe & strategy thresholds ยท interactive Strategy Builder (`+ Add Strategy`, triggers, family, deletion) ยท Backup / Import & Export tab (Full config backup `.json`, Strategies `.json` export/import, factory reset) ยท Alpaca keys for short borrow locates ยท Telegram Bot Token, Chat ID, and independent toggles for Screener alerts and Tape momentum alerts (with per-symbol cooldown) ยท customizable keyboard shortcuts & hotkeys with interactive re-binding and institutional defaults ยท always-on-top ยท font size. diff --git a/docs/img/terminal.png b/docs/img/terminal.png index e8bca52..ad28bf3 100644 Binary files a/docs/img/terminal.png and b/docs/img/terminal.png differ diff --git a/docs/releases/v2.12.0.md b/docs/releases/v2.12.0.md new file mode 100644 index 0000000..f8bf1a9 --- /dev/null +++ b/docs/releases/v2.12.0.md @@ -0,0 +1,54 @@ +# NewsAlerts v2.12.0 โ€” Release Notes + +**Release Date:** October 2026 +**Type:** Minor Release (`MINOR` โ€” Dual Independent In-App Audio & Telegram Topbar Alert Controls) +**Single Source of Truth:** `VERSION` (`2.12.0`) + +--- + +## ๐Ÿš€ Overview + +NewsAlerts **v2.12.0** introduces a **Dual Independent Alert Controls Architecture** with dedicated topbar toggles: +1. **Dedicated Topbar Telegram Alert Toggle (`#btn-telegram`)**: Adds an institutional topbar icon combining the iconic Telegram paper airplane with an alert bell badge. Traders can now mute or resume Telegram mobile & desktop push notifications with a single click directly from the header without opening Settings. +2. **Decoupled In-App Audio Bell (`#btn-mute`)**: Decouples the primary audio bell toggle so it strictly governs local PC waveform audio alert chimes (`alerts.mute`). When active momentum day traders are operating directly in front of the workstation, they can silence noisy Telegram phone alerts with 1 click while preserving essential zero-latency PC audio chimes. +3. **Synchronized State & Hotkeys**: Bidirectional synchronization connects the topbar Telegram button directly with Settings → Alerts → *Enable Telegram Alerts*. Supports customizable hotkeys for both local audio mute and Telegram push notification toggling. + +--- + +## ๐ŸŒŸ Key Changes & Improvements + +### 1. Dedicated Topbar Telegram Alerts Toggle (Issue #65) +- Added `#btn-telegram` immediately adjacent to the audio bell in the topbar header. +- **Custom Vector Icon**: Custom high-DPI SVG combining the Telegram paper airplane pointing northeast with a docked alert bell badge. +- **Institutional Status Feedback**: + - **Active State**: Rendered in Telegram Blue (`#29b6f6`) with soft border glow and interactive hover states. + - **Paused State**: Switches to a slashed vector strike (`tgBellOff`) with red-tinted background (`rgba(246, 70, 93, 0.14)`), red border (`#ff6b7e`), and pulsing alert warning glow (`pausePulse`). +- **One-Click Instant Execution**: Toggling updates `alerts.telegram_enabled` in real-time, persists to `config.json`, and reflects immediately across the terminal UI. + +### 2. Fully Decoupled Alert Engine +- **In-App Audio Chimes**: Governed exclusively by `alerts.mute`. Muting local sound chimes no longer suppresses Telegram push alerts if Telegram is enabled. +- **Telegram Push Notifications**: Governed exclusively by `alerts.telegram_enabled` (and tape-specific filters/cooldowns). Silencing Telegram at your desk leaves local workstation audio bells fully functional. +- Updated backend dispatch in `app/screener.py`, `app/tape.py`, `app/api.py`, and `app/main.py`. + +### 3. Keyboard Shortcut & Hotkey Integration +- Default `m` hotkey preserved for rapid In-App Audio Mute. +- Added `toggle_telegram` hotkey action in keyboard shortcuts configuration, allowing traders to map any preferred key combination to instant Telegram toggling. + +### 4. Startup Alert State Synchronization (Bug Fix) +- Resolved an issue where closing the app with Alerts muted resulted in the topbar alert button displaying as active upon re-opening. +- Both `#btn-mute` and `#btn-telegram` now immediately synchronize their icons, titles, and `.paused` CSS classes against persisted configuration during `init()`. + +--- + +## ๐ŸŽฏ Closed Issues + +- **Resolves #65**: [feat(alerts): add dedicated telegram alerts toggle button in topbar](https://github.com/mlgitdev/NewsAlerts/issues/65) + +--- + +## ๐Ÿงช Verification & Test Suite + +- Added comprehensive unit tests in `tests/test_alert_controls.py` verifying independent audio and Telegram alert states. +- Verified all 66 unit tests pass (`make test` / `python -m unittest discover tests`). +- Verified Python syntax compilation across `app`, `run_app.py`, and `tests`. +- Zero secrets committed. diff --git a/docs/wiki/Audio-Alerts-&-Volume-Controls.md b/docs/wiki/Audio-Alerts-&-Volume-Controls.md index 4639f0d..a2f81c3 100644 --- a/docs/wiki/Audio-Alerts-&-Volume-Controls.md +++ b/docs/wiki/Audio-Alerts-&-Volume-Controls.md @@ -4,14 +4,15 @@ Auditory alerting allows momentum traders to keep their eyes on charting softwar --- -## ๐Ÿ”” Master Bell Toggle (The Bell) +## ๐Ÿ”” In-App Audio Alerts Bell (`#btn-mute`) - Located in the top-right header of the terminal (bell icon). -- **Hotkey**: Press `M` to toggle mute. -- **Unified Control**: Clicking the bell immediately: - 1. Mutes all audible chimes and bells. - 2. Pauses outgoing Telegram alert dispatching. -- The bell icon dynamically displays an amber strikethrough badge when muted. +- **Hotkey**: Press `M` to toggle in-app audio mute. +- **Dedicated Audio Control**: Clicking the bell immediately mutes or resumes local workstation audio chimes without affecting outgoing Telegram push alerts. +- **Visual Feedback**: + - **Active**: Vibrant green bell (`#38efb0`). + - **Muted**: Red-tinted slashed bell (`#ff6b7e`) with pulsing alert indicator (`pausePulse`). +- Paired alongside the dedicated **Telegram Push Alerts Bell** (`#btn-telegram`), giving traders independent controls for desk vs. mobile alerting. --- diff --git a/docs/wiki/Home.md b/docs/wiki/Home.md index e997eb5..f692e3e 100644 --- a/docs/wiki/Home.md +++ b/docs/wiki/Home.md @@ -9,7 +9,7 @@ Built on a native, ultra-responsive architecture (`pywebview` + Vanilla ES6+/CSS NewsAlerts Real-Time Momentum Terminal
- Live institutional terminal capture (v2.10.2): Real-time screener with 1-click watchlist quick-add, high-of-day momentum tape, TradingView cloud watchlist selector, interactive topbar ๐Ÿšซ Banned / Closing-Only filter, and catalyst news wire. + Live institutional terminal capture (v2.12.0): Real-time screener with 1-click watchlist quick-add, high-of-day momentum tape, TradingView cloud watchlist selector, dual in-app audio & Telegram alert toggles, interactive topbar ๐Ÿšซ Banned / Closing-Only filter, and catalyst news wire.

--- diff --git a/docs/wiki/Keyboard-Shortcuts-&-Hotkeys.md b/docs/wiki/Keyboard-Shortcuts-&-Hotkeys.md index f447043..bef7945 100644 --- a/docs/wiki/Keyboard-Shortcuts-&-Hotkeys.md +++ b/docs/wiki/Keyboard-Shortcuts-&-Hotkeys.md @@ -8,7 +8,8 @@ NewsAlerts is built for rapid keyboard-driven workflow. Use these hotkeys to nav | Shortcut | Action | Description | | :---: | :--- | :--- | -| **`M`** | **Master Mute** | Instantly toggles audio bell chimes and Telegram alert dispatching. | +| **`M`** | **Mute In-App Audio** | Instantly toggles local terminal audio alert chimes on or off. | +| **Configurable** | **Toggle Telegram Alerts** | Toggles mobile & desktop Telegram push notifications on or off. | | **`T`** | **Pop-Out Tape** | Opens the detached, floating running tape window. | | **`Space`** | **Pause / Resume** | Pauses or resumes real-time tape and screener stream updates. | | **`S`** | **Open Settings** | Launches the modal settings window for feeds, audio, and strategies. | diff --git a/docs/wiki/Telegram-Push-Notifications.md b/docs/wiki/Telegram-Push-Notifications.md index 4acec78..dde6d17 100644 --- a/docs/wiki/Telegram-Push-Notifications.md +++ b/docs/wiki/Telegram-Push-Notifications.md @@ -4,6 +4,18 @@ NewsAlerts includes a dedicated **Asynchronous Telegram Worker Queue** that disp --- +## ๐Ÿ“ฒ Dedicated Topbar Telegram Alert Toggle (`#btn-telegram`) + +Starting in **v2.12.0**, traders have a dedicated 1-click Telegram alert toggle button in the topbar header: +- **Icon**: High-precision vector emblem combining the iconic Telegram paper airplane with a docked alert bell badge. +- **Visual Feedback**: + - **Active State** (Telegram Blue `#29b6f6`): Telegram notifications are dispatched in real-time. + - **Paused State** (Red-tinted `#ff6b7e` slashed emblem with `pausePulse` glow): Telegram alerts are suppressed. +- **Desk Workflow Independence**: When sitting directly in front of the terminal, click `#btn-telegram` to silence redundant mobile phone alerts while keeping local PC audio chimes active. +- **Bidirectional Sync**: Automatically stays synchronized with Settings → Alerts → *Enable Telegram Alerts*. + +--- + ## ๐Ÿ“ฒ Alert Payload Anatomy Every Telegram alert dispatched by NewsAlerts is formatted for immediate trading comprehension: diff --git a/docs/wiki/_Footer.md b/docs/wiki/_Footer.md index 5e871f3..d604bce 100644 --- a/docs/wiki/_Footer.md +++ b/docs/wiki/_Footer.md @@ -1,7 +1,7 @@ ---

- NewsAlerts v2.11.2 ยท Institutional Trading Terminal ยท Maintained by @mlgitdev ยท GitHub Repository ยท Wiki Home + NewsAlerts v2.12.0 ยท Institutional Trading Terminal ยท Maintained by @mlgitdev ยท GitHub Repository ยท Wiki Home

diff --git a/tests/test_alert_controls.py b/tests/test_alert_controls.py new file mode 100644 index 0000000..4f1c639 --- /dev/null +++ b/tests/test_alert_controls.py @@ -0,0 +1,160 @@ +"""Unit tests for independent In-App Audio Alerts and Telegram Alerts controls.""" +import unittest +from unittest.mock import MagicMock + +from app.api import Api +from app.screener import ScreenerWorker +from app.tape import TapeWorker + + +class TestAlertControlsDecoupling(unittest.TestCase): + def test_tape_telegram_fires_when_audio_muted(self): + worker = TapeWorker.__new__(TapeWorker) + worker.cfg = MagicMock() + worker.cfg.get.return_value = { + "alerts": { + "mute": True, # In-app audio muted! + "tape_sound_enabled": True, + "telegram_enabled": True, # Telegram enabled! + "telegram_tape_enabled": True, + "telegram_tape_cooldown_sec": 60, + }, + "tape": {"enabled": ["Test Strategy"]}, + "filter_banned": False, + "banned_symbols": [], + } + worker.sounds = MagicMock() + worker.telegram = MagicMock() + worker.emit = MagicMock() + worker._tg_last_alert = {} + + # Simulate tape print event + event = {"symbol": "RUNR", "strategy": "Test Strategy", "price": 4.50} + + # Emulate the dispatch section of poll() + c = worker.cfg.get() + enabled = set(c["tape"]["enabled"]) + unbanned_events = [event] + now = 1000.0 + session = "reg" + + is_paused = bool(c["alerts"].get("mute", False)) + if c["alerts"]["tape_sound_enabled"] and not is_paused and any(e["strategy"] in enabled for e in unbanned_events): + worker.sounds.play(c["alerts"]["sound_tape"]) + + tg_on = c["alerts"].get("telegram_enabled", True) and c["alerts"].get("telegram_tape_enabled", True) + if worker.telegram and tg_on: + tg_cd = float(c["alerts"].get("telegram_tape_cooldown_sec", 60)) + for ev in unbanned_events: + if ev.get("strategy") in enabled: + sym = str(ev.get("symbol") or ev.get("ticker", "")) + last_t = worker._tg_last_alert.get(sym, 0) + if now - last_t >= tg_cd: + worker._tg_last_alert[sym] = now + worker.telegram.send_tape_alert(ev, session=session) + + # In-app audio must be muted, but Telegram alert MUST be sent! + worker.sounds.play.assert_not_called() + worker.telegram.send_tape_alert.assert_called_once_with(event, session="reg") + + def test_tape_telegram_suppressed_when_telegram_disabled_and_audio_active(self): + worker = TapeWorker.__new__(TapeWorker) + worker.cfg = MagicMock() + worker.cfg.get.return_value = { + "alerts": { + "mute": False, # Audio active! + "tape_sound_enabled": True, + "sound_tape": "sound.wav", + "telegram_enabled": False, # Telegram disabled! + "telegram_tape_enabled": True, + "telegram_tape_cooldown_sec": 60, + }, + "tape": {"enabled": ["Test Strategy"]}, + "filter_banned": False, + "banned_symbols": [], + } + worker.sounds = MagicMock() + worker.telegram = MagicMock() + worker.emit = MagicMock() + worker._tg_last_alert = {} + + event = {"symbol": "RUNR", "strategy": "Test Strategy", "price": 4.50} + + c = worker.cfg.get() + enabled = set(c["tape"]["enabled"]) + unbanned_events = [event] + now = 1000.0 + session = "reg" + + is_paused = bool(c["alerts"].get("mute", False)) + if c["alerts"]["tape_sound_enabled"] and not is_paused and any(e["strategy"] in enabled for e in unbanned_events): + worker.sounds.play(c["alerts"]["sound_tape"]) + + tg_on = c["alerts"].get("telegram_enabled", True) and c["alerts"].get("telegram_tape_enabled", True) + if worker.telegram and tg_on: + for ev in unbanned_events: + worker.telegram.send_tape_alert(ev, session=session) + + # In-app audio must play, and Telegram alert must NOT be sent! + worker.sounds.play.assert_called_once_with("sound.wav") + worker.telegram.send_tape_alert.assert_not_called() + + def test_api_set_config_updates_telegram_and_sounds_independently(self): + new_config = { + "alerts": { + "mute": True, + "telegram_enabled": True, + "telegram_bot_token": "token-123", + "telegram_chat_id": "chat-456", + "volume": 75, + } + } + + mock_app = MagicMock() + mock_app.cfg.get.return_value = new_config + mock_app.telegram = MagicMock() + mock_app.sounds = MagicMock() + mock_app.screener = MagicMock() + mock_app.bus = MagicMock() + + api = Api(mock_app) + + api.save_config(new_config) + + # Sounds should be muted + self.assertTrue(mock_app.sounds.muted) + mock_app.sounds.set_volume.assert_called_once_with(75) + + # Telegram should be enabled with paused=False + mock_app.telegram.update.assert_called_once_with( + bot_token="token-123", + chat_id="chat-456", + enabled=True, + paused=False, + ) + + def test_api_get_state_exposes_alerts_config_for_initial_launch_sync(self): + saved_config = { + "alerts": { + "mute": True, + "telegram_enabled": False, + } + } + mock_app = MagicMock() + mock_app.cfg.get.return_value = saved_config + mock_app.sounds.list_sounds.return_value = [] + mock_app.borrow.key_id = "" + mock_app.borrow.secret_key = "" + mock_app.screener.get_latest_data.return_value = {} + mock_app.tape.recent.return_value = [] + mock_app.tape_window = None + + api = Api(mock_app) + state = api.get_state() + + self.assertEqual(state["config"]["alerts"]["mute"], True) + self.assertEqual(state["config"]["alerts"]["telegram_enabled"], False) + + +if __name__ == "__main__": + unittest.main() diff --git a/web/css/app.css b/web/css/app.css index 4bc79e8..1edb47d 100644 --- a/web/css/app.css +++ b/web/css/app.css @@ -290,6 +290,31 @@ button, input, select { font: inherit; color: inherit; } border-color: rgba(34, 201, 147, 0.7); box-shadow: 0 0 8px rgba(34, 201, 147, 0.3); } + +/* Telegram Push Alert Bell States */ +.icon-btn#btn-telegram.paused { + background: rgba(246, 70, 93, 0.14); + border-color: rgba(246, 70, 93, 0.55); + color: #ff6b7e; + box-shadow: 0 0 10px rgba(246, 70, 93, 0.25); + animation: pausePulse 2.5s infinite; +} +.icon-btn#btn-telegram.paused:hover { + background: rgba(246, 70, 93, 0.24); + border-color: rgba(246, 70, 93, 0.85); + color: #fff; + transform: translateY(-1px); +} +.icon-btn#btn-telegram:not(.paused) { + color: #29b6f6; + border-color: rgba(41, 182, 246, 0.45); +} +.icon-btn#btn-telegram:not(.paused):hover { + border-color: rgba(41, 182, 246, 0.8); + box-shadow: 0 0 8px rgba(41, 182, 246, 0.35); + color: #64b5f6; + transform: translateY(-1px); +} @keyframes pausePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.65; } diff --git a/web/img/hero.jpg b/web/img/hero.jpg index 460fe94..eef2987 100644 Binary files a/web/img/hero.jpg and b/web/img/hero.jpg differ diff --git a/web/index.html b/web/index.html index b302420..e0eac9f 100644 --- a/web/index.html +++ b/web/index.html @@ -79,11 +79,16 @@ 80% - - + + +