@cccarv82/freya 2.8.3 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/cli/web-ui.js +45 -16
  2. package/cli/web.js +19 -40
  3. package/package.json +1 -1
package/cli/web-ui.js CHANGED
@@ -1872,22 +1872,6 @@
1872
1872
  if (isCompanionPage) {
1873
1873
  refreshHealthChecklist();
1874
1874
  }
1875
- // On Dashboard: reveal the reportPreviewPanel so the user can see the output.
1876
- // The panel is hidden by default (display:none) and only shown after a report runs.
1877
- const previewPanel = $('reportPreviewPanel');
1878
- if (previewPanel) {
1879
- previewPanel.style.display = '';
1880
- const titleEl = $('reportPreviewTitle');
1881
- const labels = {
1882
- status: 'Relatório Executivo',
1883
- 'sm-weekly': 'SM Weekly Report',
1884
- blockers: 'Relatório de Bloqueios',
1885
- daily: 'Daily Summary',
1886
- report: 'Relatório Semanal'
1887
- };
1888
- if (titleEl) titleEl.textContent = labels[name] || 'Relatório Gerado';
1889
- previewPanel.scrollIntoView({ behavior: 'smooth', block: 'start' });
1890
- }
1891
1875
  setPill('ok', name + ' ok');
1892
1876
  } catch (e) {
1893
1877
  setPill('err', name + ' failed');
@@ -1895,6 +1879,50 @@
1895
1879
  }
1896
1880
  }
1897
1881
 
