From e0f70ffa583a4249259b459ee61fb5ed44c3344f Mon Sep 17 00:00:00 2001 From: tisachi Date: Fri, 4 Sep 2026 23:19:28 +0200 Subject: [PATCH] =?UTF-8?q?Refaktoryzacja=20struktury=20i=20podzia=C5=82?= =?UTF-8?q?=20modu=C5=82=C3=B3w=20(app/admin/api),=20konsolidacja=20test?= =?UTF-8?q?=C3=B3w=20w=20test/,=20komunikator=20(lista=20kontakt=C3=B3w,?= =?UTF-8?q?=20za=C5=82=C4=85cznik=20bez=20tre=C5=9Bci),=20profil=20podopie?= =?UTF-8?q?cznego=20(menu=20kontekstowe,=20nag=C5=82=C3=B3wek,=20zapami?= =?UTF-8?q?=C4=99tywanie=20zak=C5=82adki),=20Tabs:=20strza=C5=82ki=20poza?= =?UTF-8?q?=20scrollem=20+=20scroll-snap=20do=20ca=C5=82ych=20zak=C5=82ade?= =?UTF-8?q?k,=20podniesione=20limity=20rate-limit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- AGENTS.md | 5 +- README.md | 17 +- admin/playwright.config.ts | 5 +- admin/src/App.tsx | 18 +- admin/src/components/ui.tsx | 323 +---- admin/src/components/ui/content.tsx | 206 ++++ admin/src/components/ui/dialogs.tsx | 80 ++ admin/src/components/ui/theme-toggle.tsx | 16 + admin/src/components/ui/typography.tsx | 21 + admin/src/pages/{ => catalog}/Equipment.tsx | 12 +- admin/src/pages/{ => catalog}/Exercises.tsx | 10 +- admin/src/pages/{ => catalog}/FocusAreas.tsx | 10 +- admin/src/pages/{ => gyms}/GymDetail.tsx | 16 +- admin/src/pages/{ => gyms}/GymForm.tsx | 12 +- admin/src/pages/{ => gyms}/GymsList.tsx | 12 +- admin/src/pages/{ => users}/UserDetail.tsx | 14 +- admin/src/pages/{ => users}/UserForm.tsx | 6 +- admin/src/pages/{ => users}/UsersList.tsx | 12 +- admin/src/topbar/useTopbar.ts | 1 - admin/test/Equipment.test.tsx | 2 +- admin/test/Exercises.test.tsx | 2 +- admin/test/FocusAreas.test.tsx | 2 +- admin/test/GymDetail.test.tsx | 2 +- admin/test/GymsList.test.tsx | 2 +- admin/test/UserDetail.test.tsx | 2 +- admin/test/UserForm.test.tsx | 2 +- admin/test/UsersList.test.tsx | 2 +- admin/{ => test}/e2e/admin.spec.ts | 0 admin/{ => test}/e2e/auth.spec.ts | 0 admin/{ => test}/e2e/equipment.spec.ts | 0 admin/{ => test}/e2e/exercises.spec.ts | 0 admin/{ => test}/e2e/fixtures.ts | 0 admin/{ => test}/e2e/gym-gallery.spec.ts | 0 admin/{ => test}/e2e/logs.spec.ts | 0 admin/{ => test}/e2e/mock-api.ts | 28 +- admin/{ => test}/e2e/smoke.spec.ts | 0 admin/{ => test}/e2e/verifications.spec.ts | 0 admin/tsconfig.app.tsbuildinfo | 1 - admin/tsconfig.e2e.json | 2 +- api/eslint.config.js | 2 +- api/{ => scripts}/smoke-test.mjs | 0 api/src/middleware/rateLimit.ts | 10 +- api/src/routes/gyms.ts | 713 +---------- api/src/routes/gyms/claims.ts | 140 +++ api/src/routes/gyms/invitations.ts | 178 +++ api/src/routes/gyms/management.ts | 182 +++ api/src/routes/gyms/photos.ts | 179 +++ api/src/routes/gyms/schemas.ts | 63 + api/src/services/gyms.ts | 1038 +---------------- api/src/services/gyms/claims.ts | 178 +++ api/src/services/gyms/core.ts | 266 +++++ api/src/services/gyms/exceptions.ts | 175 +++ api/src/services/gyms/includes.ts | 20 + api/src/services/gyms/invitations.ts | 199 ++++ api/src/services/gyms/photos.ts | 200 ++++ api/src/services/trainer.ts | 3 +- api/test/integration/trainer.test.ts | 5 + api/tsconfig.tsbuildinfo | 1 - app/playwright.config.ts | 5 +- app/src/App.tsx | 32 +- app/src/api/types.ts | 2 + app/src/components/ExerciseProgressCards.tsx | 3 +- app/src/components/HistoryTable.tsx | 3 +- app/src/components/MessageAttachmentCard.tsx | 2 +- app/src/components/calendar/CalendarView.tsx | 3 +- app/src/components/{ => gyms}/ClaimModal.tsx | 12 +- .../components/{ => gyms}/GymCreateModal.tsx | 12 +- app/src/components/{ => gyms}/GymGallery.tsx | 8 +- app/src/components/{ => gyms}/GymsSection.tsx | 10 +- .../components/{ => gyms}/InviteGymModal.tsx | 6 +- app/src/components/plans/PlanCard.tsx | 2 +- app/src/components/plans/PlanWeeks.tsx | 3 +- app/src/components/ui.tsx | 698 +---------- app/src/components/ui/content.tsx | 306 +++++ app/src/components/ui/dialogs.tsx | 308 +++++ app/src/components/ui/theme-toggle.tsx | 16 + app/src/components/ui/typography.tsx | 21 + app/src/components/ui/week-picker.tsx | 128 ++ app/src/lib/format.ts | 55 + .../{components/helpers.ts => lib/labels.ts} | 58 +- app/src/pages/Calendar.tsx | 3 +- app/src/pages/Dashboard.tsx | 3 +- app/src/pages/DayExecution.tsx | 3 +- app/src/pages/Invitations.tsx | 7 +- app/src/pages/PlanEditor.tsx | 896 -------------- app/src/pages/TraineeDetail.tsx | 795 ------------- app/src/pages/{ => gyms}/GymDetail.tsx | 24 +- .../GymSections.tsx} | 14 +- app/src/pages/{ => gyms}/Gyms.tsx | 20 +- .../pages/{ => messages}/MessageThread.tsx | 96 +- app/src/pages/{ => messages}/Messages.tsx | 60 +- app/src/pages/{ => plans}/PlanDetail.tsx | 13 +- app/src/pages/plans/PlanEditor.tsx | 382 ++++++ app/src/pages/{ => plans}/Plans.tsx | 14 +- app/src/pages/plans/plan-editor/DayEditor.tsx | 95 ++ app/src/pages/plans/plan-editor/DayPicker.tsx | 29 + .../plans/plan-editor/ExerciseEditor.tsx | 73 ++ .../plan-editor/ExerciseResultsPanel.tsx | 79 ++ .../pages/plans/plan-editor/PlanMetaForm.tsx | 57 + app/src/pages/plans/plan-editor/SetEditor.tsx | 66 ++ .../pages/plans/plan-editor/WeekAccordion.tsx | 63 + app/src/pages/plans/plan-editor/types.ts | 53 + app/src/pages/{ => profile}/Profile.tsx | 12 +- .../{ => profile}/ProfileBodyParameters.tsx | 16 +- app/src/pages/{ => profile}/ProfileClaims.tsx | 14 +- app/src/pages/{ => profile}/ProfileGyms.tsx | 8 +- .../pages/{ => profile}/ProfileHistory.tsx | 10 +- app/src/pages/{ => profile}/ProfileInfo.tsx | 16 +- .../pages/{ => profile}/ProfileProgress.tsx | 8 +- app/src/pages/trainees/TraineeDetail.tsx | 232 ++++ app/src/pages/{ => trainees}/Trainees.tsx | 17 +- .../trainee-detail/DisciplineHeatmap.tsx | 37 + .../trainees/trainee-detail/DisciplineTab.tsx | 67 ++ .../trainees/trainee-detail/OverviewTab.tsx | 94 ++ .../trainees/trainee-detail/ProgressTab.tsx | 88 ++ .../trainee-detail/TraineeCalendarTab.tsx | 96 ++ .../trainee-detail/TraineePlansTab.tsx | 218 ++++ app/src/topbar/useTopbar.ts | 1 - app/test/Calendar.test.tsx | 4 +- app/{ => test}/e2e/active-training.spec.ts | 0 app/{ => test}/e2e/auth.spec.ts | 0 app/{ => test}/e2e/calendar.spec.ts | 0 app/{ => test}/e2e/day-execution.spec.ts | 0 app/{ => test}/e2e/fixtures.ts | 2 + app/{ => test}/e2e/gym-gallery.spec.ts | 0 app/{ => test}/e2e/gyms.spec.ts | 0 app/{ => test}/e2e/invitations.spec.ts | 0 app/{ => test}/e2e/messages.spec.ts | 32 +- app/{ => test}/e2e/mock-api.ts | 22 +- app/{ => test}/e2e/nickname-social.spec.ts | 0 app/{ => test}/e2e/plans.spec.ts | 0 app/{ => test}/e2e/profile-claims.spec.ts | 0 app/{ => test}/e2e/smoke.spec.ts | 0 app/{ => test}/e2e/trainee-plans.spec.ts | 0 app/{ => test}/e2e/trainees.spec.ts | 15 + app/{ => test}/e2e/virtual-gyms.spec.ts | 0 app/test/helpers.test.ts | 14 +- app/test/message-thread.test.tsx | 30 +- app/test/messages.test.tsx | 32 + app/test/trainee-plans.test.tsx | 3 +- app/test/trainees.test.tsx | 42 + app/tsconfig.app.tsbuildinfo | 1 - app/tsconfig.e2e.json | 2 +- 144 files changed, 5283 insertions(+), 4788 deletions(-) create mode 100644 admin/src/components/ui/content.tsx create mode 100644 admin/src/components/ui/dialogs.tsx create mode 100644 admin/src/components/ui/theme-toggle.tsx create mode 100644 admin/src/components/ui/typography.tsx rename admin/src/pages/{ => catalog}/Equipment.tsx (97%) rename admin/src/pages/{ => catalog}/Exercises.tsx (97%) rename admin/src/pages/{ => catalog}/FocusAreas.tsx (97%) rename admin/src/pages/{ => gyms}/GymDetail.tsx (98%) rename admin/src/pages/{ => gyms}/GymForm.tsx (89%) rename admin/src/pages/{ => gyms}/GymsList.tsx (94%) rename admin/src/pages/{ => users}/UserDetail.tsx (98%) rename admin/src/pages/{ => users}/UserForm.tsx (96%) rename admin/src/pages/{ => users}/UsersList.tsx (91%) rename admin/{ => test}/e2e/admin.spec.ts (100%) rename admin/{ => test}/e2e/auth.spec.ts (100%) rename admin/{ => test}/e2e/equipment.spec.ts (100%) rename admin/{ => test}/e2e/exercises.spec.ts (100%) rename admin/{ => test}/e2e/fixtures.ts (100%) rename admin/{ => test}/e2e/gym-gallery.spec.ts (100%) rename admin/{ => test}/e2e/logs.spec.ts (100%) rename admin/{ => test}/e2e/mock-api.ts (96%) rename admin/{ => test}/e2e/smoke.spec.ts (100%) rename admin/{ => test}/e2e/verifications.spec.ts (100%) delete mode 100644 admin/tsconfig.app.tsbuildinfo rename api/{ => scripts}/smoke-test.mjs (100%) create mode 100644 api/src/routes/gyms/claims.ts create mode 100644 api/src/routes/gyms/invitations.ts create mode 100644 api/src/routes/gyms/management.ts create mode 100644 api/src/routes/gyms/photos.ts create mode 100644 api/src/routes/gyms/schemas.ts create mode 100644 api/src/services/gyms/claims.ts create mode 100644 api/src/services/gyms/core.ts create mode 100644 api/src/services/gyms/exceptions.ts create mode 100644 api/src/services/gyms/includes.ts create mode 100644 api/src/services/gyms/invitations.ts create mode 100644 api/src/services/gyms/photos.ts delete mode 100644 api/tsconfig.tsbuildinfo rename app/src/components/{ => gyms}/ClaimModal.tsx (96%) rename app/src/components/{ => gyms}/GymCreateModal.tsx (92%) rename app/src/components/{ => gyms}/GymGallery.tsx (97%) rename app/src/components/{ => gyms}/GymsSection.tsx (96%) rename app/src/components/{ => gyms}/InviteGymModal.tsx (96%) create mode 100644 app/src/components/ui/content.tsx create mode 100644 app/src/components/ui/dialogs.tsx create mode 100644 app/src/components/ui/theme-toggle.tsx create mode 100644 app/src/components/ui/typography.tsx create mode 100644 app/src/components/ui/week-picker.tsx create mode 100644 app/src/lib/format.ts rename app/src/{components/helpers.ts => lib/labels.ts} (50%) delete mode 100644 app/src/pages/PlanEditor.tsx delete mode 100644 app/src/pages/TraineeDetail.tsx rename app/src/pages/{ => gyms}/GymDetail.tsx (97%) rename app/src/pages/{gym-sections.tsx => gyms/GymSections.tsx} (95%) rename app/src/pages/{ => gyms}/Gyms.tsx (97%) rename app/src/pages/{ => messages}/MessageThread.tsx (73%) rename app/src/pages/{ => messages}/Messages.tsx (55%) rename app/src/pages/{ => plans}/PlanDetail.tsx (95%) create mode 100644 app/src/pages/plans/PlanEditor.tsx rename app/src/pages/{ => plans}/Plans.tsx (90%) create mode 100644 app/src/pages/plans/plan-editor/DayEditor.tsx create mode 100644 app/src/pages/plans/plan-editor/DayPicker.tsx create mode 100644 app/src/pages/plans/plan-editor/ExerciseEditor.tsx create mode 100644 app/src/pages/plans/plan-editor/ExerciseResultsPanel.tsx create mode 100644 app/src/pages/plans/plan-editor/PlanMetaForm.tsx create mode 100644 app/src/pages/plans/plan-editor/SetEditor.tsx create mode 100644 app/src/pages/plans/plan-editor/WeekAccordion.tsx create mode 100644 app/src/pages/plans/plan-editor/types.ts rename app/src/pages/{ => profile}/Profile.tsx (93%) rename app/src/pages/{ => profile}/ProfileBodyParameters.tsx (98%) rename app/src/pages/{ => profile}/ProfileClaims.tsx (91%) rename app/src/pages/{ => profile}/ProfileGyms.tsx (79%) rename app/src/pages/{ => profile}/ProfileHistory.tsx (91%) rename app/src/pages/{ => profile}/ProfileInfo.tsx (98%) rename app/src/pages/{ => profile}/ProfileProgress.tsx (85%) create mode 100644 app/src/pages/trainees/TraineeDetail.tsx rename app/src/pages/{ => trainees}/Trainees.tsx (96%) create mode 100644 app/src/pages/trainees/trainee-detail/DisciplineHeatmap.tsx create mode 100644 app/src/pages/trainees/trainee-detail/DisciplineTab.tsx create mode 100644 app/src/pages/trainees/trainee-detail/OverviewTab.tsx create mode 100644 app/src/pages/trainees/trainee-detail/ProgressTab.tsx create mode 100644 app/src/pages/trainees/trainee-detail/TraineeCalendarTab.tsx create mode 100644 app/src/pages/trainees/trainee-detail/TraineePlansTab.tsx rename app/{ => test}/e2e/active-training.spec.ts (100%) rename app/{ => test}/e2e/auth.spec.ts (100%) rename app/{ => test}/e2e/calendar.spec.ts (100%) rename app/{ => test}/e2e/day-execution.spec.ts (100%) rename app/{ => test}/e2e/fixtures.ts (99%) rename app/{ => test}/e2e/gym-gallery.spec.ts (100%) rename app/{ => test}/e2e/gyms.spec.ts (100%) rename app/{ => test}/e2e/invitations.spec.ts (100%) rename app/{ => test}/e2e/messages.spec.ts (67%) rename app/{ => test}/e2e/mock-api.ts (98%) rename app/{ => test}/e2e/nickname-social.spec.ts (100%) rename app/{ => test}/e2e/plans.spec.ts (100%) rename app/{ => test}/e2e/profile-claims.spec.ts (100%) rename app/{ => test}/e2e/smoke.spec.ts (100%) rename app/{ => test}/e2e/trainee-plans.spec.ts (100%) rename app/{ => test}/e2e/trainees.spec.ts (92%) rename app/{ => test}/e2e/virtual-gyms.spec.ts (100%) delete mode 100644 app/tsconfig.app.tsbuildinfo diff --git a/.gitignore b/.gitignore index de186b0..502df45 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist/ *.log .DS_Store .vite/ -test-results/ -playwright-report/ +**/test/results/ +**/test/report/ blob-report/ +*.tsbuildinfo diff --git a/AGENTS.md b/AGENTS.md index 8465d4d..791c662 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -4,17 +4,18 @@ - `app` (React+Vite, 5173), `admin` (React+Vite, 5174), `api` (Express+Prisma+PostgreSQL, 9002). ## Testy — obowiązkowe po każdej zmianie +- Konwencja: WSZYSTKIE testy projektu żyją w `/test/` — unit/komponent w `test/*` (api: `test/unit/` + `test/integration/`), e2e w `test/e2e/`. Rezultaty i artefakty też pod `test/`: `test/results/` (trace/screenshoty Playwright) i `test/report/` (raport HTML) — oba gitignore'owane. Nie twórz katalogów testowych poza `test/`. - `app`/`admin`: `npm test` (vitest), `npm run test:e2e` (Playwright, API mockowane, dev server sam). `api`: `npm test` (unit+integration, supertest). - Testy aktualizujesz w tej samej zmiance co kod. Zmiana UI → najpierw grep starych tekstów/selectorów w testach. - e2e: `import { test } from './fixtures'` (NIE `@playwright/test`) — guard FAIL przy `console.error`/`pageerror`; wyjątek: `allowConsoleError(page, /re/)` + komentarz. Ignorowane: 401. 403/404/5xx = FAIL. -- e2e bez API/DB: `mockApi(page, ...)` z `e2e/mock-api.ts`. Nowe pliki: `e2e/.spec.ts`, opisy PL. +- e2e bez API/DB: `mockApi(page, ...)` z `test/e2e/mock-api.ts`. Nowe pliki: `test/e2e/.spec.ts`, opisy PL. - Selektory: `getByRole`/`getByText`/`input[type=...]` — `getByLabel` NIE działa (`Field` bez `