From a5188137a9fc3bbaaa994d587cb7857e5c5a77bb Mon Sep 17 00:00:00 2001 From: Tilumca Date: Thu, 15 Oct 2026 02:16:22 +0200 Subject: [PATCH] Dashboard: laczny wskaznik 'Postep realizacji' zamiast nadmiar/deficyt (strzalka gora/dol + netto serii vs planu) --- app/src/pages/Dashboard.tsx | 50 +++++++++++++++++++++++++++---------- app/test/e2e/auth.spec.ts | 5 ++-- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/app/src/pages/Dashboard.tsx b/app/src/pages/Dashboard.tsx index c909d53..2eb31c4 100644 --- a/app/src/pages/Dashboard.tsx +++ b/app/src/pages/Dashboard.tsx @@ -1,6 +1,6 @@ import { useEffect, useState, type ReactNode } from 'react'; import { Link } from 'react-router-dom'; -import { CalendarPlus, Dumbbell, Flame, Megaphone, Play } from 'lucide-react'; +import { CalendarPlus, Dumbbell, Flame, Megaphone, Minus, Play, TrendingDown, TrendingUp } from 'lucide-react'; import type { LucideIcon } from 'lucide-react'; import { useActiveSession, useDashboard, useFeed } from '../api/queries'; import { FeedItemRow } from '../components/FeedItemRow'; @@ -116,15 +116,15 @@ function StatCard({ }: { label: string; value: ReactNode; - tone?: 'default' | 'danger'; + tone?: 'default' | 'danger' | 'positive'; children?: ReactNode; }) { return (
{label}
{value} @@ -355,8 +355,8 @@ export default function Dashboard() { /> )} - {/* Statystyki: ring postępu + killstreak + nadmiar + deficyt */} -
+ {/* Statystyki: ring postępu + killstreak + postęp realizacji (serie vs plan) */} +
@@ -372,15 +372,39 @@ export default function Dashboard() { - -
ponad normę planu
-
0 ? 'danger' : 'default'} + label="Postęp realizacji" + value={(() => { + // Pojedynczy wskaźnik: ile serii powyżej/poniżej planu (nadmiar − deficyt). + if (!data.extra || !data.missing) return '—'; + const net = data.extra.sets - data.missing.sets; + const Icon = net > 0 ? TrendingUp : net < 0 ? TrendingDown : Minus; + return ( + <> +
diff --git a/app/test/e2e/auth.spec.ts b/app/test/e2e/auth.spec.ts index a1f71ce..563f89f 100644 --- a/app/test/e2e/auth.spec.ts +++ b/app/test/e2e/auth.spec.ts @@ -18,8 +18,9 @@ test('udane logowanie przekierowuje na dashboard', async ({ page }) => { await expect(page).toHaveURL(/\/$/); await expect(page.getByRole('heading', { name: 'Dashboard' })).toBeVisible(); await expect(page.getByText('Plan testowy')).toBeVisible(); - await expect(page.getByText('Nadmiar (serii ponad plan)')).toBeVisible(); - await expect(page.getByText('Deficyt (niewykonane serie z planu)')).toBeVisible(); + await expect(page.getByText('Postęp realizacji')).toBeVisible(); + await expect(page.getByText('+4')).toBeVisible(); + await expect(page.getByText('serii ponad plan')).toBeVisible(); }); test('zapamiętaj mnie zapisuje e-mail i podpowiada go po wylogowaniu', async ({ page }) => {