From 735f16725d0399a52ca39b8b459df3245c4ae76f Mon Sep 17 00:00:00 2001 From: Nariman Jelveh Date: Sun, 14 Sep 2025 20:20:19 -0700 Subject: [PATCH] refactor: make theme service non-blocking and fix captcha issues (#1564) Replaced inline styles with CSS classes for the captcha modal to improve maintainability and readability. Adjusted JavaScript to accommodate the new structure and ensure proper functionality. Enhanced error handling and loading state management during the captcha verification process. --- src/gui/src/css/style.css | 100 ++++++++++++++++++ src/gui/src/initgui.js | 149 +++++++-------------------- src/gui/src/services/ThemeService.js | 58 ++++++----- 3 files changed, 168 insertions(+), 139 deletions(-) diff --git a/src/gui/src/css/style.css b/src/gui/src/css/style.css index e56720eda..02536a08f 100644 --- a/src/gui/src/css/style.css +++ b/src/gui/src/css/style.css @@ -2615,6 +2615,106 @@ label { padding-bottom: 5px !important; } +/***************************************************** + * Captcha + *****************************************************/ + +.captcha-modal { + position: fixed; + top: 0; + left: 0; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.5); + display: flex; + justify-content: center; + align-items: center; + z-index: 10000; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; +} + +.captcha-modal .modal-content { + background-color: white; + padding: 30px; + border-radius: 10px; + box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15); + max-width: 400px; + width: 90%; + text-align: center; + position: relative; +} + +.captcha-modal .captcha-logo { + width: 40px; + height: 40px; + margin: 0 auto 15px; + display: block; + padding: 15px; + background-color: blue; + border-radius: 8px; +} + +.captcha-modal .captcha-title { + margin: 0; + color: #1f2937; + font-size: 24px; + font-weight: 500; + line-height: 1.2; + -webkit-font-smoothing: antialiased; +} + +.captcha-modal .captcha-description { + margin: 10px 0 0 0; + color: #6b7280; + font-size: 14px; + line-height: 1.4; +} + +.captcha-modal .captcha-container { + display: flex; + justify-content: center; + margin: 20px 0; + min-height: 80px; + align-items: center; +} + +.captcha-modal .loading-state { + display: none; + margin: 20px 0; + color: #6b7280; + font-size: 16px; + height: 80px; + line-height: 70px; +} + +.captcha-modal .loading-state-icon { + display: inline-block; + width: 20px; + height: 20px; + border: 2px solid #e5e7eb; + border-radius: 50%; + border-top: 2px solid #3b82f6; + animation: spin 1s linear infinite; + margin-right: 10px; + vertical-align: middle; +} + +.captcha-modal .error-message { + display: none; + color: #dc2626; + font-size: 14px; + margin-top: 15px; + padding: 10px; + background-color: #fef2f2; + border: 1px solid #fecaca; + border-radius: 6px; +} + +@keyframes spin { + 0% { transform: rotate(0deg); } + 100% { transform: rotate(360deg); } +} + /***************************************************** * Task Manager *****************************************************/ diff --git a/src/gui/src/initgui.js b/src/gui/src/initgui.js index e3e88c149..470f38f61 100644 --- a/src/gui/src/initgui.js +++ b/src/gui/src/initgui.js @@ -169,103 +169,25 @@ window.showTurnstileChallenge = function(options) { // Create modal HTML let modalHtml = ` -