min, max and info icons

master
alex 2024-02-19 22:03:01 +01:00
parent 54fd54a6c7
commit cf0b173ab7
6 changed files with 88 additions and 29 deletions

View File

@ -43,8 +43,10 @@
"calendarUsingPrimaryCalendar": "Verwende primären Kalender", "calendarUsingPrimaryCalendar": "Verwende primären Kalender",
"companyName": "Firmenname", "companyName": "Firmenname",
"companyNamePlaceholder": "Geben Sie den Firmennamen ein", "companyNamePlaceholder": "Geben Sie den Firmennamen ein",
"companyNameInfo": "Der Firmenname wird in Emails und auf der Buchungsseite angezeigt.",
"companyAddress": "Firmenadresse", "companyAddress": "Firmenadresse",
"companyAddressPlaceholder": "Geben Sie die Firmenadresse ein", "companyAddressPlaceholder": "Musterstraße 1\n12345 Musterstadt",
"companyAddressInfo": "Die Firmenaddresse wird in Emails und auf der Buchungsseite angezeigt.",
"companyEmail": "Firmen E-Mail", "companyEmail": "Firmen E-Mail",
"companyEmailPlaceholder": "Geben Sie die Firmen E-Mail ein", "companyEmailPlaceholder": "Geben Sie die Firmen E-Mail ein",
"companyPhoneNumber": "Firmen Telefonnummer", "companyPhoneNumber": "Firmen Telefonnummer",
@ -62,6 +64,12 @@
"calendarMinEarliestBookingTimeRequired": "Minimaler frühester Buchungszeitpunkt ist erforderlich", "calendarMinEarliestBookingTimeRequired": "Minimaler frühester Buchungszeitpunkt ist erforderlich",
"companyNameRequired": "Firmenname ist erforderlich", "companyNameRequired": "Firmenname ist erforderlich",
"companyNameMinLength": "Firmenname muss mindestens {{minLength}} Zeichen lang sein", "companyNameMinLength": "Firmenname muss mindestens {{minLength}} Zeichen lang sein",
"companyAddressRequired": "Firmenaddresse ist erforderlich",
"companyAddressMinLength": "Firmenaddresse muss mindestens {{minLength}} Zeichen lang sein",
"companyEmailRequired": "Firmen E-Mail ist erforderlich",
"companyEmailInvalid": "Firmen E-Mail ist ungültig",
"companyPhoneNumberRequired": "Firmen Telefonnummer ist erforderlich",
"companyPhoneNumberInvalid": "Firmen Telefonnummer ist ungültig",
"recaptchaRequired": "Bitte bestätigen Sie, dass Sie kein Roboter sind", "recaptchaRequired": "Bitte bestätigen Sie, dass Sie kein Roboter sind",
"privacyPolicyRequired": "Bitte akzeptieren Sie die Datenschutzbestimmungen" "privacyPolicyRequired": "Bitte akzeptieren Sie die Datenschutzbestimmungen"
}, },

View File

@ -43,8 +43,10 @@
"calendarUsingPrimaryCalendar": "Using primary calendar", "calendarUsingPrimaryCalendar": "Using primary calendar",
"companyName": "Company name", "companyName": "Company name",
"companyNamePlaceholder": "Enter your company name", "companyNamePlaceholder": "Enter your company name",
"companyNameInfo": "The company name is displayed in emails and on the booking page.",
"companyAddress": "Company address", "companyAddress": "Company address",
"companyAddressPlaceholder": "Enter your company address", "companyAddressPlaceholder": "Musterstraße 1\n12345 Musterstadt",
"companyAddressInfo": "The company address is displayed in emails and on the booking page.",
"companyEmail": "Company email", "companyEmail": "Company email",
"companyEmailPlaceholder": "Enter your company email", "companyEmailPlaceholder": "Enter your company email",
"companyPhoneNumber": "Company phone", "companyPhoneNumber": "Company phone",
@ -62,6 +64,12 @@
"calendarMinEarliestBookingTimeRequired": "Please enter the min. earliest booking time", "calendarMinEarliestBookingTimeRequired": "Please enter the min. earliest booking time",
"companyNameRequired": "Please enter the company name", "companyNameRequired": "Please enter the company name",
"companyNameMinLength": "Company name must be at least {{minLength}} characters", "companyNameMinLength": "Company name must be at least {{minLength}} characters",
"companyAddressRequired": "Please enter the company address",
"companyAddressMinLength": "Company address must be at least {{minLength}} characters",
"companyEmailRequired": "Please enter the company email",
"companyEmailInvalid": "Please enter a valid company email",
"companyPhoneNumberRequired": "Please enter the company phone number",
"companyPhoneNumberMinLength": "Company phone number must be at least {{minLength}} characters",
"recaptchaRequired": "Please confirm that you are not a robot", "recaptchaRequired": "Please confirm that you are not a robot",
"privacyPolicyRequired": "Please accept the privacy policy" "privacyPolicyRequired": "Please accept the privacy policy"
}, },

