Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI for flexible routines #975

Open
wants to merge 183 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
183 commits
Select commit Hold shift + click to select a range
6f0eb42
Start implementing new style routines
rolandgeider Apr 13, 2024
7cc2560
Merge branch 'refs/heads/master' into feature/flexible-routines
rolandgeider Jun 7, 2024
29ffa65
Parse the new routine day data values
rolandgeider Jun 11, 2024
6125ac1
Start adding the new config models
rolandgeider Jun 11, 2024
af5456e
Show routine day with new data format
rolandgeider Jun 13, 2024
aaf347c
Update data model
rolandgeider Jun 20, 2024
aa6a4f5
Correctly render the routine days for an iteration
rolandgeider Jun 21, 2024
d4fb6e3
Render current routine on the dashboard
rolandgeider Jun 25, 2024
a083f3c
Correctly load the full routine structure
rolandgeider Jun 25, 2024
23c1e35
Fix some tests
rolandgeider Jun 25, 2024
2dee0b0
Fix some tests
rolandgeider Jun 25, 2024
8d0cf7b
Remove unused files
rolandgeider Jun 25, 2024
9b1fa53
Load log data from routine
rolandgeider Jun 26, 2024
5d50b39
Fix test
rolandgeider Jun 26, 2024
d17ec81
Start working on a routine editor
rolandgeider Jun 27, 2024
ded3817
Rename exercise reducer
rolandgeider Jun 28, 2024
664fc9c
Allow editing the day properties
rolandgeider Jun 28, 2024
ea833f6
Add some debouncing
rolandgeider Jun 28, 2024
191475a
Start working on a table view for the workouts
rolandgeider Jun 28, 2024
e78228a
Some polishing
rolandgeider Jun 30, 2024
1556a7b
Use smaller font for settings
rolandgeider Jul 1, 2024
0977d81
Fix state provider name
rolandgeider Jul 1, 2024
c916e63
Merge branch 'refs/heads/master' into feature/flexible-routines
rolandgeider Jul 1, 2024
04c3c94
Use new key for exercise translations in API
rolandgeider Jul 9, 2024
e3abe0c
Polishing the scroll behaviour of the routine table
rolandgeider Jul 10, 2024
2936b38
More polishing of routine views
rolandgeider Jul 12, 2024
814a7e4
Add todos, placeholders, some refactor
rolandgeider Jul 19, 2024
115b7c0
Merge branch 'refs/heads/master' into feature/flexible-routines
rolandgeider Jul 21, 2024
20c9da4
Fix tests
rolandgeider Jul 21, 2024
52c5507
firstDayId can be null
rolandgeider Sep 30, 2024
40949ed
Handle the day object being null
rolandgeider Oct 6, 2024
a4c65d8
Start working on drag and drop to allow reordering of the days
rolandgeider Oct 6, 2024
d680c11
Persist changes to the server
rolandgeider Oct 7, 2024
9f417e9
Extract day drag and drop to its own component
rolandgeider Oct 9, 2024
977389c
Allow editing the currently selected day
rolandgeider Oct 9, 2024
39da4be
QoL cleanup for DayForm.tsx
rolandgeider Oct 11, 2024
3ecbfb0
Add Formik for form handling and validation
rolandgeider Oct 13, 2024
5581b87
Allow deleting slots and undoing the action
rolandgeider Oct 13, 2024
444fecd
Allow editing set slot comments
rolandgeider Oct 17, 2024
d2c1b9c
Add needed queries to add config objects
rolandgeider Oct 17, 2024
4586551
Add needed queries to delete config objects
rolandgeider Oct 17, 2024
8617447
Add some tests
rolandgeider Oct 17, 2024
c8e3268
Allow changing the exercise for a slot (config)
rolandgeider Oct 18, 2024
a88b13f
Polish a bit the grid configuration
rolandgeider Oct 18, 2024
4c91d2f
Allow editing the configs for workout progressions
rolandgeider Oct 20, 2024
eaba4fc
Translate the exercises
rolandgeider Oct 20, 2024
63b1cfb
Add links to reach the progression editor
rolandgeider Oct 21, 2024
765b60f
More tweaks and polishing
rolandgeider Oct 21, 2024
8f633f1
Remove "next_day" foreign key
rolandgeider Oct 22, 2024
9ff4e10
Allow editing repetition and weight units and more UI polishing
rolandgeider Oct 23, 2024
669334f
Allow deleting and adding days to the routine
rolandgeider Oct 24, 2024
0fc96cb
Implement adding sets to a routine
rolandgeider Oct 24, 2024
1bec1fb
Add some logic to differentiate between adding a working set and a su…
rolandgeider Oct 24, 2024
bd6dfee
Remove placeholder uuid generator
rolandgeider Oct 24, 2024
94ba00f
Combine the "add set" and "add superset" buttons
rolandgeider Oct 24, 2024
ba04e5e
Polishing the sets, this should be a bit more compact
rolandgeider Oct 24, 2024
759701e
Add edit component for RiR values
rolandgeider Oct 25, 2024
0c5b303
Merge branch 'master' into feature/flexible-routines
rolandgeider Oct 25, 2024
85a0859
Update yarn.lock
rolandgeider Oct 25, 2024
177f36b
Update call to useQuery
rolandgeider Oct 25, 2024
81ddd7c
Update call to invalidateQueries
rolandgeider Oct 25, 2024
4f62ba7
Replace isLoading with isPending on mutation queries
rolandgeider Oct 25, 2024
e02fd76
Fix some tests
rolandgeider Oct 25, 2024
6c2f947
Add link to routine edit page
rolandgeider Oct 25, 2024
36d44a9
Merge branch 'master' into feature/flexible-routines
rolandgeider Oct 25, 2024
b7a6118
Fix some merge errors, update yarn.lock
rolandgeider Oct 25, 2024
72e808f
Update to Grid2
rolandgeider Oct 25, 2024
d01bd2c
Allow setting the start and end dates for new routines
rolandgeider Oct 25, 2024
0135cf6
Add drag'n'drop to move the order of the exercises / sets
rolandgeider Oct 26, 2024
fe5e8e7
Use one query to update the orders of all days
rolandgeider Oct 26, 2024
0a8f159
Add and fix some more tests
rolandgeider Oct 26, 2024
5b17b5e
No need to manually sort the order of the days
rolandgeider Oct 27, 2024
1bcf3ee
Use the WgerTextField component in the forms
rolandgeider Oct 27, 2024
2f13acc
Properly format the routine description
rolandgeider Oct 27, 2024
750fc93
Mark some strings as translatable
rolandgeider Oct 27, 2024
e671e9c
Optimize somewhat the edit page for smaller screens
rolandgeider Oct 27, 2024
7bf6d0d
CLeanup
rolandgeider Oct 28, 2024
4fa59ee
Allow editing the fitInWeek field in routines
rolandgeider Oct 28, 2024
9e5a654
Rename SlotConfig to SlotEntry
rolandgeider Oct 28, 2024
0bb2f65
Fix name for entries
rolandgeider Oct 28, 2024
f87ed3d
Add check to properly render empty routines
rolandgeider Oct 28, 2024
eab5a3f
Load config field
rolandgeider Oct 29, 2024
53b4bfa
Remove the different *Config files
rolandgeider Oct 30, 2024
cfd5105
Pre-select the weight unit based on the user's preferences
rolandgeider Nov 9, 2024
8137938
Merge branch 'master' into feature/flexible-routines
rolandgeider Nov 9, 2024
5e359b9
Update yarn.lock
rolandgeider Nov 9, 2024
45c1202
Fix profile objects
rolandgeider Nov 10, 2024
8718d9d
Add max duration validation for routines
rolandgeider Nov 12, 2024
3aebbbe
Show the value of the fitInWekk flag in the form
rolandgeider Nov 12, 2024
45997df
Merge branch 'master' into feature/flexible-routines
rolandgeider Nov 14, 2024
00cb62a
Add link to table view
rolandgeider Nov 19, 2024
1304173
Add toggle to save the needs_logs_to_advance flag
rolandgeider Nov 20, 2024
79e00f4
Increase size of description text and filter out generated rest days …
rolandgeider Nov 20, 2024
4191625
Move some widgets to own folder
rolandgeider Nov 20, 2024
667e788
Add delete link for routines
rolandgeider Nov 20, 2024
68ac2ec
Load routine statistics
rolandgeider Nov 20, 2024
e03a21e
Merge branch 'master' into feature/flexible-routines
rolandgeider Nov 21, 2024
fdf3ad9
Show info text if there are no routines
rolandgeider Nov 21, 2024
0e5329e
Add menu to duplicate routines
rolandgeider Nov 21, 2024
55b6427
Add route to add new routines
rolandgeider Nov 21, 2024
48a208b
Fix unique key
rolandgeider Nov 22, 2024
6ec7f8f
Use the download attribute for PDF links
rolandgeider Nov 22, 2024
baa63d2
Add link to log overview
rolandgeider Nov 22, 2024
ea1590a
Add session form component
rolandgeider Nov 22, 2024
9e352f9
Add form component to save individual logs
rolandgeider Nov 24, 2024
dac5fed
Add some tests
rolandgeider Nov 24, 2024
d510aac
Load weight and rep units
rolandgeider Nov 24, 2024
d4cfa08
Remove debug output
rolandgeider Nov 24, 2024
6849e75
Add link to add logs from day header
rolandgeider Nov 25, 2024
71fcca0
Only show exercises for the current day
rolandgeider Nov 25, 2024
c279d68
Allow passing dynamic parameters for the session search
rolandgeider Nov 25, 2024
bdb9d91
Frontend changes to support max-nr-of-sets
rolandgeider Nov 25, 2024
751a777
Add new "repeat" parameter for base configs
rolandgeider Nov 25, 2024
485a618
Use an object for the SetConfigData constructor
rolandgeider Nov 25, 2024
0a84b3f
Rounding values are nullable
rolandgeider Nov 25, 2024
f9c7601
SlotEntry constructor now also uses an object
rolandgeider Nov 25, 2024
02bd70f
Refactor the ProgressionForm component
rolandgeider Nov 28, 2024
2224bd7
Allow adding progression rules for max-rir values
rolandgeider Nov 29, 2024
0b5dd5e
Merge branch 'master' into feature/flexible-routines
rolandgeider Dec 6, 2024
111e386
Update yarn.lock
rolandgeider Dec 6, 2024
b17f265
Add requirements to progression rules
rolandgeider Dec 12, 2024
7f78e86
Add link to iCal file download
rolandgeider Dec 13, 2024
51df7b3
Merge branch 'master' into feature/flexible-routines
rolandgeider Dec 14, 2024
3789be3
Fix link to log form
rolandgeider Dec 14, 2024
252461e
Fix workout log overview page
rolandgeider Dec 14, 2024
f8fb675
Add target values to the log model
rolandgeider Dec 14, 2024
e042293
Translate table headers
rolandgeider Dec 14, 2024
b18fe51
Add component for routine statistics
rolandgeider Dec 16, 2024
d1b5c6d
Refactor statistics components and add some tests
rolandgeider Dec 16, 2024
a4b39e3
Add charts showing the currently selected statistics combination
rolandgeider Dec 16, 2024
fb040e0
Add route to the routine statistics
rolandgeider Dec 17, 2024
a623b84
Use WgerContainerFullWidth for consistency
rolandgeider Dec 17, 2024
6082f0f
Fix some tests
rolandgeider Dec 17, 2024
bf3a374
Polish a bit the navigation under the different routine pages
rolandgeider Dec 17, 2024
3698db5
Fix test
rolandgeider Dec 17, 2024
88a5ec0
More overall polishing and i18n
rolandgeider Dec 17, 2024
f368606
Send rule requirements to the server
rolandgeider Dec 17, 2024
35d26dc
More polishing and i18n
rolandgeider Dec 18, 2024
335dfc9
Some work on the progression form validation, responsiveness, and i18n
rolandgeider Dec 19, 2024
9b9e17e
Add form to edit the rounding for computed values
rolandgeider Dec 21, 2024
5fd784c
Don't show the date in the header
rolandgeider Dec 23, 2024
b5d2ef7
Make the session form aware of planned iterations
rolandgeider Dec 24, 2024
2aa5ac3
Show intensity in the routine statistics
rolandgeider Dec 25, 2024
57f4d19
Fix message key
rolandgeider Dec 30, 2024
c1c9a47
Merge branch 'master' into feature/flexible-routines
rolandgeider Jan 3, 2025
c3dd86a
Updated yarn.lock
rolandgeider Jan 3, 2025
e4d231e
Show better headers and counter for the exercises in a set
rolandgeider Jan 3, 2025
a279718
Calculate the workout duration
rolandgeider Jan 4, 2025
6bef86e
Render the trained muscles for the current routine
rolandgeider Jan 4, 2025
3b0366a
Localize the texts used when changing a day to a rest day
rolandgeider Jan 4, 2025
1eda422
Remove debug log
rolandgeider Jan 4, 2025
f969f76
Correctly filter out duplicate muscles
rolandgeider Jan 4, 2025
e9b8ef2
Add routine template components
rolandgeider Jan 4, 2025
d9fe687
Fix test
rolandgeider Jan 5, 2025
5df9d71
Remove the fab on the template overviews
rolandgeider Jan 7, 2025
f83329e
Show the more common "week x" for the duration if the routine fits in…
rolandgeider Jan 7, 2025
2ae28c8
Read max RiR from the API
rolandgeider Jan 8, 2025
ef8fa33
Read max RiR from the API
rolandgeider Jan 8, 2025
dec0432
Translate some strings
rolandgeider Jan 10, 2025
e0cf22f
Actually use the routine ID when rendering the session form
rolandgeider Jan 10, 2025
bd2a9c7
Add navigation to the table view
rolandgeider Jan 10, 2025
fd11871
Add smoke tests to the new routine components
rolandgeider Jan 10, 2025
cac33b1
Merge branch 'master' into feature/flexible-routines
rolandgeider Jan 10, 2025
e7af716
Directly open the newly created day
rolandgeider Jan 10, 2025
eed9e4c
Add test for ProgressionForm.tsx
rolandgeider Jan 10, 2025
9f7ed0a
Add json parse test for SlotEntry
rolandgeider Jan 10, 2025
83c6b31
Add tests and i18n to components in SlotEntryForm
rolandgeider Jan 11, 2025
021af31
Add tests and i18n to components in SlotForm
rolandgeider Jan 11, 2025
291a3aa
Add tests to components in RoutineForm
rolandgeider Jan 11, 2025
cc0966b
Add tests for SlotEntryRoundingField and DayForm
rolandgeider Jan 11, 2025
9a682a3
Show logged values in table view
rolandgeider Jan 12, 2025
7967077
Improve comparison of values for log table
rolandgeider Jan 13, 2025
21877f1
Make the rir and max rir values a number
rolandgeider Jan 13, 2025
6574f58
Add rest time and max rest time to the workout log object
rolandgeider Jan 13, 2025
a6ad74c
Force integers for some values
rolandgeider Jan 13, 2025
96bf778
Use updated name of repetition in API response
rolandgeider Jan 14, 2025
0374634
The repetitions can now be null, check for this as well
rolandgeider Jan 15, 2025
e9e3130
Add drag handle to make visible the days can be dragged and dropped
rolandgeider Jan 17, 2025
4cc04c6
Comment out unused components
rolandgeider Jan 17, 2025
bd20a3b
Merge branch 'master' into feature/flexible-routines
rolandgeider Jan 18, 2025
d0e7c6a
Merge branch 'master' into feature/flexible-routines
rolandgeider Jan 18, 2025
e5f28e2
Show correct day names on dashboard
rolandgeider Jan 18, 2025
4e5a7ec
Temporarily comment out test
rolandgeider Jan 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"@emotion/babel-plugin": "^11.12.0",
"@emotion/react": "^11.13.5",
"@emotion/styled": "^11.13.5",
"@hello-pangea/dnd": "^17.0.0",
"@mui/icons-material": "^6.3.0",
"@mui/lab": "^6.0.0-beta.14",
"@mui/material": "^6.3.0",
Expand All @@ -31,6 +32,7 @@
"recharts": "^2.13.3",
"slug": "^9.1.0",
"typescript": "^5.6.3",
"use-debounce": "^10.0.4",
"vite-tsconfig-paths": "^5.0.1",
"web-vitals": "^4.2.2",
"yup": "^1.4.0"
Expand Down
507 changes: 266 additions & 241 deletions public/locales/de/translation.json

