Spaces:
Sleeping
Sleeping
UI: black and white theme, remove feedback section
Browse files- index.html +44 -85
index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
| 8 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 9 |
body {
|
| 10 |
font-family: system-ui, sans-serif;
|
| 11 |
-
background: #
|
| 12 |
-
color: #
|
| 13 |
min-height: 100vh;
|
| 14 |
display: flex;
|
| 15 |
align-items: center;
|
|
@@ -17,61 +17,58 @@
|
|
| 17 |
padding: 24px;
|
| 18 |
}
|
| 19 |
.box {
|
| 20 |
-
background: #
|
| 21 |
-
border: 1px solid #
|
| 22 |
border-radius: 12px;
|
| 23 |
padding: 36px;
|
| 24 |
width: 100%;
|
| 25 |
max-width: 600px;
|
| 26 |
}
|
| 27 |
-
h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; }
|
| 28 |
-
.sub { color: #
|
| 29 |
label {
|
| 30 |
display: block;
|
| 31 |
font-size: 0.78rem;
|
| 32 |
font-weight: 600;
|
| 33 |
-
color: #
|
| 34 |
text-transform: uppercase;
|
| 35 |
letter-spacing: 0.05em;
|
| 36 |
margin-bottom: 6px;
|
| 37 |
}
|
| 38 |
input, textarea, .file-area {
|
| 39 |
width: 100%;
|
| 40 |
-
background: #
|
| 41 |
-
border: 1px solid #
|
| 42 |
border-radius: 8px;
|
| 43 |
-
color: #
|
| 44 |
font-size: 0.875rem;
|
| 45 |
padding: 10px 14px;
|
| 46 |
outline: none;
|
| 47 |
margin-bottom: 16px;
|
| 48 |
font-family: monospace;
|
| 49 |
}
|
| 50 |
-
textarea {
|
| 51 |
-
|
| 52 |
-
min-height: 80px;
|
| 53 |
-
}
|
| 54 |
-
input:focus, textarea:focus { border-color: #7c3aed; }
|
| 55 |
.file-area {
|
| 56 |
cursor: pointer;
|
| 57 |
text-align: center;
|
| 58 |
padding: 24px;
|
| 59 |
border-style: dashed;
|
| 60 |
-
color: #
|
| 61 |
transition: border-color 0.2s, color 0.2s;
|
| 62 |
position: relative;
|
| 63 |
}
|
| 64 |
-
.file-area:hover, .file-area.drag { border-color: #
|
| 65 |
.file-area input[type=file] {
|
| 66 |
position: absolute; inset: 0; opacity: 0; cursor: pointer;
|
| 67 |
width: 100%; height: 100%; margin: 0; padding: 0; border: none;
|
| 68 |
background: none;
|
| 69 |
}
|
| 70 |
-
#fileName { font-size: 0.82rem; color: #
|
| 71 |
button {
|
| 72 |
width: 100%;
|
| 73 |
-
background: #
|
| 74 |
-
color: #
|
| 75 |
border: none;
|
| 76 |
border-radius: 8px;
|
| 77 |
padding: 12px;
|
|
@@ -80,16 +77,16 @@
|
|
| 80 |
cursor: pointer;
|
| 81 |
transition: background 0.2s;
|
| 82 |
}
|
| 83 |
-
button:hover:not(:disabled) { background: #
|
| 84 |
-
button:disabled { opacity: 0.
|
| 85 |
#status {
|
| 86 |
margin-top: 20px;
|
| 87 |
padding: 14px;
|
| 88 |
border-radius: 8px;
|
| 89 |
font-size: 0.875rem;
|
| 90 |
display: none;
|
| 91 |
-
background: #
|
| 92 |
-
border: 1px solid #
|
| 93 |
}
|
| 94 |
.tag {
|
| 95 |
display: inline-block;
|
|
@@ -99,50 +96,31 @@
|
|
| 99 |
font-weight: 700;
|
| 100 |
margin-bottom: 8px;
|
| 101 |
}
|
| 102 |
-
.tag-processing { background: rgba(
|
| 103 |
-
.tag-completed { background: rgba(
|
| 104 |
-
.tag-failed { background: rgba(
|
| 105 |
.meta-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
|
| 106 |
.lang-badge {
|
| 107 |
-
display: inline-block;
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
font-size: 0.78rem;
|
| 111 |
-
font-weight: 700;
|
| 112 |
-
background: rgba(124,58,237,0.15);
|
| 113 |
-
color: #a78bfa;
|
| 114 |
}
|
| 115 |
.correct-badge {
|
| 116 |
-
display: inline-block;
|
| 117 |
-
|
| 118 |
-
border-radius: 6px;
|
| 119 |
-
font-size: 0.78rem;
|
| 120 |
-
font-weight: 700;
|
| 121 |
}
|
| 122 |
-
.correct-yes { background: rgba(
|
| 123 |
-
.correct-no { background: rgba(
|
| 124 |
.score-row { display: flex; gap: 16px; margin: 12px 0; }
|
| 125 |
-
.score-block { flex: 1; background: #
|
| 126 |
-
.score-num { font-size: 1.8rem; font-weight: 700; }
|
| 127 |
-
.score-lbl { font-size: 0.7rem; color: #
|
| 128 |
-
.section-title { font-size: 0.78rem; font-weight: 700; color: #
|
| 129 |
-
.issue-
|
| 130 |
-
.
|
| 131 |
-
.
|
| 132 |
-
.no-issues { color: #10b981; font-size: 0.82rem; }
|
| 133 |
-
.feedback-block {
|
| 134 |
-
padding: 12px;
|
| 135 |
-
background: rgba(124,58,237,0.06);
|
| 136 |
-
border: 1px solid rgba(124,58,237,0.15);
|
| 137 |
-
border-radius: 8px;
|
| 138 |
-
font-size: 0.84rem;
|
| 139 |
-
color: #cbd5e1;
|
| 140 |
-
line-height: 1.6;
|
| 141 |
-
margin-top: 6px;
|
| 142 |
-
}
|
| 143 |
-
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,0.2); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
|
| 144 |
@keyframes spin { to { transform: rotate(360deg); } }
|
| 145 |
-
.job-id { font-family: monospace; font-size: 0.72rem; color: #
|
| 146 |
</style>
|
| 147 |
</head>
|
| 148 |
<body>
|
|
@@ -174,7 +152,6 @@
|
|
| 174 |
<script>
|
| 175 |
let pollTimer = null;
|
| 176 |
|
| 177 |
-
// Auto-fill URL if the page is served from the Space itself
|
| 178 |
window.onload = () => {
|
| 179 |
const origin = location.origin;
|
| 180 |
document.getElementById('apiUrl').value =
|
|
@@ -189,7 +166,6 @@
|
|
| 189 |
document.getElementById('submitBtn').disabled = !f;
|
| 190 |
}
|
| 191 |
|
| 192 |
-
// Drag-and-drop styling
|
| 193 |
const dz = document.getElementById('dropZone');
|
| 194 |
dz.addEventListener('dragover', e => { e.preventDefault(); dz.classList.add('drag'); });
|
| 195 |
dz.addEventListener('dragleave', () => dz.classList.remove('drag'));
|
|
@@ -261,9 +237,7 @@
|
|
| 261 |
|
| 262 |
if (state === 'completed' && report) {
|
| 263 |
const r = report;
|
| 264 |
-
const sc = colorFor(r.score);
|
| 265 |
|
| 266 |
-
// Language + correctness badges
|
| 267 |
html += `<div class="meta-row">`;
|
| 268 |
html += `<span class="lang-badge">${esc(r.language_detected || 'Unknown')}</span>`;
|
| 269 |
if (r.is_correct === true) {
|
|
@@ -273,20 +247,18 @@
|
|
| 273 |
}
|
| 274 |
html += `</div>`;
|
| 275 |
|
| 276 |
-
// Score + percentage
|
| 277 |
html += `<div class="score-row">
|
| 278 |
<div class="score-block">
|
| 279 |
-
<div class="score-num"
|
| 280 |
<div class="score-lbl">Score / 100</div>
|
| 281 |
</div>
|
| 282 |
<div class="score-block">
|
| 283 |
-
<div class="score-num"
|
| 284 |
<div class="score-lbl">Percentage</div>
|
| 285 |
</div>
|
| 286 |
</div>`;
|
| 287 |
|
| 288 |
-
|
| 289 |
-
html += `<div class="section-title">Logic Flaws</div><div class="issue-list">`;
|
| 290 |
if (!r.logic_flaws || r.logic_flaws.length === 0) {
|
| 291 |
html += '<div class="no-issues">✅ None detected</div>';
|
| 292 |
} else {
|
|
@@ -294,20 +266,13 @@
|
|
| 294 |
}
|
| 295 |
html += '</div>';
|
| 296 |
|
| 297 |
-
|
| 298 |
-
html += `<div class="section-title">Syntax Errors</div><div class="issue-list">`;
|
| 299 |
if (!r.syntax_errors || r.syntax_errors.length === 0) {
|
| 300 |
html += '<div class="no-issues">✅ None detected</div>';
|
| 301 |
} else {
|
| 302 |
-
r.syntax_errors.forEach(m => { html += `<div class="issue-item
|
| 303 |
}
|
| 304 |
html += '</div>';
|
| 305 |
-
|
| 306 |
-
// Student feedback
|
| 307 |
-
if (r.student_feedback) {
|
| 308 |
-
html += `<div class="section-title">Feedback</div>`;
|
| 309 |
-
html += `<div class="feedback-block">${esc(r.student_feedback)}</div>`;
|
| 310 |
-
}
|
| 311 |
}
|
| 312 |
|
| 313 |
if (jobId) html += `<div class="job-id">job: ${jobId}</div>`;
|
|
@@ -322,12 +287,6 @@
|
|
| 322 |
el.innerHTML = `<span class="tag tag-failed">❌ Failed</span><br/>${esc(msg)}`;
|
| 323 |
}
|
| 324 |
|
| 325 |
-
function colorFor(v) {
|
| 326 |
-
if (v >= 70) return '#10b981';
|
| 327 |
-
if (v >= 40) return '#f59e0b';
|
| 328 |
-
return '#f43f5e';
|
| 329 |
-
}
|
| 330 |
-
|
| 331 |
function esc(s) {
|
| 332 |
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
| 333 |
}
|
|
|
|
| 8 |
* { box-sizing: border-box; margin: 0; padding: 0; }
|
| 9 |
body {
|
| 10 |
font-family: system-ui, sans-serif;
|
| 11 |
+
background: #000;
|
| 12 |
+
color: #e5e5e5;
|
| 13 |
min-height: 100vh;
|
| 14 |
display: flex;
|
| 15 |
align-items: center;
|
|
|
|
| 17 |
padding: 24px;
|
| 18 |
}
|
| 19 |
.box {
|
| 20 |
+
background: #111;
|
| 21 |
+
border: 1px solid #333;
|
| 22 |
border-radius: 12px;
|
| 23 |
padding: 36px;
|
| 24 |
width: 100%;
|
| 25 |
max-width: 600px;
|
| 26 |
}
|
| 27 |
+
h1 { font-size: 1.4rem; font-weight: 700; margin-bottom: 6px; color: #fff; }
|
| 28 |
+
.sub { color: #777; font-size: 0.875rem; margin-bottom: 28px; }
|
| 29 |
label {
|
| 30 |
display: block;
|
| 31 |
font-size: 0.78rem;
|
| 32 |
font-weight: 600;
|
| 33 |
+
color: #999;
|
| 34 |
text-transform: uppercase;
|
| 35 |
letter-spacing: 0.05em;
|
| 36 |
margin-bottom: 6px;
|
| 37 |
}
|
| 38 |
input, textarea, .file-area {
|
| 39 |
width: 100%;
|
| 40 |
+
background: #000;
|
| 41 |
+
border: 1px solid #333;
|
| 42 |
border-radius: 8px;
|
| 43 |
+
color: #e5e5e5;
|
| 44 |
font-size: 0.875rem;
|
| 45 |
padding: 10px 14px;
|
| 46 |
outline: none;
|
| 47 |
margin-bottom: 16px;
|
| 48 |
font-family: monospace;
|
| 49 |
}
|
| 50 |
+
textarea { resize: vertical; min-height: 80px; }
|
| 51 |
+
input:focus, textarea:focus { border-color: #888; }
|
|
|
|
|
|
|
|
|
|
| 52 |
.file-area {
|
| 53 |
cursor: pointer;
|
| 54 |
text-align: center;
|
| 55 |
padding: 24px;
|
| 56 |
border-style: dashed;
|
| 57 |
+
color: #777;
|
| 58 |
transition: border-color 0.2s, color 0.2s;
|
| 59 |
position: relative;
|
| 60 |
}
|
| 61 |
+
.file-area:hover, .file-area.drag { border-color: #aaa; color: #ccc; }
|
| 62 |
.file-area input[type=file] {
|
| 63 |
position: absolute; inset: 0; opacity: 0; cursor: pointer;
|
| 64 |
width: 100%; height: 100%; margin: 0; padding: 0; border: none;
|
| 65 |
background: none;
|
| 66 |
}
|
| 67 |
+
#fileName { font-size: 0.82rem; color: #aaa; margin-top: 6px; }
|
| 68 |
button {
|
| 69 |
width: 100%;
|
| 70 |
+
background: #fff;
|
| 71 |
+
color: #000;
|
| 72 |
border: none;
|
| 73 |
border-radius: 8px;
|
| 74 |
padding: 12px;
|
|
|
|
| 77 |
cursor: pointer;
|
| 78 |
transition: background 0.2s;
|
| 79 |
}
|
| 80 |
+
button:hover:not(:disabled) { background: #ddd; }
|
| 81 |
+
button:disabled { opacity: 0.35; cursor: not-allowed; }
|
| 82 |
#status {
|
| 83 |
margin-top: 20px;
|
| 84 |
padding: 14px;
|
| 85 |
border-radius: 8px;
|
| 86 |
font-size: 0.875rem;
|
| 87 |
display: none;
|
| 88 |
+
background: #0a0a0a;
|
| 89 |
+
border: 1px solid #333;
|
| 90 |
}
|
| 91 |
.tag {
|
| 92 |
display: inline-block;
|
|
|
|
| 96 |
font-weight: 700;
|
| 97 |
margin-bottom: 8px;
|
| 98 |
}
|
| 99 |
+
.tag-processing { background: rgba(255,255,255,0.08); color: #aaa; }
|
| 100 |
+
.tag-completed { background: rgba(255,255,255,0.1); color: #fff; }
|
| 101 |
+
.tag-failed { background: rgba(255,255,255,0.06); color: #888; }
|
| 102 |
.meta-row { display: flex; gap: 10px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
|
| 103 |
.lang-badge {
|
| 104 |
+
display: inline-block; padding: 3px 12px; border-radius: 6px;
|
| 105 |
+
font-size: 0.78rem; font-weight: 700;
|
| 106 |
+
background: rgba(255,255,255,0.08); color: #ccc;
|
|
|
|
|
|
|
|
|
|
|
|
|
| 107 |
}
|
| 108 |
.correct-badge {
|
| 109 |
+
display: inline-block; padding: 3px 12px; border-radius: 6px;
|
| 110 |
+
font-size: 0.78rem; font-weight: 700;
|
|
|
|
|
|
|
|
|
|
| 111 |
}
|
| 112 |
+
.correct-yes { background: rgba(255,255,255,0.1); color: #fff; }
|
| 113 |
+
.correct-no { background: rgba(255,255,255,0.06); color: #888; }
|
| 114 |
.score-row { display: flex; gap: 16px; margin: 12px 0; }
|
| 115 |
+
.score-block { flex: 1; background: #111; border: 1px solid #333; border-radius: 8px; padding: 12px; text-align: center; }
|
| 116 |
+
.score-num { font-size: 1.8rem; font-weight: 700; color: #fff; }
|
| 117 |
+
.score-lbl { font-size: 0.7rem; color: #777; text-transform: uppercase; }
|
| 118 |
+
.section-title { font-size: 0.78rem; font-weight: 700; color: #999; text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 6px; }
|
| 119 |
+
.issue-item { padding: 8px 12px; background: rgba(255,255,255,0.03); border: 1px solid #333; border-radius: 6px; font-size: 0.82rem; color: #ccc; margin-bottom: 6px; line-height: 1.5; }
|
| 120 |
+
.no-issues { color: #999; font-size: 0.82rem; }
|
| 121 |
+
.spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid rgba(255,255,255,0.15); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; vertical-align: middle; margin-right: 6px; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
@keyframes spin { to { transform: rotate(360deg); } }
|
| 123 |
+
.job-id { font-family: monospace; font-size: 0.72rem; color: #555; margin-top: 8px; word-break: break-all; }
|
| 124 |
</style>
|
| 125 |
</head>
|
| 126 |
<body>
|
|
|
|
| 152 |
<script>
|
| 153 |
let pollTimer = null;
|
| 154 |
|
|
|
|
| 155 |
window.onload = () => {
|
| 156 |
const origin = location.origin;
|
| 157 |
document.getElementById('apiUrl').value =
|
|
|
|
| 166 |
document.getElementById('submitBtn').disabled = !f;
|
| 167 |
}
|
| 168 |
|
|
|
|
| 169 |
const dz = document.getElementById('dropZone');
|
| 170 |
dz.addEventListener('dragover', e => { e.preventDefault(); dz.classList.add('drag'); });
|
| 171 |
dz.addEventListener('dragleave', () => dz.classList.remove('drag'));
|
|
|
|
| 237 |
|
| 238 |
if (state === 'completed' && report) {
|
| 239 |
const r = report;
|
|
|
|
| 240 |
|
|
|
|
| 241 |
html += `<div class="meta-row">`;
|
| 242 |
html += `<span class="lang-badge">${esc(r.language_detected || 'Unknown')}</span>`;
|
| 243 |
if (r.is_correct === true) {
|
|
|
|
| 247 |
}
|
| 248 |
html += `</div>`;
|
| 249 |
|
|
|
|
| 250 |
html += `<div class="score-row">
|
| 251 |
<div class="score-block">
|
| 252 |
+
<div class="score-num">${r.score}</div>
|
| 253 |
<div class="score-lbl">Score / 100</div>
|
| 254 |
</div>
|
| 255 |
<div class="score-block">
|
| 256 |
+
<div class="score-num">${esc(r.percentage || '')}</div>
|
| 257 |
<div class="score-lbl">Percentage</div>
|
| 258 |
</div>
|
| 259 |
</div>`;
|
| 260 |
|
| 261 |
+
html += `<div class="section-title">Logic Flaws</div><div>`;
|
|
|
|
| 262 |
if (!r.logic_flaws || r.logic_flaws.length === 0) {
|
| 263 |
html += '<div class="no-issues">✅ None detected</div>';
|
| 264 |
} else {
|
|
|
|
| 266 |
}
|
| 267 |
html += '</div>';
|
| 268 |
|
| 269 |
+
html += `<div class="section-title">Syntax Errors</div><div>`;
|
|
|
|
| 270 |
if (!r.syntax_errors || r.syntax_errors.length === 0) {
|
| 271 |
html += '<div class="no-issues">✅ None detected</div>';
|
| 272 |
} else {
|
| 273 |
+
r.syntax_errors.forEach(m => { html += `<div class="issue-item">• ${esc(m)}</div>`; });
|
| 274 |
}
|
| 275 |
html += '</div>';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 276 |
}
|
| 277 |
|
| 278 |
if (jobId) html += `<div class="job-id">job: ${jobId}</div>`;
|
|
|
|
| 287 |
el.innerHTML = `<span class="tag tag-failed">❌ Failed</span><br/>${esc(msg)}`;
|
| 288 |
}
|
| 289 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 290 |
function esc(s) {
|
| 291 |
return String(s).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>');
|
| 292 |
}
|