Skip to content

Commit 2bb0023

Browse files
committed
Refactor dialog and toast styles: rename classes for consistency and update dark theme overrides
1 parent 3ce54c5 commit 2bb0023

File tree

4 files changed

+37
-23
lines changed

4 files changed

+37
-23
lines changed

common-ui-elements/dark-theme.css

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ body.dark-theme button.danger:hover {
7272
/* ------------------------------------------------------------------------- */
7373
/* Dark Theme Overrides for Dynamic Prompt Dialogs */
7474
/* ------------------------------------------------------------------------- */
75-
body.dark-theme .confirmation,
76-
body.dark-theme .error {
75+
body.dark-theme .dialog-confirmation,
76+
body.dark-theme .dialog-error {
7777
background-color: #333;
7878
/* Dark background for dialogs */
7979
color: #fff;
@@ -87,8 +87,8 @@ body.dark-theme .error {
8787
/* Rounded corners */
8888
}
8989

90-
body.dark-theme .confirmation button,
91-
body.dark-theme .error button {
90+
body.dark-theme .dialog-confirmation button,
91+
body.dark-theme .dialog-error button {
9292
background-color: #444;
9393
/* Dark button background */
9494
color: #fff;
@@ -103,8 +103,8 @@ body.dark-theme .error button {
103103
}
104104

105105
/* Button hover states for dialogs */
106-
body.dark-theme .confirmation button:hover,
107-
body.dark-theme .error button:hover {
106+
body.dark-theme .dialog-confirmation button:hover,
107+
body.dark-theme .dialog-error button:hover {
108108
background-color: #555;
109109
border-color: #777;
110110
}
@@ -135,7 +135,8 @@ body.dark-theme #importProfile {
135135
}
136136

137137
/* Dark theme toast styling */
138-
body.dark-theme .toast:not(.success):not(.error):not(.info) {
138+
/* In dark mode, apply neutral background to base .toast unless it has one of the explicit type classes */
139+
body.dark-theme .toast:not(.toast-success):not(.toast-error):not(.toast-info) {
139140
background: rgba(50, 50, 50, 0.9);
140141
color: #eee;
141142
}

popup-page-scripts/popup-page-visuals.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,19 @@ const toastContainer = document.getElementById('toastContainer');
1818
*/
1919
function showToast(message, type = 'info', duration = 3000) {
2020
const toast = document.createElement('div');
21-
toast.classList.add('toast', type);
21+
toast.classList.add('toast');
22+
23+
// Map legacy types to new, specific classes
24+
const typeClassMap = {
25+
success: 'toast-success',
26+
error: 'toast-error',
27+
info: 'toast-info'
28+
};
29+
30+
if (type && typeClassMap[type]) {
31+
toast.classList.add(typeClassMap[type]);
32+
}
33+
2234
toast.textContent = message;
2335

2436
toastContainer.appendChild(toast);

popup-page-styles/popup-components.css

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ Key areas:
156156
/* ------------------------------------------------------------------------- */
157157
/* Confirmation Dialog Styling */
158158
/* ------------------------------------------------------------------------- */
159-
.confirmation {
159+
.dialog-confirmation {
160160
margin-top: 16px;
161161
padding: 16px;
162162
border: 1px solid var(--primary-color);
@@ -165,13 +165,13 @@ Key areas:
165165
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
166166
}
167167

168-
.confirmation p {
168+
.dialog-confirmation p {
169169
margin: 0 0 16px 0;
170170
color: var(--text-color);
171171
font-size: 14px;
172172
}
173173

174-
.confirmation button {
174+
.dialog-confirmation button {
175175
margin-right: 12px;
176176
padding: 8px 16px;
177177
border: none;
@@ -182,19 +182,19 @@ Key areas:
182182
transition: background-color var(--transition-duration) ease, transform var(--transition-duration) ease;
183183
}
184184

185-
.confirmation button:hover {
185+
.dialog-confirmation button:hover {
186186
background-color: #6a4abd;
187187
transform: scale(1.02);
188188
}
189189

190-
.confirmation button:active {
190+
.dialog-confirmation button:active {
191191
transform: scale(0.98);
192192
}
193193

194194
/* ------------------------------------------------------------------------- */
195195
/* Error Dialog Styling */
196196
/* ------------------------------------------------------------------------- */
197-
.error {
197+
.dialog-error {
198198
margin-top: 16px;
199199
padding: 16px;
200200
border: 1px solid var(--danger-color);
@@ -203,13 +203,13 @@ Key areas:
203203
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
204204
}
205205

206-
.error p {
206+
.dialog-error p {
207207
margin: 0;
208208
color: var(--danger-color);
209209
font-size: 14px;
210210
}
211211

212-
.error button {
212+
.dialog-error button {
213213
margin-right: 12px;
214214
padding: 8px 16px;
215215
border: none;
@@ -220,12 +220,12 @@ Key areas:
220220
transition: background-color var(--transition-duration) ease, transform var(--transition-duration) ease;
221221
}
222222

223-
.error button:hover {
223+
.dialog-error button:hover {
224224
background-color: #c9302c;
225225
transform: scale(1.02);
226226
}
227227

228-
.error button:active {
228+
.dialog-error button:active {
229229
transform: scale(0.98);
230230
}
231231

@@ -258,15 +258,16 @@ Key areas:
258258
transform: translateY(0);
259259
}
260260

261-
.toast.success {
261+
/* New toast type classes */
262+
.toast-success {
262263
background: #4BB543;
263264
}
264265

265-
.toast.error {
266+
.toast-error {
266267
background: #FF3333;
267268
}
268269

269-
.toast.info {
270+
.toast-info {
270271
background: #3333FF;
271272
}
272273

popup.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ <h2>Backup &amp; Restore</h2>
281281
/>
282282
</div>
283283
<!-- Confirmation Div -->
284-
<div id="confirmationDiv" class="confirmation" style="display: none">
284+
<div id="confirmationDiv" class="dialog-confirmation" style="display: none">
285285
<p>
286286
File loaded successfully, but a profile with the same name already
287287
exists in the system. Do you want to overwrite the existing profile?
@@ -290,7 +290,7 @@ <h2>Backup &amp; Restore</h2>
290290
<button id="cancelOverwrite">No</button>
291291
</div>
292292
<!-- Error Message Div -->
293-
<div id="errorDiv" class="error" style="display: none">
293+
<div id="errorDiv" class="dialog-error" style="display: none">
294294
<p>
295295
Error loading file. Please ensure the file is a valid JSON profile.
296296
</p>

0 commit comments

Comments
 (0)