@danhachuel/thunderbolt 0.5.42 → 0.5.43

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 (2) hide show
  1. package/app/main.py +24 -15
  2. package/package.json +1 -1
package/app/main.py CHANGED
@@ -1516,21 +1516,30 @@ def render_growth_youtube():
1516
1516
  st.error(str(exc)[:500])
1517
1517
  records = list_analyses()
1518
1518
  selected_record = next((item for item in reversed(records) if str(item.get("channel_id")) == str(selected.get("id"))), None)
1519
- if selected_record is None and records:
1520
- selected_record = records[-1]
1521
- metrics = selected_record.get("metrics", []) if selected_record else []
1522
- overall = int(selected_record.get("overall_score", 50)) if selected_record else 50
1523
- color = _growth_score_color(overall)
1524
- st.markdown(
1525
- f'<div style="border:1px solid #263447;border-radius:12px;padding:18px;margin:12px 0 20px;background:#101722;display:flex;align-items:center;justify-content:space-between;">'
1526
- f'<div><div style="font-size:13px;color:#94a3b8;text-transform:uppercase;letter-spacing:.08em;">Nota geral do canal</div><div style="font-size:18px;font-weight:700;margin-top:5px;">{str(selected.get("name") or "Canal")}</div></div>'
1527
- f'<div style="font-size:42px;font-weight:800;color:{color};line-height:1;">{overall}<span style="font-size:16px;color:#94a3b8;">/100</span></div></div>',
1528
- unsafe_allow_html=True,
1529
- )
1530
- if selected_record and selected_record.get("report_path"):
1531
- report_path = Path(str(selected_record["report_path"]))
1532
- if report_path.is_file():
1533
- st.download_button("BAIXAR ANALISE COMPLETA", report_path.read_bytes(), file_name=report_path.name, mime="text/markdown", key=f"growth_download_{selected_record['code']}")
1519
+ metrics = selected_record.get("metrics", []) if selected_record else [
1520
+ {"label": label, "score": 0, "value": "Aguardando análise", "diagnosis": "Clique em ANALISAR CANAL para preencher esta métrica."}
1521
+ for label in ("Demanda validada", "Qualidade da thumbnail", "Qualidade do título", "Hook — retenção inicial", "Ritmo e edição", "Origem do tráfego", "Conversão em inscritos", "Cadência de publicação")
1522
+ ]
1523
+ overall = int(selected_record.get("overall_score", 0)) if selected_record else None
1524
+ color = _growth_score_color(overall) if overall is not None else "#64748b"
1525
+ score_text = str(overall) if overall is not None else "—"
1526
+ score_suffix = "/100" if overall is not None else ""
1527
+ summary_col, download_col = st.columns([3.25, 1], gap="large")
1528
+ with summary_col:
1529
+ st.markdown(
1530
+ f'<div style="border:1px solid #263447;border-radius:12px;padding:18px;margin:12px 0 20px;background:#101722;display:flex;align-items:center;justify-content:space-between;min-height:76px;">'
1531
+ f'<div><div style="font-size:13px;color:#94a3b8;text-transform:uppercase;letter-spacing:.08em;">Nota geral do canal</div><div style="font-size:18px;font-weight:700;margin-top:5px;">{str(selected.get("name") or "Canal")}</div></div>'
1532
+ f'<div style="font-size:42px;font-weight:800;color:{color};line-height:1;">{score_text}<span style="font-size:16px;color:#94a3b8;">{score_suffix}</span></div></div>',
1533
+ unsafe_allow_html=True,
1534
+ )
1535
+ with download_col:
1536
+ st.write("")
1537
+ if selected_record and selected_record.get("report_path"):
1538
+ report_path = Path(str(selected_record["report_path"]))
1539
+ if report_path.is_file():
1540
+ st.download_button("BAIXAR ANALISE COMPLETA", report_path.read_bytes(), file_name=report_path.name, mime="text/markdown", use_container_width=True, key=f"growth_download_{selected_record['code']}")
1541
+ else:
1542
+ st.button("BAIXAR ANALISE COMPLETA", disabled=True, use_container_width=True, key="growth_download_disabled")
1534
1543
  st.subheader("Dashboard de Growth")
1535
1544
  st.caption("Vermelho: 0–30 · Amarelo: 31–69 · Verde: 70–100. Clique em ANALISAR CANAL para recolher dados públicos actualizados.")
1536
1545
  for row_start in range(0, len(metrics), 4):
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.42",
3
+ "version": "0.5.43",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",