style: Reformat code

This commit is contained in:
Michal Šmahel
2025-06-08 16:33:12 +02:00
parent 8c9084cc7a
commit 89bc2a9293
9 changed files with 36 additions and 26 deletions

View File

@@ -115,7 +115,10 @@ const TeamPanel = () => {
email: newEmail,
}));
const validation = newOrChangedCredentials.validate({ email: newEmail }, { abortEarly: false });
const validation = newOrChangedCredentials.validate(
{ email: newEmail },
{ abortEarly: false }
);
setErrors((prev) => {
const updatedErrors = { ...prev };

View File

@@ -14,7 +14,7 @@ import SunAndMoonIcon from "./SunAndMoonIcon";
import { useDispatch, useSelector } from "react-redux";
import { setMode } from "../../Features/UI/uiSlice";
import "./index.css";
import {useTranslation} from "react-i18next";
import { useTranslation } from "react-i18next";
const ThemeSwitch = ({ width = 48, height = 48, color }) => {
const mode = useSelector((state) => state.ui.mode);

View File

@@ -75,7 +75,10 @@ const ForgotPassword = () => {
const { value } = event.target;
setForm({ email: value });
const { error } = newOrChangedCredentials.validate({ email: value }, { abortEarly: false });
const { error } = newOrChangedCredentials.validate(
{ email: value },
{ abortEarly: false }
);
if (error) setErrors({ email: error.details[0].message });
else delete errors.email;

View File

@@ -100,7 +100,9 @@ const NewPasswordConfirmed = () => {
</IconBox>
</Stack>
<Typography component="h1">{t("auth.forgotPassword.heading")}</Typography>
<Typography mb={theme.spacing(2)}>{t("auth.forgotPassword.subheadings.stepFour")}</Typography>
<Typography mb={theme.spacing(2)}>
{t("auth.forgotPassword.subheadings.stepFour")}
</Typography>
</Box>
<Button
variant="contained"

View File

@@ -77,9 +77,11 @@ function StepThree({ isSuperAdmin, onSubmit, onBack }) {
value={form.password}
onChange={handleChange}
error={errors.password && errors.password[0] ? true : false}
helperText={errors.password === "auth.common.inputs.password.errors.empty"
? t(errors.password)
: ""} // Other errors are related to required password conditions and are visualized below the input
helperText={
errors.password === "auth.common.inputs.password.errors.empty"
? t(errors.password)
: ""
} // Other errors are related to required password conditions and are visualized below the input
ref={inputRef}
/>
<TextInput

View File

@@ -171,9 +171,11 @@ const SetNewPassword = () => {
value={form.password}
onChange={handleChange}
error={errors.password ? true : false}
helperText={errors.password === "auth.common.inputs.password.errors.empty"
? t(errors.password)
: ""} // Other errors are related to required password conditions and are visualized below the input
helperText={
errors.password === "auth.common.inputs.password.errors.empty"
? t(errors.password)
: ""
} // Other errors are related to required password conditions and are visualized below the input
endAdornment={<PasswordEndAdornment />}
/>
</Box>
@@ -217,12 +219,16 @@ const SetNewPassword = () => {
variant={feedbacks.number}
/>
<Check
noHighlightText={t("auth.common.inputs.password.rules.uppercase.beginning")}
noHighlightText={t(
"auth.common.inputs.password.rules.uppercase.beginning"
)}
text={t("auth.common.inputs.password.rules.uppercase.highlighted")}
variant={feedbacks.uppercase}
/>
<Check
noHighlightText={t("auth.common.inputs.password.rules.lowercase.beginning")}
noHighlightText={t(
"auth.common.inputs.password.rules.lowercase.beginning"
)}
text={t("auth.common.inputs.password.rules.lowercase.highlighted")}
variant={feedbacks.lowercase}
/>

View File

@@ -20,7 +20,9 @@ const SettingsAbout = () => {
</Typography>
</Box>
<Box>
<Typography component="h2">{t("common.appName")} {2.1}</Typography>
<Typography component="h2">
{t("common.appName")} {2.1}
</Typography>
<Typography sx={{ mt: theme.spacing(2), mb: theme.spacing(6), opacity: 0.6 }}>
{t("settingsDevelopedBy")}
</Typography>

View File

@@ -105,11 +105,9 @@ const loginCredentials = joi.object({
"string.empty": "auth.common.inputs.email.errors.empty",
"string.email": "auth.common.inputs.email.errors.invalid",
}),
password: joi
.string()
.messages({
"string.empty": "auth.common.inputs.password.errors.empty",
}),
password: joi.string().messages({
"string.empty": "auth.common.inputs.password.errors.empty",
}),
});
const monitorValidation = joi.object({

View File

@@ -22,14 +22,8 @@ const passwordPattern =
/^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[!?@#$%^&*()\-_=+[\]{};:'",.<>~`|\\/])[A-Za-z0-9!?@#$%^&*()\-_=+[\]{};:'",.<>~`|\\/]+$/;
const loginValidation = joi.object({
email: joi
.string()
.email()
.required()
.lowercase(),
password: joi
.string()
.required(),
email: joi.string().email().required().lowercase(),
password: joi.string().required(),
});
const nameValidation = joi
.string()