• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

wger-project / react / 24400238877

14 Apr 2026 12:58PM UTC coverage: 74.753% (-0.7%) from 75.488%
24400238877

Pull #1234

github

web-flow
Merge b70152dcd into 47a6ff2da
Pull Request #1234: version 2.5

2018 of 3062 branches covered (65.9%)

Branch coverage included in aggregate %.

125 of 241 new or added lines in 29 files covered. (51.87%)

7 existing lines in 2 files now uncovered.

6077 of 7767 relevant lines covered (78.24%)

28.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.54
/src/components/Exercises/Add/Step3Description.tsx
1
import { Box, Button, Stack } from "@mui/material";
2✔
2
import Grid from '@mui/material/Grid';
2✔
3
import { useLanguageCheckQuery } from "components/Core/queries";
2✔
4
import { StepProps } from "components/Exercises/Add/AddExerciseStepper";
5
import { PaddingBox } from "components/Exercises/Detail/ExerciseDetails";
2✔
6
import { MarkdownEditor } from "components/Common/forms/MarkdownEditor";
2✔
7
import { ExerciseNotes } from "components/Exercises/forms/ExerciseNotes";
2✔
8
import { descriptionValidator, noteValidator } from "components/Exercises/forms/yupValidators";
2✔
9
import { Form, Formik } from "formik";
2✔
10
import { useTranslation } from "react-i18next";
2✔
11
import { useExerciseSubmissionStateValue } from "state";
2✔
12
import { setDescriptionEn, setNotesEn } from "state/exerciseSubmissionReducer";
2✔
13
import { ENGLISH_LANGUAGE_ID } from "utils/consts";
2✔
14
import * as yup from "yup";
2✔
15

16

17
export const Step3Description = ({ onContinue, onBack }: StepProps) => {
2✔
18
    const [t] = useTranslation();
2✔
19
    const [state, dispatch] = useExerciseSubmissionStateValue();
2✔
20
    const languageCheckQuery = useLanguageCheckQuery();
2✔
21

22
    const validationSchema = yup.object({
2✔
23
        description: descriptionValidator(),
24
        notes: noteValidator()
25
    });
26

27
    return (
2✔
28
        (<Formik
29
            initialValues={{
30
                description: state.descriptionEn,
31
                notes: state.notesEn,
32
            }}
33
            validationSchema={validationSchema}
34
            onSubmit={async (values, { setFieldError }) => {
35
                let canContinue = false;
×
36

37
                const validationResult = await languageCheckQuery.mutateAsync({
×
38
                    input: values.description,
39
                    languageId: ENGLISH_LANGUAGE_ID
40
                });
41

42
                // @ts-ignore - validationResult contains the message from the backend
43
                if ("success" in validationResult) {
×
44
                    canContinue = true;
×
45
                } else {
46
                    canContinue = false;
×
47

48
                    // @ts-ignore - validationResult contains the message from the backend
49
                    setFieldError('description', validationResult.check.message);
×
50
                }
51

52
                dispatch(setDescriptionEn(values.description));
×
53
                dispatch(setNotesEn(values.notes));
×
54

55
                if (canContinue) {
×
56
                    onContinue!();
×
57
                }
58

59
            }}
60
        >
61
            {({ values, errors, touched, setFieldValue }) => (
62
                <Form>
4✔
63
                    <Stack>
64
                        <MarkdownEditor
65
                            label={t('exercises.description')}
66
                            value={values.description}
NEW
67
                            onChange={(val) => setFieldValue('description', val)}
×
68
                            error={touched.description && Boolean(errors.description)}
6✔
69
                            helperText={touched.description ? errors.description : undefined}
4✔
70
                        />
71

72
                        <PaddingBox />
73

74
                        <ExerciseNotes fieldName={'notes'} />
75

76
                        <Grid container>
77
                            <Grid sx={{ display: "flex", justifyContent: "end" }} size={12}>
78
                                <Box sx={{ mb: 2 }}>
79
                                    <div>
80
                                        <Button
81
                                            onClick={onBack}
82
                                            sx={{ mt: 1, mr: 1 }}
83
                                        >
84
                                            {t('goBack')}
85
                                        </Button>
86
                                        <Button
87
                                            variant="contained"
88
                                            type="submit"
89
                                            disabled={languageCheckQuery.isPending}
90
                                            sx={{ mt: 1, mr: 1 }}
91
                                        >
92
                                            {t('continue')}
93
                                        </Button>
94
                                    </div>
95
                                </Box>
96
                            </Grid>
97
                        </Grid>
98
                    </Stack>
99
                </Form>
100
            )}
101
        </Formik>)
102
    );
103
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc