@danhachuel/thunderbolt 0.4.0 → 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.
- package/app/main.py +45 -11
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -1281,9 +1281,9 @@ def render_channel_edit_form(channel: dict, youtube_account_ids: list[str], yout
|
|
|
1281
1281
|
st.rerun()
|
|
1282
1282
|
|
|
1283
1283
|
|
|
1284
|
-
def
|
|
1285
|
-
|
|
1286
|
-
update_area, version_area = st.columns([1.45,
|
|
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])
|
|
1287
1287
|
with update_area:
|
|
1288
1288
|
st.markdown(
|
|
1289
1289
|
"""
|
|
@@ -1306,6 +1306,8 @@ def render_dashboard():
|
|
|
1306
1306
|
if st.button("Atualizar Versão", key="home_update_version", use_container_width=True, type="primary", icon=":material/system_update:"):
|
|
1307
1307
|
with st.spinner("A instalar a versão mais recente…"):
|
|
1308
1308
|
st.session_state["home_update_result"] = update_to_latest(APP_VERSION)
|
|
1309
|
+
st.session_state["home_update_notice_dismissed"] = False
|
|
1310
|
+
st.rerun()
|
|
1309
1311
|
with version_area:
|
|
1310
1312
|
cache_key = "home_update_version_check"
|
|
1311
1313
|
checked_at_key = "home_update_version_checked_at"
|
|
@@ -1313,18 +1315,48 @@ def render_dashboard():
|
|
|
1313
1315
|
st.session_state[cache_key] = check_version(APP_VERSION)
|
|
1314
1316
|
st.session_state[checked_at_key] = time.monotonic()
|
|
1315
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
|
|
1316
1322
|
if version_status.update_available:
|
|
1317
|
-
|
|
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"
|
|
1318
1325
|
elif version_status.error:
|
|
1319
|
-
|
|
1326
|
+
notice_message = f"Versão actual: {APP_VERSION_LABEL or 'desconhecida'} · verificação de actualização indisponível."
|
|
1327
|
+
notice_kind = "caption"
|
|
1320
1328
|
else:
|
|
1321
|
-
|
|
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()
|
|
1322
1344
|
update_result = st.session_state.get("home_update_result")
|
|
1323
|
-
if update_result is not None:
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
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()
|
|
1328
1360
|
st.title("Thunderbolt")
|
|
1329
1361
|
st.caption(ui_text("Interface local para operação e automação de conteúdo faceless", ui_language))
|
|
1330
1362
|
summary = pipeline_summary()
|
|
@@ -7092,6 +7124,8 @@ def main():
|
|
|
7092
7124
|
current_page = "Início"
|
|
7093
7125
|
st.session_state["page"] = current_page
|
|
7094
7126
|
ui_language = current_ui_language()
|
|
7127
|
+
if current_page == "Início":
|
|
7128
|
+
render_home_update_controls()
|
|
7095
7129
|
render_ui_language_picker(ui_language)
|
|
7096
7130
|
|
|
7097
7131
|
def navigate(target: str):
|
package/package.json
CHANGED