1882
+ async function runReportPage(name) {
1883
+ // Disable all generation buttons and show spinner
1884
+ const genBtns = document.querySelectorAll('.reportsGenBar button');
1885
+ const spinner = $('reportsGenStatus');
1886
+ genBtns.forEach(b => { b.disabled = true; });
1887
+ if (spinner) spinner.style.display = '';
1888
+
1889
+ try {
1890
+ saveLocal();
1891
+ const r = await api('/api/report', { dir: dirOrDefault(), script: name });
1892
+
1893
+ // Refresh the full reports list and expand the newest report
1894
+ await refreshReportsPage();
1895
+
1896
+ // Auto-expand the first (newest) report in state.reports
1897
+ if (state.reports && state.reports.length > 0) {
1898
+ const newest = state.reports[0];
1899
+ state.reportExpanded[newest.relPath] = true;
1900
+ // Store the generated text directly so the card shows it immediately
1901
+ if (r.reportText) {
1902
+ state.reportTexts[newest.relPath] = r.reportText;
1903
+ }
1904
+ renderReportsPage();
1905
+ // Scroll to top of reportsGrid so user sees the expanded card
1906
+ const grid = $('reportsGrid');
1907
+ if (grid) grid.scrollIntoView({ behavior: 'smooth', block: 'start' });
1908
+ }
1909
+ } catch (e) {
1910
+ // Show error inline in the gen bar
1911
+ if (spinner) {
1912
+ spinner.style.display = '';
1913
+ spinner.textContent = '❌ ' + (e && e.message ? e.message : 'Erro ao gerar relatório');
1914
+ setTimeout(() => {
1915
+ if (spinner) { spinner.style.display = 'none'; spinner.textContent = '⏳ Gerando...'; }
1916
+ }, 4000);
1917
+ }
1918
+ } finally {
1919
+ genBtns.forEach(b => { b.disabled = false; });
1920
+ if (spinner && !spinner.textContent.startsWith('❌')) {
1921
+ spinner.style.display = 'none';
1922
+ }
1923
+ }
1924
+ }
1925
+
1898
1926
  async function exportObsidian() {
1899
1927
  try {
1900
1928
  setPill('run', 'exporting…');
@@ -2314,6 +2342,7 @@
2314
2342
  window.doMigrate = doMigrate;
2315
2343
  window.pickDir = pickDir;
2316
2344
  window.runReport = runReport;
2345
+ window.runReportPage = runReportPage;
2317
2346
  window.publish = publish;
2318
2347
  window.refreshReports = refreshReports;
2319
2348
  window.refreshToday = refreshToday;
package/cli/web.js CHANGED
@@ -1257,34 +1257,6 @@ function buildHtml(safeDefault, appVersion) {
1257
1257
  </div>
1258
1258
  </section>
1259
1259
 
1260
- <section class="utilityGrid" id="dashboardControls" style="display:grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 24px;">
1261
- <div class="utilityCard" style="display:flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px;">
1262
- <div>
1263
- <div class="utilityHead" style="margin-bottom: 4px; color: var(--text);">Relatórios Rápidos</div>
1264
- <div class="help" style="margin: 0;">Gere relatórios sintéticos instantaneamente</div>
1265
- </div>
1266
- <div style="display:flex; gap: 8px; flex-wrap: wrap;">
1267
- <button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('status')">Executivo</button>
1268
- <button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('sm-weekly')">SM Semanal</button>
1269
- <button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500; border-color: rgba(239, 68, 68, 0.4); color: #f87171;" type="button" onclick="runReport('blockers')">Bloqueios</button>
1270
- <button class="btn" style="min-width: 100px; padding: 6px 12px; font-weight: 500;" type="button" onclick="runReport('daily')">Daily</button>
1271
- </div>
1272
- </div>
1273
- </section>
1274
-
1275
- <!-- Report Preview Panel — populated by runReport() via setOut() -->
1276
- <section class="panel" id="reportPreviewPanel" style="display:none; margin-bottom: 16px;">
1277
- <div class="panelHead" style="background: linear-gradient(90deg, var(--paper2), var(--paper)); border-left: 4px solid var(--accent);">
1278
- <b style="color: var(--text); font-size: 14px;" id="reportPreviewTitle">Relatório Gerado</b>
1279
- <div class="stack">
1280
- <button class="btn small" type="button" onclick="document.getElementById('reportPreviewPanel').style.display='none'">Fechar</button>
1281
- </div>
1282
- </div>
1283
- <div class="panelBody panelScroll" style="max-height: 520px; overflow-y: auto;">
1284
- <div id="reportPreview" class="log md" style="font-family: var(--sans); padding: 8px 0;"></div>
1285
- </div>
1286
- </section>
1287
-
1288
1260
  <div class="centerHead">
1289
1261
  <div>
1290
1262
  <h1 style="margin:0">Seu dia em um painel</h1>
@@ -1322,6 +1294,7 @@ function buildHtml(safeDefault, appVersion) {
1322
1294
  <b>Relatórios Recentes</b>
1323
1295
  <div class="stack">
1324
1296
  <button class="btn small" type="button" onclick="refreshReports()">Atualizar</button>
1297
+ <button class="btn small" type="button" onclick="window.location.href='/reports'">Ver todos →</button>
1325
1298
  </div>
1326
1299
  </div>
1327
1300
  <div class="panelBody panelScroll" style="max-height: 300px;">
@@ -1439,6 +1412,21 @@ function buildReportsHtml(safeDefault, appVersion) {
1439
1412
  </div>
1440
1413
  </section>
1441
1414
 
1415
+ <!-- Report Generation Bar -->
1416
+ <section class="reportsGenBar" style="display:flex; align-items:center; gap:12px; flex-wrap:wrap; margin-bottom:16px; padding:16px; background:var(--paper2); border-radius:8px; border:1px solid var(--border);">
1417
+ <div style="flex:1; min-width:140px;">
1418
+ <div style="font-size:13px; font-weight:600; color:var(--text); margin-bottom:2px;">Gerar Novo Relatório</div>
1419
+ <div style="font-size:12px; color:var(--muted);">O relatório gerado aparecerá no topo da lista</div>
1420
+ </div>
1421
+ <div style="display:flex; gap:8px; flex-wrap:wrap; align-items:center;">
1422
+ <button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('daily')">📅 Daily</button>
1423
+ <button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('status')">📊 Executivo</button>
1424
+ <button class="btn" style="min-width:110px; border-color:rgba(239,68,68,0.4); color:#f87171;" type="button" onclick="runReportPage('blockers')">🚧 Bloqueios</button>
1425
+ <button class="btn" style="min-width:110px;" type="button" onclick="runReportPage('sm-weekly')">📋 SM Weekly</button>
1426
+ <span id="reportsGenStatus" style="font-size:12px; color:var(--muted); display:none;">⏳ Gerando...</span>
1427
+ </div>
1428
+ </section>
1429
+
1442
1430
  <section class="reportsTools" style="display:flex; gap:12px; align-items:center;">
1443
1431
  <div class="tabs" style="display:flex; gap:8px;" id="reportsTabs">
1444
1432
  <button class="pill ok" id="tabChrono" onclick="setReportsTab('chrono')">Cronológico</button>
@@ -1829,12 +1817,9 @@ function buildCompanionHtml(safeDefault, appVersion) {
1829
1817
  </div>
1830
1818
  </section>
1831
1819
 
1832
- <section class="reportsTools" style="display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; margin-bottom: 24px;">
1833
- <button class="btn" type="button" onclick="runReport('daily')">Gerar Daily</button>
1834
- <button class="btn" type="button" onclick="runReport('blockers')">Gerar Blockers</button>
1835
- <button class="btn" type="button" onclick="runReport('status')">Gerar Status</button>
1836
- <button class="btn" type="button" onclick="runReport('sm-weekly')">Gerar SM Weekly</button>
1837
- </section>
1820
+ <button class="btn small" type="button" onclick="window.location.href='/reports'" style="margin-bottom: 16px;">
1821
+ 📊 Ver / Gerar Relatórios →
1822
+ </button>
1838
1823
 
1839
1824
  <!-- BENTO GRID LAYOUT -->
1840
1825
  <div style="display: grid; grid-template-columns: 1fr 1.5fr; gap: 24px; align-items: start;">
@@ -1914,12 +1899,6 @@ function buildCompanionHtml(safeDefault, appVersion) {
1914
1899
  </div>
1915
1900
  </section>
1916
1901
 
1917
- <section class="panel">
1918
- <div class="panelHead"><b>Saída de Relatório</b></div>
1919
- <div class="panelBody">
1920
- <div id="reportPreview" class="log md" style="font-family: var(--sans);"></div>
1921
- </div>
1922
- </section>
1923
1902
  </div>
1924
1903
 
1925
1904
  </div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cccarv82/freya",
3
- "version": "2.8.3",
3
+ "version": "2.9.0",
4
4
  "description": "Personal AI Assistant with local-first persistence",
5
5
  "scripts": {
6
6
  "health": "node scripts/validate-data.js && node scripts/validate-structure.js",