View File

@ -181,17 +181,42 @@ export function MyCompanyNameFormInput({ showSkeleton }) {
<MyFormInput <MyFormInput
formItemName="companyName" formItemName="companyName"
label={t("common.companyName")} label={t("common.companyName")}
propsFormItem={{ tooltip: t("common.companyNameInfo") }}
inputPlaceholder={t("common.companyNamePlaceholder")} inputPlaceholder={t("common.companyNamePlaceholder")}
showSkeleton={showSkeleton} showSkeleton={showSkeleton}
ruleMessageValueRequired={t("common.inputRules.companyNameRequired")} ruleMessageValueRequired={t("common.inputRules.companyNameRequired")}
ruleMessageValueMinLengthRequired={t( ruleMessageValueMinLengthRequired={t(
"common.inputRules.companyNameMinLength", "common.inputRules.companyNameMinLength",
{ {
minLength: Constants.GLOBALS.MIN_COMPANY_NAME_LENGTH, minLength: Constants.GLOBALS.MIN_STORE_SETTING_COMPANY_NAME_LENGTH,
} }
)} )}
minLength={Constants.GLOBALS.MIN_COMPANY_NAME_LENGTH} minLength={Constants.GLOBALS.MIN_STORE_SETTING_COMPANY_NAME_LENGTH}
maxLength={Constants.GLOBALS.MAX_COMPANY_NAME_LENGTH} maxLength={Constants.GLOBALS.MAX_STORE_SETTING_COMPANY_NAME_LENGTH}
/>
);
}
export function MyCompanyAddressFormInput({ showSkeleton }) {
const { t } = useTranslation();
return (
<MyFormInput
formItemName="companyAddress"
propsFormItem={{ tooltip: t("common.companyAddressInfo") }}
label={t("common.companyAddress")}
inputType="textarea"
inputPlaceholder={t("common.companyAddressPlaceholder")}
showSkeleton={showSkeleton}
ruleMessageValueRequired={t("common.inputRules.companyAddressRequired")}
ruleMessageValueMinLengthRequired={t(
"common.inputRules.companyAddressMinLength",
{
minLength: Constants.GLOBALS.MIN_STORE_SETTING_COMPANY_ADDRESS_LENGTH,
}
)}
minLength={Constants.GLOBALS.MIN_STORE_SETTING_COMPANY_ADDRESS_LENGTH}
maxLength={Constants.GLOBALS.MAX_STORE_SETTING_COMPANY_ADDRESS_LENGTH}
/> />
); );
} }

View File

