Spaces:
Sleeping
Sleeping
Commit ·
abed01f
1
Parent(s): ee76f73
UI: improve visibility (spinner, badges, filename); add disabled-box tooltip and guard
Browse files- static/css/style.css +6 -5
- static/js/app.js +9 -1
static/css/style.css
CHANGED
|
@@ -62,12 +62,13 @@ body::before {
|
|
| 62 |
.loading { display:none; margin-top:10px }
|
| 63 |
|
| 64 |
/* Spinner */
|
| 65 |
-
.spinner { width:32px; height:32px; border-radius:50%; border:4px solid rgba(
|
| 66 |
@keyframes spin { to { transform: rotate(360deg); } }
|
| 67 |
|
| 68 |
-
|
| 69 |
|
| 70 |
-
|
|
|
|
| 71 |
|
| 72 |
.badge { display:inline-block; background: rgba(15,23,42,0.04); color: var(--dark); padding:6px 10px; border-radius:999px; margin-right:8px; font-size:0.8rem; border:1px solid rgba(15,23,42,0.04) }
|
| 73 |
|
|
@@ -93,7 +94,7 @@ input[type=file] { margin:20px 0; padding:15px; border:2px dashed rgba(15,23,42,
|
|
| 93 |
.tagline { font-size:0.95rem; color: var(--muted); margin-top:4px }
|
| 94 |
|
| 95 |
.box-badges { position:absolute; left:16px; top:12px; display:flex; gap:8px }
|
| 96 |
-
.box-badges .badge { background: rgba(
|
| 97 |
|
| 98 |
/* Small responsive tweaks */
|
| 99 |
@media (max-width:600px){ .navbar{flex-direction:column;align-items:flex-start} }
|
|
@@ -103,4 +104,4 @@ input[type=file] { margin:20px 0; padding:15px; border:2px dashed rgba(15,23,42,
|
|
| 103 |
.notification.show{display:block}
|
| 104 |
|
| 105 |
/* preserve small helper classes used by template */
|
| 106 |
-
.file-name{margin-top:8px;color:
|
|
|
|
| 62 |
.loading { display:none; margin-top:10px }
|
| 63 |
|
| 64 |
/* Spinner */
|
| 65 |
+
.spinner { width:32px; height:32px; border-radius:50%; border:4px solid rgba(15,23,42,0.06); border-top-color: var(--primary); animation: spin 1s linear infinite; margin:8px auto }
|
| 66 |
@keyframes spin { to { transform: rotate(360deg); } }
|
| 67 |
|
| 68 |
+
function-box .meta { position:absolute; top:12px; right:12px; font-size:0.85rem; color: var(--muted) }
|
| 69 |
|
| 70 |
+
/* When disabled, still allow hover/click to show helpful message; use not-allowed cursor */
|
| 71 |
+
.function-box.disabled { opacity:0.62; transform:none; cursor:not-allowed; pointer-events:auto }
|
| 72 |
|
| 73 |
.badge { display:inline-block; background: rgba(15,23,42,0.04); color: var(--dark); padding:6px 10px; border-radius:999px; margin-right:8px; font-size:0.8rem; border:1px solid rgba(15,23,42,0.04) }
|
| 74 |
|
|
|
|
| 94 |
.tagline { font-size:0.95rem; color: var(--muted); margin-top:4px }
|
| 95 |
|
| 96 |
.box-badges { position:absolute; left:16px; top:12px; display:flex; gap:8px }
|
| 97 |
+
.box-badges .badge { background: rgba(15,23,42,0.04); color:var(--muted); padding:6px 10px; border-radius:999px; font-size:0.75rem; border:1px solid rgba(15,23,42,0.04) }
|
| 98 |
|
| 99 |
/* Small responsive tweaks */
|
| 100 |
@media (max-width:600px){ .navbar{flex-direction:column;align-items:flex-start} }
|
|
|
|
| 104 |
.notification.show{display:block}
|
| 105 |
|
| 106 |
/* preserve small helper classes used by template */
|
| 107 |
+
.file-name{margin-top:8px;color:var(--dark);font-weight:600}
|
static/js/app.js
CHANGED
|
@@ -7,7 +7,13 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
| 7 |
|
| 8 |
function disableFunctionBoxes(state) {
|
| 9 |
document.querySelectorAll('.function-box').forEach(el => {
|
| 10 |
-
if (state)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
});
|
| 12 |
}
|
| 13 |
|
|
@@ -90,6 +96,8 @@ function showNotification(message, isError = false) {
|
|
| 90 |
}
|
| 91 |
|
| 92 |
function runFunction(functionName) {
|
|
|
|
|
|
|
| 93 |
const loadingElement = document.getElementById(`${functionName}_loading`);
|
| 94 |
const outputElement = document.getElementById(`${functionName}_output`);
|
| 95 |
outputElement.innerHTML = ''; outputElement.style.display = 'none'; if (loadingElement) loadingElement.style.display = 'block';
|
|
|
|
| 7 |
|
| 8 |
function disableFunctionBoxes(state) {
|
| 9 |
document.querySelectorAll('.function-box').forEach(el => {
|
| 10 |
+
if (state) {
|
| 11 |
+
el.classList.add('disabled');
|
| 12 |
+
el.setAttribute('title', 'Choose a file first');
|
| 13 |
+
} else {
|
| 14 |
+
el.classList.remove('disabled');
|
| 15 |
+
el.removeAttribute('title');
|
| 16 |
+
}
|
| 17 |
});
|
| 18 |
}
|
| 19 |
|
|
|
|
| 96 |
}
|
| 97 |
|
| 98 |
function runFunction(functionName) {
|
| 99 |
+
const processBtn = document.getElementById('process-btn');
|
| 100 |
+
if (processBtn && processBtn.disabled) { showNotification('Please choose a file and process it first!', true); return; }
|
| 101 |
const loadingElement = document.getElementById(`${functionName}_loading`);
|
| 102 |
const outputElement = document.getElementById(`${functionName}_output`);
|
| 103 |
outputElement.innerHTML = ''; outputElement.style.display = 'none'; if (loadingElement) loadingElement.style.display = 'block';
|