Large diffs are not rendered by default.

99 changes: 95 additions & 4 deletions public/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"timeOfDay": "Time of day",
"submit": "Submit",
"edit": "Edit",
"editName": "Edit {{name}}",
"delete": "Delete",
"deleteConfirmation": "Are you sure you want to delete \"{{name}}\"?",
"add": "Add",
Expand All @@ -17,6 +18,9 @@
"lastHalfYear": "Last 6 Months",
"lastMonth": "Last Month",
"lastWeek": "Last Week",
"start": "Start",
"end": "End",
"comment": "Comment",
"licenses": {
"authors": "Author(s)",
"authorProfile": "Link to author website or profile, if available",
Expand Down Expand Up @@ -88,7 +92,8 @@
"imageStyleLine": "Line",
"imageStyleLowPoly": "Low-Poly",
"imageStyleOther": "Other",
"imageDetails": "Image details"
"imageDetails": "Image details",
"swapExercise": "Swap exercise"
},
"nutrition": {
"plans": "Nutritional plans",
Expand Down Expand Up @@ -158,37 +163,123 @@
"overview": "Overview",
"preferences": "Preferences",
"continue": "Continue",
"goBack": "Back",
"goBack": "Go back",
"language": "Language",
"forms": {
"supportedImageFormats": "Only JPEG, PNG and WEBP files below 20Mb are supported",
"enterNumber": "Please enter a valid number",
"enterInteger": "Please enter a whole number",
"valueTooShort": "The value is too short",
"valueTooLong": "The value is too long",
"fieldRequired": "This field is required",
"maxLength": "Please enter less than {{chars}} characters",
"minLength": "Please enter more than {{chars}} characters",
"minValue": "The value for this field has to be higher than {{value}}",
"maxValue": "The value for this field has to be less than {{value}}"
"maxValue": "The value for this field has to be less than {{value}}",
"maxLessThanMin": "The max value has to be bigger than the minimum",
"endBeforeStart": "The end value cannot be before the start"
},
"name": "Name",
"category": "Category",
"success": "Success!",
"English": "English",
"save": "Save",
"min": "Min",
"max": "Max",
"durationWeeks": "{{number}} weeks",
"durationWeeksDays": "{{nrWeeks}} weeks, {{nrDays}} days",
"videos": "Videos",
"undo": "Undo",
"successfullyDeleted": "Successfully deleted",
"cannotBeUndone": "This action can't be undone.",
"cancel": "Cancel",
"noResults": "No results",
"noResultsDescription": "No results found for this query, consider reducing the number of filters.",
"routines": {
"sets": "Sets",
"reps": "Reps",
"volume": "Volume",
"intensity": "Intensity",
"currentRoutine": "Current routine",
"iteration": "Iteration",
"weekly": "Weekly",
"daily": "Daily",
"restTime": "Rest time",
"workoutNr": "Workout Nr. {{number}}",
"weekNr": "Week {{number}}",
"backToRoutine": "Back to routine",
"minLengthRoutine": "The routine needs to be at least {{number}} weeks long",
"maxLengthRoutine": "The routine can be at most {{number}} weeks long",
"resultingRoutine": "Resulting routine",
"addDay": "Add training day",
"deleteDayConfirmation": "This will remove all sets, exercises and progression rules",
"routineHasNoDays": "The routine has no days",
"setHasNoExercises": "This set has no exercises",
"fitDaysInWeek": "Fit days in week",
"fitDaysInWeekHelpText": "This setting controls how your routine's days are scheduled across multiple weeks. If enabled, the days will repeat in a weekly cycle. For example, a routine with workouts on Monday, Wednesday, and Friday will continue this pattern on the following Monday, Wednesday, and Friday. If disabled, the days will follow sequentially without regard to the start of a new week. This is useful for routines that don't follow a strict weekly schedule.",
"needsLogsToAdvance": "Needs logs to advance",
"needsLogsToAdvanceHelpText": "If you select this option, the routine will only progress to the next scheduled day if you've logged a workout for the current day. If this option is not selected, the routine will automatically advance to the next day regardless of whether you logged a workout or not.",
"addSuperset": "Add superset",
"addExercise": "Add exercise",
"exerciseNr": "Exercise {{number}}",
"supersetNr": "Superset {{number}}",
"editProgression": "Edit progression",
"progressionNeedsReplace": "One of the previous entries must have a replace operation",
"exerciseHasProgression": "This exercise has progression rules and can't be edited here. To do so, click the button.",
"defaultRounding": "Default rounding",
"rounding": "Rounding (this exercise)",
"roundingHelp": "Set the default rounding for weight and repetitions (this is specially useful when using the percentage increase step in the progression). This will apply to all new sets but can be changed individually in the progression form. Leave empty to disable rounding.",
"newDay": "New day",
"addWeightLog": "Add training log",
"weightLogNotPlanned": "Saving logs to a date for which no workouts were planned.",
"logsOverview": "Logs overview",
"alsoShowLogs": "Also show logs",
"statsOverview": "Statistics",
"simpleMode": "Simple mode",
"logsHeader": "Training log for workout",
"logsFilterNote": "Note that only entries with a weight unit of kg or lb and repetitions are charted, other combinations such as time or until failure are ignored here",
"addLogToDay": "Add log to this day",
"routine": "Routine",
"routines": "Routines",
"rir": "RiR"
"rir": "RiR",
"restDay": "Rest day",
"confirmRestDay": "Confirm rest day change",
"confirmRestDayHelpText": "Please note that all sets and exercises will be removed when you mark a day as a rest day.",
"duplicate": "Duplicate routine",
"downloadPdfTable": "Download PDF (table)",
"downloadPdfLogs": "Download PDF (logs)",
"downloadIcal": "Download iCal file",
"impression": "General impression",
"impressionGood": "Good",
"impressionNeutral": "Neutral",
"impressionBad": "Bad",
"impressionHelpText": "This form records your workout results (reps, weight, etc.) for each exercise. Changes you make here, like removing or swapping exercises, only affect the specific logs you save and and won't change your overall routine. Only rows with values for either weight or repetitions are saved.",
"addAdditionalLog": "Add additional log",
"operation": "Operation",
"step": "Step",
"requirements": "Requirements",
"requirementsHelpText": "Select the workout results (from previous logs) that must be met for this rule to take effect",
"repeat": "Repeat rule",
"repeatHelpText": "Check the check box if you want this rule to continue to apply to subsequent workouts until you define a new one",
"markAsTemplate": "Manage template",
"template": "Template",
"templates": "Templates",
"publicTemplate": "Public template",
"publicTemplates": "Public templates",
"templatesHelpText": "Templates are a way to save your routine for later use and as a starting point for further routines. You can't edit templates, but you can duplicate them and make changes to the copy (as well as converting them back to a regular routine, of course).",
"publicTemplateHelpText": "Public templates are available to all users.",
"copyAndUseTemplate": "Copy and use template",
"set": {
"type": "Type",
"normalSet": "Normal set",
"dropSet": "Drop set",
"myo": "MYO",
"partial": "Partial",
"forced": "Forced",
"tut": "TUT",
"iso": "ISO",
"jump": "Jump"
}
},
"measurements": {
"measurements": "Measurements",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ describe('CalendarComponent', () => {
// Act
const day = screen.getByTestId(`day-${dateToYYYYMMDD(new Date(currentYear, currentMonth, 2))}`);
await user.click(day);
screen.logTestingPlaygroundURL();

// Assert
expect(screen.getByText('70.0 kg')).toBeInTheDocument();
Expand Down
27 changes: 27 additions & 0 deletions src/components/Common/forms/WgerTextField.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { TextField } from "@mui/material";
import { TextFieldProps } from "@mui/material/TextField/TextField";
import { useField } from "formik";
import React from "react";

interface WgerTextFieldProps {
fieldName: string,
title: string,
fieldProps?: TextFieldProps,
fullwidth?: boolean,
}

export function WgerTextField(props: WgerTextFieldProps) {
const [field, meta] = useField(props.fieldName);
const fullwidth = props.fullwidth ?? true;

return <TextField
fullWidth={fullwidth}
id={props.fieldName}
label={props.title}
variant="standard"
error={meta.touched && Boolean(meta.error)}
helperText={meta.touched && meta.error}
{...field}
{...props.fieldProps}
/>;
}
22 changes: 11 additions & 11 deletions src/components/Core/LoadingWidget/LoadingWidget.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
import React from 'react';
import { Box, CircularProgress, Stack } from "@mui/material";
import React from 'react';
import { useTranslation } from "react-i18next";

export const LoadingWidget = () => {

const [t] = useTranslation();

return (
<Box sx={{ textAlign: "center" }}>{t('loading')}</Box>
);
};

export const LoadingPlaceholder = () => {
return <Box
sx={{ height: 200, alignItems: "center", mt: 2 }}
component={Stack}
direction="column"
justifyContent="center">
<CircularProgress />
</Box>;
};
export const LoadingPlaceholder = () => <Box
sx={{ height: 200, alignItems: "center", mt: 2 }}
component={Stack}
direction="column"
justifyContent="center">
<CircularProgress />
</Box>;


export const LoadingProgressIcon = () => <CircularProgress size={20} />;
14 changes: 8 additions & 6 deletions src/components/Core/Modals/DeleteConfirmationModal.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FunctionComponent } from 'react';
import { Button, Card, CardActions, CardContent, CardHeader, Modal, Typography } from "@mui/material";
import CloseIcon from '@mui/icons-material/Close';
import { Button, Card, CardActions, CardContent, CardHeader, Modal, Typography } from "@mui/material";
import { FunctionComponent } from 'react';
import { useTranslation } from "react-i18next";

export interface DeleteConfirmationModalProps {
Expand All @@ -25,12 +25,15 @@ export const DeleteConfirmationModal: FunctionComponent<DeleteConfirmationModalP
const [t] = useTranslation();

const style = {
position: 'absolute' as 'absolute',
position: 'absolute',
top: '50%',
left: '50%',
transform: 'translate(-50%, -50%)',
// width: 500,
bgcolor: 'background.paper',
borderWidth: 0,
boxShadow: 24,
p: 2,
minWidth: '400px'
};

const handleDelete = () => {
Expand Down Expand Up @@ -62,11 +65,10 @@ export const DeleteConfirmationModal: FunctionComponent<DeleteConfirmationModalP
{t('delete')}
</Button>
<Button color="primary" onClick={closeFn}>
{t('cancel')}
{t('close')}
</Button>
</CardActions>
</Card>
</Modal>

);
};
Loading
Loading