@danhachuel/thunderbolt 0.5.56 → 0.5.58
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 +19 -4
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -2057,7 +2057,8 @@ def format_metric_number(value: Any) -> str:
|
|
|
2057
2057
|
if value in (None, ""):
|
|
2058
2058
|
return "—"
|
|
2059
2059
|
try:
|
|
2060
|
-
|
|
2060
|
+
normalized = str(value).strip().replace(".", "").replace(",", "")
|
|
2061
|
+
return f"{int(normalized):,}".replace(",", ".")
|
|
2061
2062
|
except (TypeError, ValueError):
|
|
2062
2063
|
return str(value)
|
|
2063
2064
|
|
|
@@ -2207,6 +2208,8 @@ def render_tiktok_channels():
|
|
|
2207
2208
|
st.metric("Seguidores", format_metric_number(channel.get("subscriber_count")))
|
|
2208
2209
|
with card_cols[3]:
|
|
2209
2210
|
st.metric("Curtidas", format_metric_number(channel.get("likes_count")))
|
|
2211
|
+
with card_cols[4]:
|
|
2212
|
+
st.metric("Vídeos", format_metric_number(channel.get("video_count")))
|
|
2210
2213
|
with card_cols[5]:
|
|
2211
2214
|
active = st.toggle("Activo", value=bool(channel.get("active", True)), key=f"tiktok_import_card_active_{channel_id}")
|
|
2212
2215
|
if active != bool(channel.get("active", True)):
|
|
@@ -2340,6 +2343,16 @@ def is_youtube_channel_record(channel: Any) -> bool:
|
|
|
2340
2343
|
return classify_channel_platform(channel) == "youtube"
|
|
2341
2344
|
|
|
2342
2345
|
|
|
2346
|
+
def _format_channel_count(value: Any) -> str:
|
|
2347
|
+
"""Mostrar contadores inteiros com ponto a cada três algarismos."""
|
|
2348
|
+
if value is None or str(value).strip() == "":
|
|
2349
|
+
return "—"
|
|
2350
|
+
try:
|
|
2351
|
+
return f"{int(value):,}".replace(",", ".")
|
|
2352
|
+
except (TypeError, ValueError):
|
|
2353
|
+
return str(value)
|
|
2354
|
+
|
|
2355
|
+
|
|
2343
2356
|
def render_channels():
|
|
2344
2357
|
st.title("Canais Youtube")
|
|
2345
2358
|
st.caption("Escolha entre importar dados públicos do YouTube ou preencher o canal manualmente.")
|
|
@@ -2810,7 +2823,7 @@ def render_channels():
|
|
|
2810
2823
|
channel_id = str(channel["id"])
|
|
2811
2824
|
edit_key = f"edit_channel_{channel_id}"
|
|
2812
2825
|
with st.container(border=True):
|
|
2813
|
-
header_cols = st.columns([0.7, 3.
|
|
2826
|
+
header_cols = st.columns([0.7, 3.1, 1.25, 1.15, 1.55, 1.5])
|
|
2814
2827
|
with header_cols[0]:
|
|
2815
2828
|
if channel.get("thumbnail_url"):
|
|
2816
2829
|
st.image(channel["thumbnail_url"], width=64)
|
|
@@ -2821,10 +2834,12 @@ def render_channels():
|
|
|
2821
2834
|
st.caption(channel_niche_label(channel))
|
|
2822
2835
|
st.caption(f"{channel.get('handle') or channel.get('url') or 'sem URL'} · {channel.get('metrics_source', 'manual')}")
|
|
2823
2836
|
with header_cols[2]:
|
|
2824
|
-
st.metric("Inscritos",
|
|
2837
|
+
st.metric("Inscritos", _format_channel_count(channel.get("subscriber_count")))
|
|
2825
2838
|
with header_cols[3]:
|
|
2826
|
-
st.metric("Vídeos",
|
|
2839
|
+
st.metric("Vídeos", _format_channel_count(channel.get("video_count")))
|
|
2827
2840
|
with header_cols[4]:
|
|
2841
|
+
st.metric("Visualizações", _format_channel_count(channel.get("view_count")))
|
|
2842
|
+
with header_cols[5]:
|
|
2828
2843
|
active = st.toggle("Activo", value=channel.get("active", True), key=f"active_{channel_id}")
|
|
2829
2844
|
if active != channel.get("active"):
|
|
2830
2845
|
update_channel(channel_id, {"active": active})
|
package/package.json
CHANGED