Elffuss BraidHub

utopia-ia/elffuss-code public

Hiding the explorer no longer hides the editor

With the file tree hidden (display:none) the grid items shifted one column
left: the editor landed in the 0px column and vanished, the chat took its
place and the chat column stayed empty. With the wide chat on as well, the
chat vanished too. Each piece now has its own grid column.

Test: tests/sidebar-toggle.mjs
Changeset5f5bc6bf966ca8c1f5783ad47e5f42789aa650347b79a0bd2681fd316c7486e1
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-12 09:47 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-12 09:47 +02:00
Parentsaae34830ffe7

Browse the files at this changeset

2 files changed

added tests/sidebar-toggle.mjs +45 −0
@@ -0,0 +1,45 @@
1+// Ocultar el explorador (icono de ficheros de la barra de actividad) no puede
2+// llevarse el editor por delante.
3+//
4+// Antes, con el árbol oculto (display:none), el editor y el chat se corrían una
5+// columna de la rejilla: el editor caía en la de 0 px y desaparecía, el chat
6+// ocupaba su sitio y la columna del chat se quedaba vacía. Con «chat a toda la
7+// ventana» a la vez, desaparecía también el chat.
8+//
9+// BASE=http://127.0.0.1:8898 node tests/sidebar-toggle.mjs
10+import { chromium } from 'playwright';
11+const BASE = process.env.BASE || 'http://localhost:8799';
12+let fails = 0; const ok = (n, c, e = '') => { console.log((c ? '✅' : '❌') + ' ' + n + (e ? ' — ' + e : '')); if (!c) fails++; };
13+
14+const b = await chromium.launch();
15+const ctx = await b.newContext({ locale: 'es-ES', viewport: { width: 1280, height: 800 } });
16+await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); localStorage.removeItem('elffusscode.chatfull'); } catch {} });
17+await ctx.route(/soundcloud|huggingface|hf\.co|api\.github|raw\.githubusercontent/, r => r.abort());
18+const p = await ctx.newPage();
19+const errs = []; p.on('pageerror', e => errs.push(e.message.slice(0, 160)));
20+await p.goto(BASE + '/?test-opfs', { waitUntil: 'domcontentloaded' });
21+await p.waitForFunction(() => window.elffussClaw?.conv?.getActive?.(), null, { timeout: 30000 });
22+const caja = sel => p.evaluate(sel => { const r = document.querySelector(sel).getBoundingClientRect(); return { x: Math.round(r.x), w: Math.round(r.width) }; }, sel);
23+
24+const antes = { ed: await caja('#editor-wrap'), chat: await caja('#chat') };
25+await p.click('#act-files');
26+await p.waitForTimeout(200);
27+const oculto = { ed: await caja('#editor-wrap'), chat: await caja('#chat'), arbol: await p.isVisible('#sidebar') };
28+ok('ocultar el árbol lo oculta', !oculto.arbol);
29+ok('…y el editor sigue ahí, ocupando el hueco del árbol', oculto.ed.x === 46 && oculto.ed.w > antes.ed.w, JSON.stringify(oculto));
30+ok('…y el chat se queda en su columna, pegado a la derecha', oculto.chat.x + oculto.chat.w === 1280 && oculto.chat.w === antes.chat.w, JSON.stringify(oculto.chat));
31+ok('el icono de ficheros dice que el árbol está oculto', await p.evaluate(() => !document.getElementById('act-files').classList.contains('on')));
32+
33+await p.click('#btn-ancho');
34+await p.waitForTimeout(200);
35+const ancho = await caja('#chat');
36+ok('con el árbol oculto, «chat a toda la ventana» sigue enseñando el chat', ancho.w > 1000, JSON.stringify(ancho));
37+await p.click('#btn-ancho');
38+await p.click('#act-files');
39+await p.waitForTimeout(200);
40+const vuelta = { ed: await caja('#editor-wrap'), chat: await caja('#chat') };
41+ok('volver a enseñar el árbol lo deja como estaba', JSON.stringify(vuelta) === JSON.stringify(antes), JSON.stringify(vuelta));
42+ok('sin errores de página', !errs.length, errs.join(' | '));
43+await b.close();
44+console.log(fails ? `\n❌ ${fails} FALLO(S)` : '\n✅ explorador: ocultar y enseñar sin romper la rejilla');
45+process.exit(fails ? 1 : 0);
modified web/css/code.css +8 −0
@@ -89,6 +89,13 @@
8989 main { flex: 1; display: grid; grid-template-columns: 46px 235px minmax(0, 1fr) minmax(440px, 34%); grid-template-rows: minmax(0, 1fr); min-height: 0; overflow: hidden; }
9090 body.hide-tree main { grid-template-columns: 46px 0 minmax(0, 1fr) minmax(440px, 34%); }
9191 body.hide-tree #sidebar { display: none; }
92+/* Cada pieza en SU columna. Sin esto, al ocultar el explorador (display:none)
93+ el resto se corría una columna a la izquierda: el editor caía en la de 0 px y
94+ desaparecía, el chat ocupaba su sitio y la columna del chat quedaba vacía. */
95+#activity { grid-column: 1; }
96+#sidebar { grid-column: 2; }
97+#editor-wrap { grid-column: 3; }
98+#chat { grid-column: 4; }
9299
93100 /* barra de actividad estilo VS Code */
94101 #activity {
@@ -415,6 +422,7 @@
415422 /* ---------- móvil: cabecera fija + chat/editor conmutables ---------- */
416423 @media (max-width: 760px) {
417424 main { grid-template-columns: 1fr; }
425+ #activity, #sidebar, #editor-wrap, #chat { grid-column: 1; }
418426 #activity, #sidebar { display: none; }
419427 #code-flip { display: block; }
420428 #editor-wrap { display: none; }