Spaces:
Running on Zero
Running on Zero
Deploy Karate Wiener (kimodo kata maker)
Browse files- tabs/dojo.tab.css +6 -0
- tabs/dojo.tab.js +19 -0
tabs/dojo.tab.css
CHANGED
|
@@ -500,3 +500,9 @@
|
|
| 500 |
overflow: hidden;
|
| 501 |
text-overflow: ellipsis;
|
| 502 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 500 |
overflow: hidden;
|
| 501 |
text-overflow: ellipsis;
|
| 502 |
}
|
| 503 |
+
|
| 504 |
+
/* "No dojo" card (first in the grid) — clears the scene, back to the grid floor. */
|
| 505 |
+
.kimodo-dojo-clearcard { background: #1a1a1f; border-style: dashed; border-color: #44444c; }
|
| 506 |
+
.kimodo-dojo-clearcard:hover { border-color: #6a6a72; }
|
| 507 |
+
.kimodo-dojo-clearcard .ph { color: #7a7a84; background: transparent; }
|
| 508 |
+
.kimodo-dojo-clearcard .nm { color: #9aa0aa; }
|
tabs/dojo.tab.js
CHANGED
|
@@ -432,12 +432,30 @@
|
|
| 432 |
setStatus('Applying "' + d.name + '"…');
|
| 433 |
}
|
| 434 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 435 |
function renderLibrary() {
|
| 436 |
const els = dojoEls();
|
| 437 |
if (els.scope) els.scope.querySelectorAll('.kimodo-cz-segbtn').forEach((b) => b.classList.toggle('active', b.dataset.scope === dojoScope));
|
| 438 |
if (!els.grid) return;
|
| 439 |
els.grid.innerHTML = '';
|
| 440 |
if (dojoScope === 'mine') {
|
|
|
|
| 441 |
const arr = loadMyDojos();
|
| 442 |
arr.forEach((e) => els.grid.appendChild(mineCard(e)));
|
| 443 |
if (els.emptyMsg) els.emptyMsg.textContent = arr.length ? '' : 'No dojos yet — tap + Add dojo to create one.';
|
|
@@ -448,6 +466,7 @@
|
|
| 448 |
loadCommunity().then((list) => {
|
| 449 |
if (dojoScope !== 'community' || !els.grid) return;
|
| 450 |
els.grid.innerHTML = '';
|
|
|
|
| 451 |
if (list && list.length) list.forEach((d) => els.grid.appendChild(communityRealCard(d)));
|
| 452 |
else COMMUNITY_SEED.forEach((s) => els.grid.appendChild(communityCard(s)));
|
| 453 |
if (els.emptyMsg) els.emptyMsg.textContent = '';
|
|
|
|
| 432 |
setStatus('Applying "' + d.name + '"…');
|
| 433 |
}
|
| 434 |
|
| 435 |
+
// Clear the applied dojo scene → back to the empty grid floor.
|
| 436 |
+
function clearDojo() {
|
| 437 |
+
const frame = previewFrame();
|
| 438 |
+
if (frame && frame.contentWindow) frame.contentWindow.postMessage({ kind: 'dojo-clear' }, '*');
|
| 439 |
+
lastScene = null;
|
| 440 |
+
setStatus('Dojo cleared — back to the grid floor.');
|
| 441 |
+
}
|
| 442 |
+
function clearCard() {
|
| 443 |
+
const card = document.createElement('div');
|
| 444 |
+
card.className = 'kimodo-dojo-card kimodo-dojo-clearcard';
|
| 445 |
+
card.title = 'Clear the dojo — back to the grid floor';
|
| 446 |
+
const ph = document.createElement('div'); ph.className = 'ph'; ph.textContent = '▦'; card.appendChild(ph);
|
| 447 |
+
const nm = document.createElement('div'); nm.className = 'nm'; nm.textContent = 'No dojo'; card.appendChild(nm);
|
| 448 |
+
card.onclick = clearDojo;
|
| 449 |
+
return card;
|
| 450 |
+
}
|
| 451 |
+
|
| 452 |
function renderLibrary() {
|
| 453 |
const els = dojoEls();
|
| 454 |
if (els.scope) els.scope.querySelectorAll('.kimodo-cz-segbtn').forEach((b) => b.classList.toggle('active', b.dataset.scope === dojoScope));
|
| 455 |
if (!els.grid) return;
|
| 456 |
els.grid.innerHTML = '';
|
| 457 |
if (dojoScope === 'mine') {
|
| 458 |
+
els.grid.appendChild(clearCard()); // first card: clear + back to the grid floor
|
| 459 |
const arr = loadMyDojos();
|
| 460 |
arr.forEach((e) => els.grid.appendChild(mineCard(e)));
|
| 461 |
if (els.emptyMsg) els.emptyMsg.textContent = arr.length ? '' : 'No dojos yet — tap + Add dojo to create one.';
|
|
|
|
| 466 |
loadCommunity().then((list) => {
|
| 467 |
if (dojoScope !== 'community' || !els.grid) return;
|
| 468 |
els.grid.innerHTML = '';
|
| 469 |
+
els.grid.appendChild(clearCard());
|
| 470 |
if (list && list.length) list.forEach((d) => els.grid.appendChild(communityRealCard(d)));
|
| 471 |
else COMMUNITY_SEED.forEach((s) => els.grid.appendChild(communityCard(s)));
|
| 472 |
if (els.emptyMsg) els.emptyMsg.textContent = '';
|