@ -24,25 +24,22 @@ import {
showUnkownErrorNotification, showUnkownErrorNotification,
} from "../../utils"; } from "../../utils";
import { import {
MyCompanyAddressFormInput,
MyCompanyNameFormInput, MyCompanyNameFormInput,
MyEmailFormInput, MyEmailFormInput,
MyPasswordFormInput, MyPasswordFormInput,
MyUsernameFormInput, MyUsernameFormInput,
} from "../../Components/MyFormInputs"; } from "../../Components/MyFormInputs";
import { import { MyRecaptcha, PrivacyPolicyCheckbox } from ".";
MyRecaptcha,
PendingEmailVerification,
PrivacyPolicyCheckbox,
} from ".";
import MyAppLogo from "../../Components/MyAppLogo"; import MyAppLogo from "../../Components/MyAppLogo";
import { CheckOutlined } from "@ant-design/icons"; import { CheckOutlined } from "@ant-design/icons";
import { RequestState } from "../../Components/MyRequestStateItem"; import { RequestState } from "../../Components/MyRequestStateItem";
/*
const SignUpStep = { const SignUpStep = {
SIGN_UP: 1, SIGN_UP: 1,
PENDING_EMAIL_VERIFICATION: 2, PENDING_EMAIL_VERIFICATION: 2,
}; };
*/
export default function SignUp({ paymentPlan }) { export default function SignUp({ paymentPlan }) {
const [notificationApi, notificationContextHolder] = const [notificationApi, notificationContextHolder] =
notification.useNotification(); notification.useNotification();
@ -51,11 +48,11 @@ export default function SignUp({ paymentPlan }) {
const navigate = useNavigate(); const navigate = useNavigate();
const [form] = Form.useForm(); const [form] = Form.useForm();
const [step, setStep] = useState(SignUpStep.SIGN_UP); //const [step, setStep] = useState(SignUpStep.SIGN_UP);
/*
if (step === SignUpStep.PENDING_EMAIL_VERIFICATION) { if (step === SignUpStep.PENDING_EMAIL_VERIFICATION) {
return <PendingEmailVerification />; return <PendingEmailVerification />;
} } */
return ( return (
<> <>
@ -119,8 +116,10 @@ function AccountDetails({ t, form }) {
> >
<MyCompanyNameFormInput /> <MyCompanyNameFormInput />
<MyCompanyAddressFormInput />
<MyUsernameFormInput <MyUsernameFormInput
propsFormItem={{ extra: t("common.usernameInfo") }} propsFormItem={{ tooltip: t("common.usernameInfo") }}
/> />
<MyEmailFormInput hasFeedback={true} /> <MyEmailFormInput hasFeedback={true} />
@ -209,6 +208,7 @@ function CostSummary({ notificationApi, paymentPlan, form }) {
recaptcha: recaptchaValueRef.current, recaptcha: recaptchaValueRef.current,
paymentPlan: paymentPlan, paymentPlan: paymentPlan,
paymentInterval: segmentedValue, paymentInterval: segmentedValue,
companyAddress: values.companyAddress,
}, },
notificationApi: notificationApi, notificationApi: notificationApi,
t: t, t: t,

View File

@ -1,9 +1,15 @@
import { useEffect, useRef, useState } from "react"; import { useEffect, useRef, useState } from "react";
import { myFetch, showInputsInvalidNotification } from "../../../utils"; import {
Constants,
myFetch,
showInputsInvalidNotification,
} from "../../../utils";
import { useParams } from "react-router-dom"; import { useParams } from "react-router-dom";
import { Card, Form, notification } from "antd"; import { Card, Form, notification } from "antd";
import { import {
MyCompanyAddressFormInput,
MyCompanyNameFormInput, MyCompanyNameFormInput,
MyEmailFormInput,
MyFormInput, MyFormInput,
} from "../../../Components/MyFormInputs"; } from "../../../Components/MyFormInputs";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
@ -28,7 +34,7 @@ export default function StoreSettings() {
const companyName = Form.useWatch("companyName", form); const companyName = Form.useWatch("companyName", form);
const phoneNumber = Form.useWatch("phoneNumber", form); const phoneNumber = Form.useWatch("phoneNumber", form);
const email = Form.useWatch("email", form); const email = Form.useWatch("email", form);
const address = Form.useWatch("address", form); const address = Form.useWatch("companyAddress", form);
useEffect(() => { useEffect(() => {
myFetch({ myFetch({
@ -42,7 +48,7 @@ export default function StoreSettings() {
companyName: data.store.name, companyName: data.store.name,
phoneNumber: data.store.phone_number, phoneNumber: data.store.phone_number,
email: data.store.email, email: data.store.email,
address: data.store.address, companyAddress: data.store.address,
}); });
setIsRequesting(false); setIsRequesting(false);
@ -118,6 +124,12 @@ export default function StoreSettings() {
inputPlaceholder={t("common.companyPhoneNumberPlaceholder")} inputPlaceholder={t("common.companyPhoneNumberPlaceholder")}
showSkeleton={isRequesting} showSkeleton={isRequesting}
inputNotRequired inputNotRequired
minLength={
Constants.GLOBALS.MIN_STORE_SETTING_COMPANY_PHONE_NUMBER_LENGTH
}
maxLength={
Constants.GLOBALS.MAX_STORE_SETTING_COMPANY_PHONE_NUMBER_LENGTH
}
/> />
<MyFormInput <MyFormInput
@ -126,16 +138,18 @@ export default function StoreSettings() {
inputPlaceholder={t("common.companyEmailPlaceholder")} inputPlaceholder={t("common.companyEmailPlaceholder")}
showSkeleton={isRequesting} showSkeleton={isRequesting}
inputNotRequired inputNotRequired
minLength={Constants.GLOBALS.MIN_EMAIL_LENGTH}
maxLength={Constants.GLOBALS.MAX_EMAIL_LENGTH}
inputType="email"
formItemRules={[
{
type: "email",
message: t("common.inputRules.emailInvalid"),
},
]}
/> />
<MyFormInput <MyCompanyAddressFormInput showSkeleton={isRequesting} />
formItemName="address"
label={t("common.companyAddress")}
inputType="textarea"
inputPlaceholder={t("common.companyAddressPlaceholder")}
showSkeleton={isRequesting}
inputNotRequired
/>
</Form> </Form>
</Card> </Card>
</> </>

View File

@ -78,6 +78,12 @@ export const Constants = {
EMAIL_REGEX: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/, EMAIL_REGEX: /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/,
MIN_PASSWORD_LENGTH: 8, MIN_PASSWORD_LENGTH: 8,
MAX_PASSWORD_LENGTH: 64, MAX_PASSWORD_LENGTH: 64,
MIN_STORE_SETTING_COMPANY_NAME_LENGTH: 2,
MAX_STORE_SETTING_COMPANY_NAME_LENGTH: 64,
MIN_STORE_SETTING_COMPANY_PHONE_NUMBER_LENGTH: 0,
MAX_STORE_SETTING_COMPANY_PHONE_NUMBER_LENGTH: 64,
MIN_STORE_SETTING_COMPANY_ADDRESS_LENGTH: 2,
MAX_STORE_SETTING_COMPANY_ADDRESS_LENGTH: 250,
MIN_STORE_SERVICE_NAME_LENGTH: 3, MIN_STORE_SERVICE_NAME_LENGTH: 3,
MAX_STORE_SERVICE_NAME_LENGTH: 64, MAX_STORE_SERVICE_NAME_LENGTH: 64,
MIN_STORE_SERVICE_ACTIVITY_NAME_LENGTH: 3, MIN_STORE_SERVICE_ACTIVITY_NAME_LENGTH: 3,
@ -92,8 +98,6 @@ export const Constants = {
MAX_CALENDAR_EARLIEST_BOOKING_TIME: 60 * 24, // 24 hours in minutes MAX_CALENDAR_EARLIEST_BOOKING_TIME: 60 * 24, // 24 hours in minutes
MIN_FEEDBACK_LENGTH: 10, MIN_FEEDBACK_LENGTH: 10,
MAX_FEEDBACK_LENGTH: 1024, MAX_FEEDBACK_LENGTH: 1024,
MIN_COMPANY_NAME_LENGTH: 3,
MAX_COMPANY_NAME_LENGTH: 64,
}, },
DELAY_EMAIL_CHECK: 250, DELAY_EMAIL_CHECK: 250,
CLARITY_PROJECT_ID: process.env.REACT_APP_CLARITY_PROJECT_ID, CLARITY_PROJECT_ID: process.env.REACT_APP_CLARITY_PROJECT_ID,