From c0707ffc1bc01c18d74383c06dc83aadfe293359 Mon Sep 17 00:00:00 2001 From: 4Ventures <4ventures@MacBook-Air-de-4Ventures.local> Date: Mon, 28 Sep 2026 17:57:56 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20Social=20=E2=80=94=20solo=20posts=20IG?= =?UTF-8?q?=20y=20barras=20de=20evoluci=C3=B3n=20visibles=20con=20delta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cursor --- src/components/SocialDashboard.tsx | 105 ++++++++++++++++------------- 1 file changed, 57 insertions(+), 48 deletions(-) diff --git a/src/components/SocialDashboard.tsx b/src/components/SocialDashboard.tsx index ba020e6..05fb18f 100644 --- a/src/components/SocialDashboard.tsx +++ b/src/components/SocialDashboard.tsx @@ -277,23 +277,39 @@ function MiniBars({ } const max = Math.max(1, ...pts.map((p) => p.value)); return ( -
- {pts.map((p) => ( -
+
+ {pts.map((p) => { + const pct = Math.max(6, Math.round((p.value / max) * 100)); + return (
-
- ))} + key={p.day} + className="flex-1 min-w-0 h-full flex flex-col justify-end" + title={`${p.day}: ${n(p.value)}`} + > +
+
+ ); + })}
); } +function seriesDelta(series?: DayPoint[]): { + abs: number; + pct: number | null; + up: boolean; +} | null { + if (!series || series.length < 2) return null; + const first = series[0].value; + const last = series[series.length - 1].value; + const abs = last - first; + const pct = first !== 0 ? (100 * abs) / Math.abs(first) : null; + return { abs, pct, up: abs >= 0 }; +} + function ChartCard({ title, hint, @@ -307,6 +323,7 @@ function ChartCard({ total?: number | null; color: string; }) { + const delta = seriesDelta(series); return (
@@ -316,7 +333,22 @@ function ChartCard({

{hint ?

{hint}

: null}
-

{n(total)}

+
+

{n(total)}

+ {delta ? ( +

+ {delta.up ? '↑' : '↓'} {n(Math.abs(delta.abs))} + {delta.pct != null + ? ` (${delta.pct > 0 ? '+' : ''}${delta.pct.toFixed(0)}%)` + : ''} + inicio→fin +

+ ) : null} +
{series && series.length > 1 ? ( @@ -345,9 +377,6 @@ export default function SocialDashboard({ warning?: string; }>({}); const [posts, setPosts] = useState([]); - const [feedFilter, setFeedFilter] = useState<'all' | 'instagram' | 'facebook'>( - 'all' - ); const [err, setErr] = useState(null); useEffect(() => { @@ -375,10 +404,10 @@ export default function SocialDashboard({ const by = useMemo(() => new Map(integs.map((i) => [i.provider, i])), [integs]); const ig = metrics.instagram; const fb = metrics.facebook; - const visiblePosts = - feedFilter === 'all' - ? posts - : posts.filter((p) => p.platform === feedFilter); + const visiblePosts = useMemo( + () => posts.filter((p) => p.platform === 'instagram'), + [posts] + ); const kpiCards = [ { @@ -606,8 +635,8 @@ export default function SocialDashboard({ Evolución diaria · {rangeLabel}

- Totales del periodo arriba a la derecha de cada gráfica. Globales - (seguidores/publicaciones) en las KPI. + Barras = valor diario. Flecha = cambio del primer al último día + del periodo. Totales arriba a la derecha.

@@ -618,38 +647,18 @@ export default function SocialDashboard({
-
+

- Contenido publicado + Publicaciones Instagram

-
- {( - [ - ['all', 'Todo'], - ['instagram', 'IG'], - ['facebook', 'FB'], - ] as const - ).map(([id, lbl]) => ( - - ))} -
+

+ Solo IG (feed, reels y carruseles). Sin posts de Facebook. +

{visiblePosts.length === 0 ? (

- Sin posts en este periodo (o el token Meta no puede leer la - Página/IG). + Sin publicaciones de Instagram en este periodo.

) : (