@wger-project/react-components 25.10.16
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/LICENSE +661 -0
- package/README.md +58 -0
- package/build/OpenSans-Bold.woff +0 -0
- package/build/OpenSans-Light.woff +0 -0
- package/build/assets/index.css +1 -0
- package/build/chunks/browser-ponyfill-DL_vVusK.js +3 -0
- package/build/chunks/browser-ponyfill-DL_vVusK.js.map +1 -0
- package/build/favicon.ico +0 -0
- package/build/index.html +60 -0
- package/build/locales/README.md +10 -0
- package/build/locales/ar/translation.json +240 -0
- package/build/locales/ca/translation.json +35 -0
- package/build/locales/cs/translation.json +257 -0
- package/build/locales/de/translation.json +338 -0
- package/build/locales/el/translation.json +97 -0
- package/build/locales/en/translation.json +332 -0
- package/build/locales/es/translation.json +335 -0
- package/build/locales/fa/translation.json +127 -0
- package/build/locales/fr/translation.json +341 -0
- package/build/locales/he/translation.json +146 -0
- package/build/locales/hr/translation.json +249 -0
- package/build/locales/it/translation.json +338 -0
- package/build/locales/ko/translation.json +331 -0
- package/build/locales/nb_NO/translation.json +50 -0
- package/build/locales/nl/translation.json +242 -0
- package/build/locales/pl/translation.json +261 -0
- package/build/locales/pt/translation.json +342 -0
- package/build/locales/pt_BR/translation.json +259 -0
- package/build/locales/pt_PT/translation.json +334 -0
- package/build/locales/ru/translation.json +116 -0
- package/build/locales/sk/translation.json +10 -0
- package/build/locales/sl/translation.json +326 -0
- package/build/locales/sr/translation.json +240 -0
- package/build/locales/sv/translation.json +165 -0
- package/build/locales/ta/translation.json +331 -0
- package/build/locales/th/translation.json +27 -0
- package/build/locales/tr/translation.json +238 -0
- package/build/locales/uk/translation.json +339 -0
- package/build/locales/uz/translation.json +56 -0
- package/build/locales/vi/translation.json +70 -0
- package/build/locales/zh_Hans/translation.json +336 -0
- package/build/locales/zh_Hant/translation.json +246 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/main.js +542 -0
- package/build/main.js.map +1 -0
- package/build/manifest.json +25 -0
- package/build/muscles/SOURCES +2 -0
- package/build/muscles/main/muscle-1.svg +72 -0
- package/build/muscles/main/muscle-10.svg +73 -0
- package/build/muscles/main/muscle-11.svg +72 -0
- package/build/muscles/main/muscle-12.svg +72 -0
- package/build/muscles/main/muscle-13.svg +92 -0
- package/build/muscles/main/muscle-14.svg +73 -0
- package/build/muscles/main/muscle-15.svg +72 -0
- package/build/muscles/main/muscle-16.svg +73 -0
- package/build/muscles/main/muscle-2.svg +72 -0
- package/build/muscles/main/muscle-3.svg +72 -0
- package/build/muscles/main/muscle-4.svg +72 -0
- package/build/muscles/main/muscle-5.svg +72 -0
- package/build/muscles/main/muscle-6.svg +73 -0
- package/build/muscles/main/muscle-7.svg +72 -0
- package/build/muscles/main/muscle-8.svg +72 -0
- package/build/muscles/main/muscle-9.svg +72 -0
- package/build/muscles/muscular_system_back.svg +118 -0
- package/build/muscles/muscular_system_front.svg +99 -0
- package/build/muscles/secondary/muscle-1.svg +72 -0
- package/build/muscles/secondary/muscle-10.svg +73 -0
- package/build/muscles/secondary/muscle-11.svg +72 -0
- package/build/muscles/secondary/muscle-12.svg +72 -0
- package/build/muscles/secondary/muscle-13.svg +92 -0
- package/build/muscles/secondary/muscle-14.svg +73 -0
- package/build/muscles/secondary/muscle-15.svg +72 -0
- package/build/muscles/secondary/muscle-16.svg +73 -0
- package/build/muscles/secondary/muscle-2.svg +72 -0
- package/build/muscles/secondary/muscle-3.svg +72 -0
- package/build/muscles/secondary/muscle-4.svg +72 -0
- package/build/muscles/secondary/muscle-5.svg +72 -0
- package/build/muscles/secondary/muscle-6.svg +73 -0
- package/build/muscles/secondary/muscle-7.svg +72 -0
- package/build/muscles/secondary/muscle-8.svg +72 -0
- package/build/muscles/secondary/muscle-9.svg +72 -0
- package/build/robots.txt +3 -0
- package/index.html +59 -0
- package/package.json +125 -0
- package/src/.sass-cache/166f82406a0edab65b7f8fd8256819ee2f34bebf/App.module.scssc +0 -0
- package/src/@types/i18next.d.ts +13 -0
- package/src/App.tsx +25 -0
- package/src/assets/images/discord-logo.svg +1 -0
- package/src/assets/images/get-it-on-google-play.svg +1 -0
- package/src/assets/images/logo.png +0 -0
- package/src/assets/images/twitter-logo-50.png +0 -0
- package/src/assets/images/twitter.svg +5 -0
- package/src/components/BodyWeight/Form/WeightForm.test.tsx +100 -0
- package/src/components/BodyWeight/Form/WeightForm.tsx +102 -0
- package/src/components/BodyWeight/Table/ActionButton/ActionButton.test.tsx +65 -0
- package/src/components/BodyWeight/Table/ActionButton/ActionButton.tsx +67 -0
- package/src/components/BodyWeight/Table/Fab/Fab.tsx +35 -0
- package/src/components/BodyWeight/Table/index.test.tsx +33 -0
- package/src/components/BodyWeight/Table/index.tsx +98 -0
- package/src/components/BodyWeight/Table/table.module.css +5 -0
- package/src/components/BodyWeight/Table/table.module.css.map +1 -0
- package/src/components/BodyWeight/Table/table.module.scss +0 -0
- package/src/components/BodyWeight/Table/table.mosule.css +2 -0
- package/src/components/BodyWeight/Table/table.mosule.css.map +1 -0
- package/src/components/BodyWeight/TableDashboard/TableDashboard.test.tsx +24 -0
- package/src/components/BodyWeight/TableDashboard/TableDashboard.tsx +62 -0
- package/src/components/BodyWeight/WeightChart/index.test.tsx +66 -0
- package/src/components/BodyWeight/WeightChart/index.tsx +105 -0
- package/src/components/BodyWeight/body_weight.module.css +8 -0
- package/src/components/BodyWeight/body_weight.module.css.map +1 -0
- package/src/components/BodyWeight/body_weight.module.scss +8 -0
- package/src/components/BodyWeight/index.test.tsx +92 -0
- package/src/components/BodyWeight/index.tsx +40 -0
- package/src/components/BodyWeight/model.ts +40 -0
- package/src/components/BodyWeight/queries/index.ts +49 -0
- package/src/components/BodyWeight/utils.test.ts +44 -0
- package/src/components/BodyWeight/utils.ts +22 -0
- package/src/components/BodyWeight/widgets/FilterButtons.test.tsx +57 -0
- package/src/components/BodyWeight/widgets/FilterButtons.tsx +69 -0
- package/src/components/BodyWeight/widgets/fab.tsx +33 -0
- package/src/components/Calendar/Components/CalendarComponent.test.tsx +141 -0
- package/src/components/Calendar/Components/CalendarComponent.tsx +250 -0
- package/src/components/Calendar/Components/CalendarDay.tsx +105 -0
- package/src/components/Calendar/Components/CalendarDayGrid.tsx +53 -0
- package/src/components/Calendar/Components/CalendarHeader.tsx +39 -0
- package/src/components/Calendar/Components/Entries.test.tsx +81 -0
- package/src/components/Calendar/Components/Entries.tsx +163 -0
- package/src/components/Calendar/Helpers/CalendarMeasurement.tsx +10 -0
- package/src/components/Carousel/carousel.module.css +43 -0
- package/src/components/Carousel/carousel.module.css.map +1 -0
- package/src/components/Carousel/carousel.module.scss +46 -0
- package/src/components/Carousel/index.tsx +66 -0
- package/src/components/Common/forms/LicenseAuthor.tsx +19 -0
- package/src/components/Common/forms/LicenseAuthorUrl.tsx +20 -0
- package/src/components/Common/forms/LicenseDerivativeSourceUrl.tsx +20 -0
- package/src/components/Common/forms/LicenseObjectUrl.tsx +20 -0
- package/src/components/Common/forms/LicenseTitle.tsx +19 -0
- package/src/components/Common/forms/WgerTextField.tsx +27 -0
- package/src/components/Core/LoadingWidget/LoadingWidget.tsx +22 -0
- package/src/components/Core/Modals/DeleteConfirmationModal.test.tsx +57 -0
- package/src/components/Core/Modals/DeleteConfirmationModal.tsx +74 -0
- package/src/components/Core/Modals/WgerModal.test.tsx +45 -0
- package/src/components/Core/Modals/WgerModal.tsx +46 -0
- package/src/components/Core/Notifications/index.tsx +57 -0
- package/src/components/Core/Notifications/notifications.module.css +8 -0
- package/src/components/Core/Notifications/notifications.module.css.map +1 -0
- package/src/components/Core/Notifications/notifications.module.scss +6 -0
- package/src/components/Core/Tooltips/LightToolTip.tsx +14 -0
- package/src/components/Core/Widgets/Container.tsx +98 -0
- package/src/components/Core/Widgets/FormError.tsx +64 -0
- package/src/components/Core/Widgets/OverviewEmpty.tsx +26 -0
- package/src/components/Core/Widgets/RenderLoadingQuery.tsx +28 -0
- package/src/components/Core/queries/index.ts +2 -0
- package/src/components/Core/queries/languageCheck.ts +31 -0
- package/src/components/Dashboard/Dashboard.tsx +22 -0
- package/src/components/Dashboard/EmptyCard.tsx +56 -0
- package/src/components/Dashboard/NutritionCard.test.tsx +89 -0
- package/src/components/Dashboard/NutritionCard.tsx +178 -0
- package/src/components/Dashboard/RoutineCard.test.tsx +66 -0
- package/src/components/Dashboard/RoutineCard.tsx +107 -0
- package/src/components/Dashboard/WeightCard.test.tsx +81 -0
- package/src/components/Dashboard/WeightCard.tsx +72 -0
- package/src/components/Exercises/Add/AddExerciseStepper.test.tsx +26 -0
- package/src/components/Exercises/Add/AddExerciseStepper.tsx +97 -0
- package/src/components/Exercises/Add/NotEnoughRights.tsx +37 -0
- package/src/components/Exercises/Add/Step1Basics.test.tsx +133 -0
- package/src/components/Exercises/Add/Step1Basics.tsx +179 -0
- package/src/components/Exercises/Add/Step2Variations.test.tsx +149 -0
- package/src/components/Exercises/Add/Step2Variations.tsx +237 -0
- package/src/components/Exercises/Add/Step3Description.test.tsx +66 -0
- package/src/components/Exercises/Add/Step3Description.tsx +96 -0
- package/src/components/Exercises/Add/Step4Translation.test.tsx +119 -0
- package/src/components/Exercises/Add/Step4Translations.tsx +183 -0
- package/src/components/Exercises/Add/Step5Images.test.tsx +28 -0
- package/src/components/Exercises/Add/Step5Images.tsx +269 -0
- package/src/components/Exercises/Add/Step6Overview.test.tsx +128 -0
- package/src/components/Exercises/Add/Step6Overview.tsx +262 -0
- package/src/components/Exercises/Detail/ExerciseDetailEdit.test.tsx +248 -0
- package/src/components/Exercises/Detail/ExerciseDetailEdit.tsx +340 -0
- package/src/components/Exercises/Detail/ExerciseDetailView.test.tsx +96 -0
- package/src/components/Exercises/Detail/ExerciseDetailView.tsx +242 -0
- package/src/components/Exercises/Detail/ExerciseDetails.test.tsx +88 -0
- package/src/components/Exercises/Detail/ExerciseDetails.tsx +119 -0
- package/src/components/Exercises/Detail/ExerciseImageAvatar.tsx +20 -0
- package/src/components/Exercises/Detail/ExerciseImagePlaceholder.tsx +21 -0
- package/src/components/Exercises/Detail/Head/ExerciseDeleteDialog.test.tsx +125 -0
- package/src/components/Exercises/Detail/Head/ExerciseDeleteDialog.tsx +185 -0
- package/src/components/Exercises/Detail/Head/head.module.css +73 -0
- package/src/components/Exercises/Detail/Head/head.module.css.map +7 -0
- package/src/components/Exercises/Detail/Head/head.module.scss +111 -0
- package/src/components/Exercises/Detail/Head/index.tsx +175 -0
- package/src/components/Exercises/Detail/OverviewCard.test.tsx +98 -0
- package/src/components/Exercises/Detail/OverviewCard.tsx +68 -0
- package/src/components/Exercises/Detail/SideGallery/index.tsx +65 -0
- package/src/components/Exercises/Detail/SideGallery/side_gallery.module.css +26 -0
- package/src/components/Exercises/Detail/SideGallery/side_gallery.module.css.map +7 -0
- package/src/components/Exercises/Detail/SideGallery/side_gallery.module.scss +34 -0
- package/src/components/Exercises/ExerciseOverview.test.tsx +183 -0
- package/src/components/Exercises/ExerciseOverview.tsx +293 -0
- package/src/components/Exercises/Filter/CategoryFilter.test.tsx +57 -0
- package/src/components/Exercises/Filter/CategoryFilter.tsx +105 -0
- package/src/components/Exercises/Filter/EquipmentFilter.test.tsx +55 -0
- package/src/components/Exercises/Filter/EquipmentFilter.tsx +105 -0
- package/src/components/Exercises/Filter/ExerciseFiltersContext.tsx +16 -0
- package/src/components/Exercises/Filter/FilterDrawer.tsx +38 -0
- package/src/components/Exercises/Filter/MuscleFilter.test.tsx +50 -0
- package/src/components/Exercises/Filter/MuscleFilter.tsx +130 -0
- package/src/components/Exercises/Filter/NameAutcompleter.tsx +146 -0
- package/src/components/Exercises/Filter/NameAutocompleter.test.tsx +76 -0
- package/src/components/Exercises/Overview/ExerciseGrid.tsx +44 -0
- package/src/components/Exercises/Overview/ExerciseGridLoadingSkeleton.test.tsx +10 -0
- package/src/components/Exercises/Overview/ExerciseGridLoadingSkeleton.tsx +26 -0
- package/src/components/Exercises/forms/Category.test.tsx +49 -0
- package/src/components/Exercises/forms/Category.tsx +41 -0
- package/src/components/Exercises/forms/Equipment.test.tsx +84 -0
- package/src/components/Exercises/forms/Equipment.tsx +38 -0
- package/src/components/Exercises/forms/ExerciseAliases.tsx +37 -0
- package/src/components/Exercises/forms/ExerciseDescription.tsx +57 -0
- package/src/components/Exercises/forms/ExerciseEquipmentSelect.tsx +29 -0
- package/src/components/Exercises/forms/ExerciseName.tsx +19 -0
- package/src/components/Exercises/forms/ExerciseNotes.tsx +72 -0
- package/src/components/Exercises/forms/ExerciseSelect.tsx +28 -0
- package/src/components/Exercises/forms/ImageCard.tsx +101 -0
- package/src/components/Exercises/forms/ImageStyle.tsx +74 -0
- package/src/components/Exercises/forms/Muscle.test.tsx +74 -0
- package/src/components/Exercises/forms/Muscle.tsx +41 -0
- package/src/components/Exercises/forms/VideoCard.tsx +109 -0
- package/src/components/Exercises/forms/yupValidators.ts +46 -0
- package/src/components/Exercises/models/alias.ts +29 -0
- package/src/components/Exercises/models/category.ts +35 -0
- package/src/components/Exercises/models/equipment.ts +33 -0
- package/src/components/Exercises/models/exercise.test.ts +74 -0
- package/src/components/Exercises/models/exercise.ts +159 -0
- package/src/components/Exercises/models/image.ts +41 -0
- package/src/components/Exercises/models/language.ts +23 -0
- package/src/components/Exercises/models/muscle.test.ts +17 -0
- package/src/components/Exercises/models/muscle.ts +39 -0
- package/src/components/Exercises/models/note.ts +29 -0
- package/src/components/Exercises/models/translation.test.ts +68 -0
- package/src/components/Exercises/models/translation.ts +83 -0
- package/src/components/Exercises/models/video.ts +30 -0
- package/src/components/Exercises/queries/exercises.ts +29 -0
- package/src/components/Exercises/queries/index.ts +133 -0
- package/src/components/Exercises/queries/variations.ts +15 -0
- package/src/components/Header/SubMenus/BodyWeightSubMenu.tsx +27 -0
- package/src/components/Header/SubMenus/MeasurementsSubMenu.tsx +28 -0
- package/src/components/Header/SubMenus/NutritionSubMenu.tsx +28 -0
- package/src/components/Header/SubMenus/TrainingSubMenu.tsx +43 -0
- package/src/components/Header/SubMenus/WorkoutSubMenu.tsx +28 -0
- package/src/components/Header/index.tsx +27 -0
- package/src/components/Measurements/Screens/MeasurementCategoryDetail.test.tsx +67 -0
- package/src/components/Measurements/Screens/MeasurementCategoryDetail.tsx +37 -0
- package/src/components/Measurements/Screens/MeasurementCategoryOverview.test.tsx +59 -0
- package/src/components/Measurements/Screens/MeasurementCategoryOverview.tsx +64 -0
- package/src/components/Measurements/models/Category.ts +38 -0
- package/src/components/Measurements/models/Entry.ts +37 -0
- package/src/components/Measurements/queries/index.ts +121 -0
- package/src/components/Measurements/widgets/CategoryDetailDataGrid.tsx +209 -0
- package/src/components/Measurements/widgets/CategoryDetailDropdown.tsx +83 -0
- package/src/components/Measurements/widgets/CategoryForm.test.tsx +96 -0
- package/src/components/Measurements/widgets/CategoryForm.tsx +88 -0
- package/src/components/Measurements/widgets/EntryForm.test.tsx +120 -0
- package/src/components/Measurements/widgets/EntryForm.tsx +139 -0
- package/src/components/Measurements/widgets/MeasurementChart.tsx +52 -0
- package/src/components/Measurements/widgets/fab.tsx +65 -0
- package/src/components/Muscles/MuscleOverview.tsx +37 -0
- package/src/components/Nutrition/components/BmiCalculator.test.tsx +55 -0
- package/src/components/Nutrition/components/BmiCalculator.tsx +203 -0
- package/src/components/Nutrition/components/IngredientSearch.tsx +24 -0
- package/src/components/Nutrition/components/NutritionDiaryOverview.test.tsx +51 -0
- package/src/components/Nutrition/components/NutritionDiaryOverview.tsx +47 -0
- package/src/components/Nutrition/components/PlanDetail.test.tsx +58 -0
- package/src/components/Nutrition/components/PlanDetail.tsx +100 -0
- package/src/components/Nutrition/components/PlanOverview.test.tsx +37 -0
- package/src/components/Nutrition/components/PlansOverview.tsx +62 -0
- package/src/components/Nutrition/helpers/nutritionalValues.test.ts +108 -0
- package/src/components/Nutrition/helpers/nutritionalValues.ts +128 -0
- package/src/components/Nutrition/models/Ingredient.ts +84 -0
- package/src/components/Nutrition/models/IngredientImage.ts +57 -0
- package/src/components/Nutrition/models/IngredientImageThumbnails.ts +59 -0
- package/src/components/Nutrition/models/diaryEntry.ts +129 -0
- package/src/components/Nutrition/models/ingredient.test.ts +37 -0
- package/src/components/Nutrition/models/meal.test.ts +54 -0
- package/src/components/Nutrition/models/meal.ts +128 -0
- package/src/components/Nutrition/models/mealItem.test.ts +23 -0
- package/src/components/Nutrition/models/mealItem.ts +134 -0
- package/src/components/Nutrition/models/nutritionalPlan.test.ts +169 -0
- package/src/components/Nutrition/models/nutritionalPlan.ts +268 -0
- package/src/components/Nutrition/models/weightUnit.ts +24 -0
- package/src/components/Nutrition/queries/diary.ts +59 -0
- package/src/components/Nutrition/queries/index.ts +20 -0
- package/src/components/Nutrition/queries/ingredient.ts +12 -0
- package/src/components/Nutrition/queries/meal.ts +41 -0
- package/src/components/Nutrition/queries/mealItem.ts +43 -0
- package/src/components/Nutrition/queries/plan.ts +93 -0
- package/src/components/Nutrition/widgets/DiaryDetail.tsx +39 -0
- package/src/components/Nutrition/widgets/DiaryOverview.tsx +51 -0
- package/src/components/Nutrition/widgets/Fab.tsx +65 -0
- package/src/components/Nutrition/widgets/IngredientAutcompleter.tsx +140 -0
- package/src/components/Nutrition/widgets/IngredientAutocompleter.test.tsx +60 -0
- package/src/components/Nutrition/widgets/IngredientDetailTable.tsx +91 -0
- package/src/components/Nutrition/widgets/LoggedPlannedNutritionalValuesTable.tsx +138 -0
- package/src/components/Nutrition/widgets/MealDetail.tsx +170 -0
- package/src/components/Nutrition/widgets/MealDetailDropdown.tsx +117 -0
- package/src/components/Nutrition/widgets/NutritionalValuesTable.tsx +103 -0
- package/src/components/Nutrition/widgets/PlanDetailDropdown.tsx +82 -0
- package/src/components/Nutrition/widgets/PlanSidebar.tsx +44 -0
- package/src/components/Nutrition/widgets/charts/LinearPlannedLoggedChart.tsx +27 -0
- package/src/components/Nutrition/widgets/charts/MacrosPieChart.tsx +66 -0
- package/src/components/Nutrition/widgets/charts/NutritionDiaryChart.tsx +95 -0
- package/src/components/Nutrition/widgets/charts/NutritionalValuesDashboardChart.tsx +84 -0
- package/src/components/Nutrition/widgets/charts/NutritionalValuesPlannedLoggedChart.tsx +54 -0
- package/src/components/Nutrition/widgets/forms/MealForm.test.tsx +85 -0
- package/src/components/Nutrition/widgets/forms/MealForm.tsx +105 -0
- package/src/components/Nutrition/widgets/forms/MealItemForm.test.tsx +106 -0
- package/src/components/Nutrition/widgets/forms/MealItemForm.tsx +118 -0
- package/src/components/Nutrition/widgets/forms/NutritionDiaryEntryForm.test.tsx +165 -0
- package/src/components/Nutrition/widgets/forms/NutritionDiaryEntryForm.tsx +161 -0
- package/src/components/Nutrition/widgets/forms/PlanForm.test.tsx +101 -0
- package/src/components/Nutrition/widgets/forms/PlanForm.tsx +361 -0
- package/src/components/User/models/profile.ts +81 -0
- package/src/components/User/queries/contribute.test.ts +132 -0
- package/src/components/User/queries/contribute.ts +33 -0
- package/src/components/User/queries/permission.ts +11 -0
- package/src/components/User/queries/profile.ts +22 -0
- package/src/components/WorkoutRoutines/Detail/RoutineAdd.tsx +12 -0
- package/src/components/WorkoutRoutines/Detail/RoutineDetail.test.tsx +71 -0
- package/src/components/WorkoutRoutines/Detail/RoutineDetail.tsx +87 -0
- package/src/components/WorkoutRoutines/Detail/RoutineDetailsTable.test.tsx +83 -0
- package/src/components/WorkoutRoutines/Detail/RoutineDetailsTable.tsx +371 -0
- package/src/components/WorkoutRoutines/Detail/RoutineEdit.test.tsx +51 -0
- package/src/components/WorkoutRoutines/Detail/RoutineEdit.tsx +95 -0
- package/src/components/WorkoutRoutines/Detail/SessionAdd.test.tsx +43 -0
- package/src/components/WorkoutRoutines/Detail/SessionAdd.tsx +50 -0
- package/src/components/WorkoutRoutines/Detail/SlotProgressionEdit.test.tsx +41 -0
- package/src/components/WorkoutRoutines/Detail/SlotProgressionEdit.tsx +145 -0
- package/src/components/WorkoutRoutines/Detail/TemplateDetail.test.tsx +44 -0
- package/src/components/WorkoutRoutines/Detail/TemplateDetail.tsx +84 -0
- package/src/components/WorkoutRoutines/Detail/WorkoutLogs.test.tsx +64 -0
- package/src/components/WorkoutRoutines/Detail/WorkoutLogs.tsx +98 -0
- package/src/components/WorkoutRoutines/Detail/WorkoutStats.test.tsx +65 -0
- package/src/components/WorkoutRoutines/Detail/WorkoutStats.tsx +244 -0
- package/src/components/WorkoutRoutines/Overview/Fab.tsx +91 -0
- package/src/components/WorkoutRoutines/Overview/PrivateTemplateOverview.test.tsx +36 -0
- package/src/components/WorkoutRoutines/Overview/PrivateTemplateOverview.tsx +41 -0
- package/src/components/WorkoutRoutines/Overview/PublicTemplateOverview.test.tsx +36 -0
- package/src/components/WorkoutRoutines/Overview/PublicTemplateOverview.tsx +40 -0
- package/src/components/WorkoutRoutines/Overview/RoutineOverview.test.tsx +38 -0
- package/src/components/WorkoutRoutines/Overview/RoutineOverview.tsx +76 -0
- package/src/components/WorkoutRoutines/models/BaseConfig.ts +118 -0
- package/src/components/WorkoutRoutines/models/Day.test.ts +15 -0
- package/src/components/WorkoutRoutines/models/Day.ts +117 -0
- package/src/components/WorkoutRoutines/models/LogStats.test.ts +44 -0
- package/src/components/WorkoutRoutines/models/LogStats.ts +110 -0
- package/src/components/WorkoutRoutines/models/RepetitionUnit.ts +22 -0
- package/src/components/WorkoutRoutines/models/Routine.test.ts +113 -0
- package/src/components/WorkoutRoutines/models/Routine.ts +218 -0
- package/src/components/WorkoutRoutines/models/RoutineDayData.ts +38 -0
- package/src/components/WorkoutRoutines/models/RoutineLogData.ts +22 -0
- package/src/components/WorkoutRoutines/models/SetConfigData.ts +121 -0
- package/src/components/WorkoutRoutines/models/Slot.test.ts +19 -0
- package/src/components/WorkoutRoutines/models/Slot.ts +83 -0
- package/src/components/WorkoutRoutines/models/SlotData.ts +30 -0
- package/src/components/WorkoutRoutines/models/SlotEntry.test.ts +31 -0
- package/src/components/WorkoutRoutines/models/SlotEntry.ts +245 -0
- package/src/components/WorkoutRoutines/models/WeightUnit.ts +22 -0
- package/src/components/WorkoutRoutines/models/WorkoutLog.ts +159 -0
- package/src/components/WorkoutRoutines/models/WorkoutSession.ts +124 -0
- package/src/components/WorkoutRoutines/queries/configs.ts +393 -0
- package/src/components/WorkoutRoutines/queries/days.ts +42 -0
- package/src/components/WorkoutRoutines/queries/index.ts +64 -0
- package/src/components/WorkoutRoutines/queries/logs.ts +49 -0
- package/src/components/WorkoutRoutines/queries/routines.ts +121 -0
- package/src/components/WorkoutRoutines/queries/sessions.ts +41 -0
- package/src/components/WorkoutRoutines/queries/slot_entries.ts +33 -0
- package/src/components/WorkoutRoutines/queries/slots.ts +40 -0
- package/src/components/WorkoutRoutines/queries/units.ts +15 -0
- package/src/components/WorkoutRoutines/widgets/DayDetails.test.tsx +69 -0
- package/src/components/WorkoutRoutines/widgets/DayDetails.tsx +441 -0
- package/src/components/WorkoutRoutines/widgets/LogWidgets.test.tsx +91 -0
- package/src/components/WorkoutRoutines/widgets/LogWidgets.tsx +334 -0
- package/src/components/WorkoutRoutines/widgets/RoutineDetailDropdown.test.tsx +36 -0
- package/src/components/WorkoutRoutines/widgets/RoutineDetailDropdown.tsx +184 -0
- package/src/components/WorkoutRoutines/widgets/RoutineDetailsCard.test.tsx +42 -0
- package/src/components/WorkoutRoutines/widgets/RoutineDetailsCard.tsx +202 -0
- package/src/components/WorkoutRoutines/widgets/RoutineStatistics.test.tsx +364 -0
- package/src/components/WorkoutRoutines/widgets/RoutineStatistics.tsx +249 -0
- package/src/components/WorkoutRoutines/widgets/SlotDetails.test.tsx +72 -0
- package/src/components/WorkoutRoutines/widgets/SlotDetails.tsx +233 -0
- package/src/components/WorkoutRoutines/widgets/forms/BaseConfigForm.test.tsx +161 -0
- package/src/components/WorkoutRoutines/widgets/forms/BaseConfigForm.tsx +508 -0
- package/src/components/WorkoutRoutines/widgets/forms/DayForm.test.tsx +86 -0
- package/src/components/WorkoutRoutines/widgets/forms/DayForm.tsx +202 -0
- package/src/components/WorkoutRoutines/widgets/forms/ProgressionForm.test.tsx +176 -0
- package/src/components/WorkoutRoutines/widgets/forms/ProgressionForm.tsx +494 -0
- package/src/components/WorkoutRoutines/widgets/forms/RoutineForm.test.tsx +94 -0
- package/src/components/WorkoutRoutines/widgets/forms/RoutineForm.tsx +309 -0
- package/src/components/WorkoutRoutines/widgets/forms/RoutineTemplateForm.test.tsx +70 -0
- package/src/components/WorkoutRoutines/widgets/forms/RoutineTemplateForm.tsx +68 -0
- package/src/components/WorkoutRoutines/widgets/forms/SessionForm.test.tsx +164 -0
- package/src/components/WorkoutRoutines/widgets/forms/SessionForm.tsx +263 -0
- package/src/components/WorkoutRoutines/widgets/forms/SessionLogsForm.test.tsx +126 -0
- package/src/components/WorkoutRoutines/widgets/forms/SessionLogsForm.tsx +330 -0
- package/src/components/WorkoutRoutines/widgets/forms/SlotEntryForm.test.tsx +227 -0
- package/src/components/WorkoutRoutines/widgets/forms/SlotEntryForm.tsx +206 -0
- package/src/components/WorkoutRoutines/widgets/forms/SlotForm.test.tsx +44 -0
- package/src/components/WorkoutRoutines/widgets/forms/SlotForm.tsx +36 -0
- package/src/components/index.ts +3 -0
- package/src/config.ts +12 -0
- package/src/i18n.ts +63 -0
- package/src/i18n.tsx +52 -0
- package/src/index.css +13 -0
- package/src/index.tsx +184 -0
- package/src/locales/README.md +7 -0
- package/src/pages/About/index.tsx +9 -0
- package/src/pages/AddExercise/index.tsx +15 -0
- package/src/pages/AddWeight/index.tsx +9 -0
- package/src/pages/ApiPage/index.tsx +9 -0
- package/src/pages/Calendar/index.tsx +10 -0
- package/src/pages/CaloriesCalculator/index.tsx +9 -0
- package/src/pages/Equipments/index.tsx +9 -0
- package/src/pages/ExerciseDetails/index.tsx +6 -0
- package/src/pages/Ingrdedients/index.tsx +9 -0
- package/src/pages/Login/index.tsx +9 -0
- package/src/pages/Preferences/index.tsx +9 -0
- package/src/pages/PublicTemplate/index.tsx +9 -0
- package/src/pages/TemplatePage/index.tsx +9 -0
- package/src/pages/WeightOverview/index.tsx +6 -0
- package/src/pages/index.ts +14 -0
- package/src/permissions/index.ts +13 -0
- package/src/reportWebVitals.ts +15 -0
- package/src/routes.tsx +137 -0
- package/src/services/alias.test.ts +47 -0
- package/src/services/alias.ts +34 -0
- package/src/services/base_config.test.ts +48 -0
- package/src/services/base_config.ts +86 -0
- package/src/services/category.test.ts +44 -0
- package/src/services/category.ts +21 -0
- package/src/services/config.test.ts +213 -0
- package/src/services/config.ts +50 -0
- package/src/services/day.test.ts +118 -0
- package/src/services/day.ts +44 -0
- package/src/services/equipment.test.ts +46 -0
- package/src/services/equipment.ts +20 -0
- package/src/services/exercise.test.ts +98 -0
- package/src/services/exercise.ts +182 -0
- package/src/services/exerciseTranslation.test.ts +98 -0
- package/src/services/exerciseTranslation.ts +112 -0
- package/src/services/image.test.ts +77 -0
- package/src/services/image.ts +54 -0
- package/src/services/index.ts +104 -0
- package/src/services/ingredient.test.ts +81 -0
- package/src/services/ingredient.ts +70 -0
- package/src/services/ingredientweightunit.ts +29 -0
- package/src/services/language.test.ts +86 -0
- package/src/services/language.ts +35 -0
- package/src/services/languageCheck.ts +33 -0
- package/src/services/meal.ts +67 -0
- package/src/services/mealItem.ts +32 -0
- package/src/services/measurements.test.ts +106 -0
- package/src/services/measurements.ts +173 -0
- package/src/services/muscles.test.ts +46 -0
- package/src/services/muscles.ts +20 -0
- package/src/services/note.ts +39 -0
- package/src/services/nutritionalDiary.test.ts +35 -0
- package/src/services/nutritionalDiary.ts +70 -0
- package/src/services/nutritionalPlan.test.ts +74 -0
- package/src/services/nutritionalPlan.ts +104 -0
- package/src/services/permission.ts +26 -0
- package/src/services/permissions.test.ts +34 -0
- package/src/services/profile.test.ts +40 -0
- package/src/services/profile.ts +49 -0
- package/src/services/responseType.ts +35 -0
- package/src/services/routine.test.ts +195 -0
- package/src/services/routine.ts +250 -0
- package/src/services/session.test.ts +157 -0
- package/src/services/session.ts +99 -0
- package/src/services/slot.test.ts +68 -0
- package/src/services/slot.ts +43 -0
- package/src/services/slot_entry.ts +43 -0
- package/src/services/variation.test.ts +24 -0
- package/src/services/variation.ts +18 -0
- package/src/services/video.test.ts +65 -0
- package/src/services/video.ts +47 -0
- package/src/services/weight.test.ts +75 -0
- package/src/services/weight.ts +58 -0
- package/src/services/workoutLogs.test.ts +148 -0
- package/src/services/workoutLogs.ts +89 -0
- package/src/services/workoutUnits.ts +29 -0
- package/src/setupTests.ts +40 -0
- package/src/state/exerciseSubmissionReducer.ts +170 -0
- package/src/state/exerciseSubmissionState.tsx +75 -0
- package/src/state/index.ts +15 -0
- package/src/state/notificationReducer.ts +29 -0
- package/src/state/notificationState.tsx +32 -0
- package/src/state/stateTypes.ts +24 -0
- package/src/tests/api/ingredientInfoEndpoint.ts +72 -0
- package/src/tests/exerciseTestdata.ts +159 -0
- package/src/tests/exercises/searchResponse.ts +23 -0
- package/src/tests/ingredientTestdata.ts +76 -0
- package/src/tests/measurementsTestData.ts +40 -0
- package/src/tests/nutritionDiaryTestdata.ts +167 -0
- package/src/tests/nutritionTestdata.ts +200 -0
- package/src/tests/queryClient/index.ts +7 -0
- package/src/tests/responseApi.ts +197 -0
- package/src/tests/setup.ts +10 -0
- package/src/tests/slotEntryApiResponse.ts +144 -0
- package/src/tests/userTestdata.ts +43 -0
- package/src/tests/weight/testData.ts +7 -0
- package/src/tests/workoutLogsRoutinesTestData.ts +90 -0
- package/src/tests/workoutRoutinesTestData.ts +451 -0
- package/src/tests/workoutStatisticsTestData.ts +219 -0
- package/src/theme.ts +73 -0
- package/src/types.ts +144 -0
- package/src/utils/Adapter.ts +10 -0
- package/src/utils/colors.test.ts +38 -0
- package/src/utils/colors.ts +17 -0
- package/src/utils/consts.ts +160 -0
- package/src/utils/date.test.ts +56 -0
- package/src/utils/date.ts +145 -0
- package/src/utils/forms.test.ts +41 -0
- package/src/utils/forms.ts +54 -0
- package/src/utils/numbers.test.ts +55 -0
- package/src/utils/numbers.ts +42 -0
- package/src/utils/requests.test.ts +61 -0
- package/src/utils/requests.ts +22 -0
- package/src/utils/strings.test.ts +62 -0
- package/src/utils/strings.ts +28 -0
- package/src/utils/url.test.ts +127 -0
- package/src/utils/url.ts +237 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import { Addchart } from "@mui/icons-material";
|
|
2
|
+
import TodayIcon from '@mui/icons-material/Today';
|
|
3
|
+
import {
|
|
4
|
+
Box,
|
|
5
|
+
Card,
|
|
6
|
+
CardContent,
|
|
7
|
+
CardHeader,
|
|
8
|
+
Chip,
|
|
9
|
+
Container,
|
|
10
|
+
Divider,
|
|
11
|
+
IconButton,
|
|
12
|
+
Stack,
|
|
13
|
+
Typography,
|
|
14
|
+
useTheme
|
|
15
|
+
} from "@mui/material";
|
|
16
|
+
import Grid from '@mui/material/Grid';
|
|
17
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
18
|
+
import { RenderLoadingQuery } from "components/Core/Widgets/RenderLoadingQuery";
|
|
19
|
+
import { ExerciseImageAvatar } from "components/Exercises/Detail/ExerciseImageAvatar";
|
|
20
|
+
import { Language } from "components/Exercises/models/language";
|
|
21
|
+
import { useLanguageQuery } from "components/Exercises/queries";
|
|
22
|
+
import { getDayName } from "components/WorkoutRoutines/models/Day";
|
|
23
|
+
import { RoutineDayData } from "components/WorkoutRoutines/models/RoutineDayData";
|
|
24
|
+
import { SetConfigData } from "components/WorkoutRoutines/models/SetConfigData";
|
|
25
|
+
import { SlotData } from "components/WorkoutRoutines/models/SlotData";
|
|
26
|
+
import { useRoutineDetailQuery } from "components/WorkoutRoutines/queries";
|
|
27
|
+
import React from "react";
|
|
28
|
+
import { useTranslation } from "react-i18next";
|
|
29
|
+
import { useParams } from "react-router-dom";
|
|
30
|
+
import { getLanguageByShortName } from "services";
|
|
31
|
+
import { isSameDay } from "utils/date";
|
|
32
|
+
import { makeLink, WgerLink } from "utils/url";
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export const RoutineDetailsCard = () => {
|
|
36
|
+
|
|
37
|
+
const params = useParams<{ routineId: string }>();
|
|
38
|
+
const routineId = parseInt(params.routineId ?? '');
|
|
39
|
+
if (Number.isNaN(routineId)) {
|
|
40
|
+
return <p>Please pass an integer as the routine id.</p>;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
44
|
+
const routineQuery = useRoutineDetailQuery(routineId);
|
|
45
|
+
|
|
46
|
+
return <Container maxWidth="lg">
|
|
47
|
+
<RenderLoadingQuery
|
|
48
|
+
query={routineQuery}
|
|
49
|
+
child={routineQuery.isSuccess && <>
|
|
50
|
+
{routineQuery.data?.description !== ''
|
|
51
|
+
&& <Typography variant={"body2"} sx={{ whiteSpace: 'pre-line' }}>
|
|
52
|
+
{routineQuery.data?.description}
|
|
53
|
+
</Typography>
|
|
54
|
+
}
|
|
55
|
+
<Stack spacing={2} sx={{ mt: 2 }}>
|
|
56
|
+
{routineQuery.data!.dayDataCurrentIteration.filter((dayData) => dayData.day !== null).map((dayData, index) =>
|
|
57
|
+
<DayDetailsCard routineId={routineId} dayData={dayData} key={`dayDetails-${index}`} />
|
|
58
|
+
)}
|
|
59
|
+
</Stack>
|
|
60
|
+
</>}
|
|
61
|
+
/>
|
|
62
|
+
</Container>;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
export function SetConfigDataDetails(props: {
|
|
67
|
+
setConfigData: SetConfigData,
|
|
68
|
+
rowHeight?: undefined | string,
|
|
69
|
+
marginBottom?: undefined | string,
|
|
70
|
+
showExercise: boolean,
|
|
71
|
+
}) {
|
|
72
|
+
|
|
73
|
+
const { i18n } = useTranslation();
|
|
74
|
+
const languageQuery = useLanguageQuery();
|
|
75
|
+
|
|
76
|
+
let language: Language | undefined = undefined;
|
|
77
|
+
if (languageQuery.isSuccess) {
|
|
78
|
+
language = getLanguageByShortName(
|
|
79
|
+
i18n.language,
|
|
80
|
+
languageQuery.data!
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<Grid container
|
|
86
|
+
alignItems="center"
|
|
87
|
+
justifyContent={"center"}
|
|
88
|
+
sx={{ height: props.rowHeight, marginBottom: props.marginBottom }}>
|
|
89
|
+
<Grid size={12}>
|
|
90
|
+
<Stack spacing={0}>
|
|
91
|
+
<Typography variant={"h6"}>
|
|
92
|
+
{props.showExercise ? props.setConfigData.exercise?.getTranslation(language).name : ''}
|
|
93
|
+
</Typography>
|
|
94
|
+
<div>
|
|
95
|
+
{props.setConfigData.textRepr}
|
|
96
|
+
{props.setConfigData.isSpecialType &&
|
|
97
|
+
<Chip
|
|
98
|
+
label={props.setConfigData.type}
|
|
99
|
+
color="info"
|
|
100
|
+
size="small"
|
|
101
|
+
sx={{ marginLeft: "0.5em" }} />
|
|
102
|
+
}
|
|
103
|
+
</div>
|
|
104
|
+
<Typography variant={"caption"}>
|
|
105
|
+
{props.setConfigData.comment}
|
|
106
|
+
</Typography>
|
|
107
|
+
</Stack>
|
|
108
|
+
</Grid>
|
|
109
|
+
</Grid>
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
function SlotDataList(props: {
|
|
115
|
+
slotData: SlotData,
|
|
116
|
+
index: number,
|
|
117
|
+
}) {
|
|
118
|
+
return (
|
|
119
|
+
<Grid
|
|
120
|
+
container
|
|
121
|
+
alignItems="flex-start"
|
|
122
|
+
columnGap={1}
|
|
123
|
+
wrap="nowrap"
|
|
124
|
+
>
|
|
125
|
+
<Grid
|
|
126
|
+
sx={{
|
|
127
|
+
flex: '0 0 50px',
|
|
128
|
+
}}
|
|
129
|
+
>
|
|
130
|
+
<Stack divider={<Box height="10px" />}>
|
|
131
|
+
{props.slotData.exercises.map((exercise, index) =>
|
|
132
|
+
<ExerciseImageAvatar
|
|
133
|
+
image={exercise.mainImage}
|
|
134
|
+
iconSize={40}
|
|
135
|
+
avatarSize={50}
|
|
136
|
+
key={index}
|
|
137
|
+
/>
|
|
138
|
+
)}
|
|
139
|
+
</Stack>
|
|
140
|
+
</Grid>
|
|
141
|
+
|
|
142
|
+
<Grid
|
|
143
|
+
sx={{ flex: '1 1 auto', minWidth: 0 }}
|
|
144
|
+
>
|
|
145
|
+
{props.slotData.setConfigs.map((setConfig, index) => {
|
|
146
|
+
const showExercise = index === 0 || setConfig.exerciseId !== props.slotData.setConfigs[index - 1]?.exerciseId;
|
|
147
|
+
return <SetConfigDataDetails
|
|
148
|
+
setConfigData={setConfig}
|
|
149
|
+
marginBottom="1em"
|
|
150
|
+
key={index}
|
|
151
|
+
showExercise={showExercise}
|
|
152
|
+
/>;
|
|
153
|
+
})}
|
|
154
|
+
</Grid>
|
|
155
|
+
</Grid>
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
export const DayDetailsCard = (props: { dayData: RoutineDayData, routineId: number, readOnly?: boolean }) => {
|
|
161
|
+
const readOnly = (props.readOnly ?? false) || props.dayData.day === null || props.dayData.day.isRest;
|
|
162
|
+
|
|
163
|
+
const theme = useTheme();
|
|
164
|
+
const [t, i18n] = useTranslation();
|
|
165
|
+
|
|
166
|
+
return (
|
|
167
|
+
<Card sx={{ minWidth: 275 }}>
|
|
168
|
+
<CardHeader
|
|
169
|
+
sx={{ bgcolor: theme.palette.grey.A200 }}
|
|
170
|
+
action={props.dayData.day === null || props.dayData.day.isRest || readOnly
|
|
171
|
+
? null
|
|
172
|
+
: <Tooltip title={t('routines.addWeightLog')}>
|
|
173
|
+
<IconButton
|
|
174
|
+
href={makeLink(WgerLink.ROUTINE_ADD_LOG, i18n.language, {
|
|
175
|
+
id: props.routineId,
|
|
176
|
+
id2: props.dayData.day!.id!
|
|
177
|
+
})}>
|
|
178
|
+
<Addchart />
|
|
179
|
+
</IconButton>
|
|
180
|
+
</Tooltip>}
|
|
181
|
+
title={getDayName(props.dayData.day)}
|
|
182
|
+
avatar={isSameDay(props.dayData.date, new Date()) ? <TodayIcon /> : undefined}
|
|
183
|
+
subheader={<Typography sx={{ whiteSpace: 'pre-line' }}>{props.dayData.day?.description}</Typography>}
|
|
184
|
+
/>
|
|
185
|
+
{props.dayData.slots.length > 0 && <CardContent sx={{ padding: 0, marginBottom: 0 }}>
|
|
186
|
+
<Stack>
|
|
187
|
+
{props.dayData.slots.map((slotData, index) => (
|
|
188
|
+
<div key={index}>
|
|
189
|
+
<Box padding={1}>
|
|
190
|
+
<SlotDataList
|
|
191
|
+
slotData={slotData}
|
|
192
|
+
index={index}
|
|
193
|
+
/>
|
|
194
|
+
</Box>
|
|
195
|
+
<Divider />
|
|
196
|
+
</div>
|
|
197
|
+
))}
|
|
198
|
+
</Stack>
|
|
199
|
+
</CardContent>}
|
|
200
|
+
</Card>
|
|
201
|
+
);
|
|
202
|
+
};
|
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
import { Exercise } from "components/Exercises/models/exercise";
|
|
2
|
+
import { Language } from "components/Exercises/models/language";
|
|
3
|
+
import { Muscle } from "components/Exercises/models/muscle";
|
|
4
|
+
import { GroupedLogData, LogData, RoutineStatsData } from "components/WorkoutRoutines/models/LogStats";
|
|
5
|
+
import {
|
|
6
|
+
formatStatsData,
|
|
7
|
+
getFullStatsData,
|
|
8
|
+
getHumanReadableHeaders,
|
|
9
|
+
StatGroupBy,
|
|
10
|
+
StatSubType,
|
|
11
|
+
StatType
|
|
12
|
+
} from "components/WorkoutRoutines/widgets/RoutineStatistics";
|
|
13
|
+
import {
|
|
14
|
+
testExerciseBenchPress,
|
|
15
|
+
testExerciseCrunches,
|
|
16
|
+
testExerciseCurls,
|
|
17
|
+
testLanguageEnglish,
|
|
18
|
+
testMuscles
|
|
19
|
+
} from "tests/exerciseTestdata";
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
// Mock data
|
|
23
|
+
const mockExerciseList: Exercise[] = [
|
|
24
|
+
testExerciseBenchPress,
|
|
25
|
+
testExerciseCrunches,
|
|
26
|
+
testExerciseCurls,
|
|
27
|
+
];
|
|
28
|
+
|
|
29
|
+
const mockLanguage: Language = testLanguageEnglish;
|
|
30
|
+
const mockMuscleList: Muscle[] = testMuscles;
|
|
31
|
+
|
|
32
|
+
describe('Tests for the getHumanReadableHeaders helper', () => {
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
test('should return data grouped by exercises', () => {
|
|
36
|
+
const mockLogData: LogData = new LogData({
|
|
37
|
+
"exercises": { 2: 10, 4: 5 },
|
|
38
|
+
"total": 150
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const result = getHumanReadableHeaders(
|
|
42
|
+
mockExerciseList,
|
|
43
|
+
mockLanguage,
|
|
44
|
+
mockMuscleList,
|
|
45
|
+
StatGroupBy.Exercises,
|
|
46
|
+
mockLogData,
|
|
47
|
+
);
|
|
48
|
+
expect(result.headers).toEqual(["Benchpress", "Crunches"]);
|
|
49
|
+
expect(result.data).toEqual([10, 5]);
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
test('should return data grouped by muscles', () => {
|
|
53
|
+
const mockLogData: LogData = new LogData({
|
|
54
|
+
muscle: { 2: 10, 3: 15 },
|
|
55
|
+
"total": 25
|
|
56
|
+
});
|
|
57
|
+
const result = getHumanReadableHeaders(
|
|
58
|
+
mockExerciseList,
|
|
59
|
+
mockLanguage,
|
|
60
|
+
mockMuscleList,
|
|
61
|
+
StatGroupBy.Muscles,
|
|
62
|
+
mockLogData
|
|
63
|
+
);
|
|
64
|
+
expect(result.headers).toEqual(["Finger muscle", "Shoulders"]);
|
|
65
|
+
expect(result.data).toEqual([10, 15]);
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
test('should return total data', () => {
|
|
69
|
+
const mockLogData: LogData = new LogData({
|
|
70
|
+
total: 25,
|
|
71
|
+
});
|
|
72
|
+
const result = getHumanReadableHeaders(
|
|
73
|
+
mockExerciseList,
|
|
74
|
+
mockLanguage,
|
|
75
|
+
mockMuscleList,
|
|
76
|
+
StatGroupBy.Total,
|
|
77
|
+
mockLogData
|
|
78
|
+
);
|
|
79
|
+
expect(result.headers).toEqual(["total"]);
|
|
80
|
+
expect(result.data).toEqual([25]);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
test('should return empty data for unknown StatGroupBy', () => {
|
|
85
|
+
const mockLogData: LogData = new LogData({
|
|
86
|
+
exercises: { 1: 10, 2: 15 },
|
|
87
|
+
muscle: { 1: 10, 2: 15 },
|
|
88
|
+
total: 25
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const result = getHumanReadableHeaders(
|
|
92
|
+
mockExerciseList,
|
|
93
|
+
mockLanguage,
|
|
94
|
+
mockMuscleList,
|
|
95
|
+
'unknown' as unknown as StatGroupBy, // Forcing an unknown value
|
|
96
|
+
mockLogData
|
|
97
|
+
);
|
|
98
|
+
expect(result.headers).toEqual([]);
|
|
99
|
+
expect(result.data).toEqual([]);
|
|
100
|
+
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
test('should handle missing exercise/muscle data gracefully', () => {
|
|
104
|
+
const mockLogData: LogData = new LogData({
|
|
105
|
+
exercises: { 123: 8 }, // Exercise with ID 123 doesn't exist in mockExerciseList
|
|
106
|
+
muscle: { 123: 12 }, // Muscle with ID 123 doesn't exist in mockMuscleList
|
|
107
|
+
total: 20
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
const resultExercises = getHumanReadableHeaders(
|
|
111
|
+
mockExerciseList,
|
|
112
|
+
mockLanguage,
|
|
113
|
+
mockMuscleList,
|
|
114
|
+
StatGroupBy.Exercises,
|
|
115
|
+
mockLogData
|
|
116
|
+
);
|
|
117
|
+
expect(resultExercises.headers).toEqual([undefined]);
|
|
118
|
+
expect(resultExercises.data).toEqual([8]);
|
|
119
|
+
|
|
120
|
+
const resultMuscles = getHumanReadableHeaders(
|
|
121
|
+
mockExerciseList,
|
|
122
|
+
mockLanguage,
|
|
123
|
+
mockMuscleList,
|
|
124
|
+
StatGroupBy.Muscles,
|
|
125
|
+
mockLogData
|
|
126
|
+
);
|
|
127
|
+
expect(resultMuscles.headers).toEqual(['']);
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
describe('Tests for the getFullStatsData function', () => {
|
|
133
|
+
|
|
134
|
+
test('should return correct data and totals for weekly data', () => {
|
|
135
|
+
const mockStatsData = new RoutineStatsData({
|
|
136
|
+
sets: new GroupedLogData({
|
|
137
|
+
weekly: {
|
|
138
|
+
1: new LogData({ muscle: { 2: 5, 3: 10 }, total: 15 }),
|
|
139
|
+
2: new LogData({ muscle: { 2: 8, 3: 12 }, total: 20 }),
|
|
140
|
+
},
|
|
141
|
+
})
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
const result = getFullStatsData(
|
|
146
|
+
mockStatsData,
|
|
147
|
+
StatType.Sets,
|
|
148
|
+
StatSubType.Weekly,
|
|
149
|
+
StatGroupBy.Muscles,
|
|
150
|
+
mockExerciseList,
|
|
151
|
+
mockMuscleList,
|
|
152
|
+
mockLanguage,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
expect(result.headers).toEqual(['Finger muscle', 'Shoulders']);
|
|
156
|
+
expect(result.data).toEqual([
|
|
157
|
+
{ key: 'week 1', values: [5, 10] },
|
|
158
|
+
{ key: 'week 2', values: [8, 12] }
|
|
159
|
+
]);
|
|
160
|
+
|
|
161
|
+
expect(result.totals).toEqual({ 'Finger muscle': 13, 'Shoulders': 22 });
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
test('should return correct data and totals for iteration data', () => {
|
|
166
|
+
|
|
167
|
+
const mockStatsData = new RoutineStatsData({
|
|
168
|
+
volume: new GroupedLogData({
|
|
169
|
+
iteration: {
|
|
170
|
+
1: new LogData({ exercises: { 2: 10, 4: 12 }, total: 22 }),
|
|
171
|
+
2: new LogData({ exercises: { 2: 5, 4: 7 }, total: 12 }),
|
|
172
|
+
3: new LogData({ exercises: { 2: 15, 4: 2 }, total: 17 }),
|
|
173
|
+
}
|
|
174
|
+
})
|
|
175
|
+
});
|
|
176
|
+
const result = getFullStatsData(
|
|
177
|
+
mockStatsData,
|
|
178
|
+
StatType.Volume,
|
|
179
|
+
StatSubType.Iteration,
|
|
180
|
+
StatGroupBy.Exercises,
|
|
181
|
+
mockExerciseList,
|
|
182
|
+
mockMuscleList,
|
|
183
|
+
mockLanguage,
|
|
184
|
+
);
|
|
185
|
+
expect(result.headers).toEqual(["Benchpress", "Crunches"]);
|
|
186
|
+
expect(result.data).toEqual([
|
|
187
|
+
{ key: 'iteration 1', values: [10, 12] },
|
|
188
|
+
{ key: 'iteration 2', values: [5, 7] },
|
|
189
|
+
{ key: 'iteration 3', values: [15, 2] }
|
|
190
|
+
]);
|
|
191
|
+
|
|
192
|
+
expect(result.totals).toEqual({ "Benchpress": 30, "Crunches": 21 });
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
test('should return correct data and totals for daily data', () => {
|
|
199
|
+
|
|
200
|
+
const mockStatsData = new RoutineStatsData({
|
|
201
|
+
sets: new GroupedLogData({
|
|
202
|
+
daily: {
|
|
203
|
+
"2024-03-01": new LogData({ total: 25, muscle: { 3: 10, 2: 15 } }),
|
|
204
|
+
"2024-03-03": new LogData({ total: 30, muscle: { 3: 12, 2: 18 } }),
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
const result = getFullStatsData(
|
|
209
|
+
mockStatsData,
|
|
210
|
+
StatType.Sets,
|
|
211
|
+
StatSubType.Daily,
|
|
212
|
+
StatGroupBy.Muscles,
|
|
213
|
+
mockExerciseList,
|
|
214
|
+
mockMuscleList,
|
|
215
|
+
mockLanguage,
|
|
216
|
+
);
|
|
217
|
+
expect(result.headers).toEqual(['Finger muscle', 'Shoulders']);
|
|
218
|
+
expect(result.data).toEqual([
|
|
219
|
+
{ key: "03/01/24", values: [15, 10] },
|
|
220
|
+
{ key: "03/03/24", values: [18, 12] }
|
|
221
|
+
]);
|
|
222
|
+
expect(result.totals).toEqual({ "Finger muscle": 33, "Shoulders": 22 });
|
|
223
|
+
});
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
describe('formatStatsData', () => {
|
|
228
|
+
|
|
229
|
+
it('should format data correctly for exercises', () => {
|
|
230
|
+
const mockFullStatsData = {
|
|
231
|
+
headers: ['Push Ups', 'Pull Ups'],
|
|
232
|
+
data: [
|
|
233
|
+
{ key: '2024-01-01', values: [10, 5] },
|
|
234
|
+
{ key: '2024-01-03', values: [15, 8] },
|
|
235
|
+
],
|
|
236
|
+
totals: { 'Push Ups': 25, 'Pull Ups': 13 }
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
const result = formatStatsData(mockFullStatsData);
|
|
240
|
+
|
|
241
|
+
expect(result).toEqual([{
|
|
242
|
+
"data": [
|
|
243
|
+
{ category: "2024-01-01", value: 10 },
|
|
244
|
+
{ category: "2024-01-03", value: 15 }
|
|
245
|
+
],
|
|
246
|
+
"name": "Push Ups"
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
"data": [
|
|
250
|
+
{ category: "2024-01-01", value: 5 },
|
|
251
|
+
{ category: "2024-01-03", value: 8 }
|
|
252
|
+
],
|
|
253
|
+
"name": "Pull Ups"
|
|
254
|
+
}
|
|
255
|
+
]);
|
|
256
|
+
});
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
it('should format data correctly for iteration', () => {
|
|
260
|
+
const mockFullStatsData = {
|
|
261
|
+
headers: ['Benchpress', 'Crunches'],
|
|
262
|
+
data: [
|
|
263
|
+
{ key: 'iteration 1', values: [10, 12] },
|
|
264
|
+
{ key: 'iteration 2', values: [5, 7] },
|
|
265
|
+
{ key: 'iteration 3', values: [15, 2] },
|
|
266
|
+
|
|
267
|
+
],
|
|
268
|
+
totals: { 'Benchpress': 30, 'Crunches': 21 }
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
const result = formatStatsData(mockFullStatsData);
|
|
272
|
+
|
|
273
|
+
expect(result).toEqual([{
|
|
274
|
+
"name": "Benchpress",
|
|
275
|
+
"data": [
|
|
276
|
+
{ category: "iteration 1", value: 10 },
|
|
277
|
+
{ category: "iteration 2", value: 5 },
|
|
278
|
+
{ category: "iteration 3", value: 15 }
|
|
279
|
+
],
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
"name": "Crunches",
|
|
283
|
+
"data": [
|
|
284
|
+
{ category: "iteration 1", value: 12 },
|
|
285
|
+
{ category: "iteration 2", value: 7 },
|
|
286
|
+
{ category: "iteration 3", value: 2 }
|
|
287
|
+
],
|
|
288
|
+
}]);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
|
|
292
|
+
it('should format data correctly for weekly', () => {
|
|
293
|
+
|
|
294
|
+
const mockFullStatsData = {
|
|
295
|
+
headers: ['Finger Muscle', 'Shoulders'],
|
|
296
|
+
data: [
|
|
297
|
+
{ key: 'week 1', values: [5, 10] },
|
|
298
|
+
{ key: 'week 2', values: [8, 12] }
|
|
299
|
+
],
|
|
300
|
+
totals: {
|
|
301
|
+
'Finger Muscle': 13,
|
|
302
|
+
'Shoulders': 22
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const result = formatStatsData(mockFullStatsData);
|
|
307
|
+
|
|
308
|
+
expect(result).toEqual([{
|
|
309
|
+
"data": [
|
|
310
|
+
{ category: "week 1", value: 5 },
|
|
311
|
+
{ category: "week 2", value: 8 }
|
|
312
|
+
],
|
|
313
|
+
"name": "Finger Muscle"
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
"data": [
|
|
317
|
+
{ category: "week 1", value: 10 },
|
|
318
|
+
{ category: "week 2", value: 12 }
|
|
319
|
+
],
|
|
320
|
+
"name": "Shoulders"
|
|
321
|
+
}
|
|
322
|
+
]);
|
|
323
|
+
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
it('should handle missing data gracefully', () => {
|
|
327
|
+
const mockFullStatsData = {
|
|
328
|
+
headers: ['Exercise A', 'Exercise B'],
|
|
329
|
+
data: [
|
|
330
|
+
{ key: 'Day 1', values: [10, undefined] }, // Missing value for Exercise B
|
|
331
|
+
{ key: 'Day 2', values: [undefined, 5] }, // Missing value for Exercise A
|
|
332
|
+
],
|
|
333
|
+
totals: { 'Exercise A': 10, 'Exercise B': 5 }
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const result = formatStatsData(mockFullStatsData);
|
|
337
|
+
expect(result).toEqual([{
|
|
338
|
+
"data": [
|
|
339
|
+
{ category: "Day 1", value: 10 },
|
|
340
|
+
{ category: "Day 2" }],
|
|
341
|
+
"name": "Exercise A"
|
|
342
|
+
},
|
|
343
|
+
{
|
|
344
|
+
"data": [
|
|
345
|
+
{ category: "Day 1" },
|
|
346
|
+
{ category: "Day 2", value: 5 }
|
|
347
|
+
],
|
|
348
|
+
"name": "Exercise B"
|
|
349
|
+
}
|
|
350
|
+
]);
|
|
351
|
+
});
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
it('should handle empty headers and data', () => {
|
|
355
|
+
const mockFullStatsData = {
|
|
356
|
+
headers: [],
|
|
357
|
+
data: [],
|
|
358
|
+
totals: {}
|
|
359
|
+
};
|
|
360
|
+
const result = formatStatsData(mockFullStatsData);
|
|
361
|
+
expect(result).toEqual([]);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
});
|