@danhachuel/thunderbolt 0.3.100 → 0.4.1

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 +57 -12
  2. package/package.json +1 -1
package/app/main.py CHANGED
@@ -23,6 +23,17 @@ try:
23
23
  except (OSError, json.JSONDecodeError):
24
24
  APP_VERSION = ""
25
25
 
26
+
27
+ def display_version(version: str) -> str:
28
+ """Keep the project version label in the two-digit patch convention."""
29
+ parts = str(version or "").strip().split(".")
30
+ if len(parts) == 3 and all(part.isdigit() for part in parts):
31
+ return f"{int(parts[0])}.{int(parts[1])}.{int(parts[2]):02d}"
32
+ return str(version or "")
33
+
34
+
35
+ APP_VERSION_LABEL = display_version(APP_VERSION)
36
+
26
37
  from hermes_ui.domain import STAGES, create_batch, create_channel, create_tasks_for_batch, delete_channel, delete_task, pipeline_summary, retry_task_with_current_settings, set_channel_defaults, transition_task, update_channel, update_channel_video
27
38
  from hermes_ui.drafts import list_drafts, save_draft
28
39
  from hermes_ui.automation_worker import load_worker_status
@@ -1270,9 +1281,9 @@ def render_channel_edit_form(channel: dict, youtube_account_ids: list[str], yout
1270
1281
  st.rerun()
1271
1282
 
1272
1283
 
1273
- def render_dashboard():
1274
- ui_language = current_ui_language()
1275
- update_area, version_area = st.columns([1.45, 4.55])
1284
+ def render_home_update_controls() -> None:
1285
+ """Render the update controls only on the home page and keep notices dismissible."""
1286
+ update_area, version_area, _ = st.columns([1.45, 2.55, 3.0])
1276
1287
  with update_area:
1277
1288
  st.markdown(
1278
1289
  """
@@ -1295,6 +1306,8 @@ def render_dashboard():
1295
1306
  if st.button("Atualizar Versão", key="home_update_version", use_container_width=True, type="primary", icon=":material/system_update:"):
1296
1307
  with st.spinner("A instalar a versão mais recente…"):
1297
1308
  st.session_state["home_update_result"] = update_to_latest(APP_VERSION)
1309
+ st.session_state["home_update_notice_dismissed"] = False
1310
+ st.rerun()
1298
1311
  with version_area:
1299
1312
  cache_key = "home_update_version_check"
1300
1313
  checked_at_key = "home_update_version_checked_at"
@@ -1302,18 +1315,48 @@ def render_dashboard():
1302
1315
  st.session_state[cache_key] = check_version(APP_VERSION)
1303
1316
  st.session_state[checked_at_key] = time.monotonic()
1304
1317
  version_status = st.session_state[cache_key]
1318
+ notice_signature = f"{version_status.latest_version}|{version_status.update_available}|{version_status.error}"
1319
+ if st.session_state.get("home_update_notice_signature") != notice_signature:
1320
+ st.session_state["home_update_notice_signature"] = notice_signature
1321
+ st.session_state["home_update_notice_dismissed"] = False
1305
1322
  if version_status.update_available:
1306
- st.info(f"Nova versão disponível: {version_status.latest_version}. A versão actual é {APP_VERSION or 'desconhecida'}.")
1323
+ notice_message = f"Nova versão disponível: {display_version(version_status.latest_version)}. A versão actual é {APP_VERSION_LABEL or 'desconhecida'}."
1324
+ notice_kind = "info"
1307
1325
  elif version_status.error:
1308
- st.caption(f"Versão actual: {APP_VERSION or 'desconhecida'} · verificação de actualização indisponível.")
1326
+ notice_message = f"Versão actual: {APP_VERSION_LABEL or 'desconhecida'} · verificação de actualização indisponível."
1327
+ notice_kind = "caption"
1309
1328
  else:
1310
- st.caption(f"Versão actual: {APP_VERSION or 'desconhecida'} · já está actualizada ({version_status.latest_version}).")
1329
+ notice_message = f"Versão actual: {APP_VERSION_LABEL or 'desconhecida'} · já está actualizada ({display_version(version_status.latest_version)})."
1330
+ notice_kind = "success"
1331
+ if not st.session_state.get("home_update_notice_dismissed"):
1332
+ notice_col, close_col = st.columns([8.5, 1])
1333
+ with notice_col:
1334
+ if notice_kind == "info":
1335
+ st.info(notice_message)
1336
+ elif notice_kind == "success":
1337
+ st.success(notice_message)
1338
+ else:
1339
+ st.caption(notice_message)
1340
+ with close_col:
1341
+ if st.button("×", key="home_update_notice_close", help="Fechar este aviso"):
1342
+ st.session_state["home_update_notice_dismissed"] = True
1343
+ st.rerun()
1311
1344
  update_result = st.session_state.get("home_update_result")
1312
- if update_result is not None:
1313
- if update_result.ok:
1314
- st.success(update_result.message)
1315
- else:
1316
- st.error(update_result.message)
1345
+ if update_result is not None and not st.session_state.get("home_update_notice_dismissed"):
1346
+ result_col, result_close_col = st.columns([8.5, 1])
1347
+ with result_col:
1348
+ if update_result.ok:
1349
+ st.success(update_result.message)
1350
+ else:
1351
+ st.error(update_result.message)
1352
+ with result_close_col:
1353
+ if st.button("×", key="home_update_result_close", help="Fechar este resultado"):
1354
+ st.session_state["home_update_notice_dismissed"] = True
1355
+ st.rerun()
1356
+
1357
+
1358
+ def render_dashboard():
1359
+ ui_language = current_ui_language()
1317
1360
  st.title("Thunderbolt")
1318
1361
  st.caption(ui_text("Interface local para operação e automação de conteúdo faceless", ui_language))
1319
1362
  summary = pipeline_summary()
@@ -7081,6 +7124,8 @@ def main():
7081
7124
  current_page = "Início"
7082
7125
  st.session_state["page"] = current_page
7083
7126
  ui_language = current_ui_language()
7127
+ if current_page == "Início":
7128
+ render_home_update_controls()
7084
7129
  render_ui_language_picker(ui_language)
7085
7130
 
7086
7131
  def navigate(target: str):
@@ -7093,7 +7138,7 @@ def main():
7093
7138
  navigate(target)
7094
7139
 
7095
7140
  with st.sidebar:
7096
- version_markup = f'<span class="tb-brand-version">{APP_VERSION}</span>' if APP_VERSION else ""
7141
+ version_markup = f'<span class="tb-brand-version">{APP_VERSION_LABEL}</span>' if APP_VERSION_LABEL else ""
7097
7142
  st.markdown(f'<div class="tb-brand"><span class="tb-brand-name">Thunderbolt</span>{version_markup}</div>', unsafe_allow_html=True)
7098
7143
  for target, icon, label in top_pages:
7099
7144
  children = groups.get(target)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.3.100",
3
+ "version": "0.4.1",
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",