2021-09-12 16:36:43 +00:00
|
|
|
import React from "react";
|
|
|
|
|
import styled from "styled-components";
|
2022-04-13 10:07:11 +00:00
|
|
|
import { Field } from "redux-form";
|
2021-09-12 16:36:43 +00:00
|
|
|
import {
|
2021-10-21 05:36:17 +00:00
|
|
|
DropdownWrapper,
|
2021-09-12 16:36:43 +00:00
|
|
|
FormBodyWrapper,
|
|
|
|
|
FormHeaderIndex,
|
|
|
|
|
FormHeaderLabel,
|
|
|
|
|
FormHeaderWrapper,
|
2021-10-21 05:36:17 +00:00
|
|
|
withDropdown,
|
2021-09-12 16:36:43 +00:00
|
|
|
} from "./common";
|
|
|
|
|
import StyledFormGroup from "components/ads/formFields/FormGroup";
|
2021-10-06 06:11:25 +00:00
|
|
|
import {
|
|
|
|
|
createMessage,
|
|
|
|
|
WELCOME_FORM_EMAIL_ID,
|
|
|
|
|
WELCOME_FORM_FULL_NAME,
|
|
|
|
|
WELCOME_FORM_CREATE_PASSWORD,
|
|
|
|
|
WELCOME_FORM_VERIFY_PASSWORD,
|
|
|
|
|
WELCOME_FORM_ROLE_DROPDOWN,
|
|
|
|
|
WELCOME_FORM_ROLE,
|
|
|
|
|
WELCOME_FORM_USE_CASE,
|
2022-02-19 06:26:10 +00:00
|
|
|
WELCOME_FORM_CUSTOM_USE_CASE,
|
2021-10-06 06:11:25 +00:00
|
|
|
WELCOME_FORM_HEADER,
|
2022-04-13 10:07:11 +00:00
|
|
|
WELCOME_FORM_ROLE_DROPDOWN_PLACEHOLDER,
|
|
|
|
|
WELCOME_FORM_USE_CASE_PLACEHOLDER,
|
2022-02-11 18:08:46 +00:00
|
|
|
} from "@appsmith/constants/messages";
|
2022-10-05 11:06:49 +00:00
|
|
|
import FormTextField from "components/utils/ReduxFormTextField";
|
2022-04-13 10:07:11 +00:00
|
|
|
import { SetupFormProps } from "./SetupForm";
|
2021-09-12 16:36:43 +00:00
|
|
|
import { ButtonWrapper } from "pages/Applications/ForkModalStyles";
|
2022-08-22 05:09:39 +00:00
|
|
|
import { Button, Category, Size } from "design-system";
|
2021-10-21 05:36:17 +00:00
|
|
|
import { roleOptions, useCaseOptions } from "./constants";
|
2021-09-12 16:36:43 +00:00
|
|
|
|
|
|
|
|
const DetailsFormWrapper = styled.div`
|
|
|
|
|
width: 100%;
|
|
|
|
|
position: relative;
|
|
|
|
|
padding-left: ${(props) => props.theme.spaces[17] * 2}px;
|
|
|
|
|
padding-right: ${(props) => props.theme.spaces[4]}px;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const StyledFormBodyWrapper = styled(FormBodyWrapper)`
|
|
|
|
|
width: 260px;
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
export default function DetailsForm(
|
2022-04-13 10:07:11 +00:00
|
|
|
props: SetupFormProps & { onNext?: () => void },
|
2021-09-12 16:36:43 +00:00
|
|
|
) {
|
|
|
|
|
const ref = React.createRef<HTMLDivElement>();
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<DetailsFormWrapper ref={ref}>
|
2021-11-26 06:16:08 +00:00
|
|
|
<FormHeaderWrapper className="relative flex-col items-start">
|
|
|
|
|
<FormHeaderIndex className="absolute -left-6">1.</FormHeaderIndex>
|
2021-10-06 06:11:25 +00:00
|
|
|
<FormHeaderLabel>{createMessage(WELCOME_FORM_HEADER)}</FormHeaderLabel>
|
2021-09-12 16:36:43 +00:00
|
|
|
</FormHeaderWrapper>
|
|
|
|
|
<StyledFormBodyWrapper>
|
2021-10-29 09:10:30 +00:00
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-full-name"
|
|
|
|
|
label={createMessage(WELCOME_FORM_FULL_NAME)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<FormTextField
|
|
|
|
|
autoFocus
|
|
|
|
|
name="name"
|
|
|
|
|
placeholder="John Doe"
|
|
|
|
|
type="text"
|
|
|
|
|
/>
|
|
|
|
|
</StyledFormGroup>
|
2021-10-29 09:10:30 +00:00
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-email"
|
|
|
|
|
label={createMessage(WELCOME_FORM_EMAIL_ID)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<FormTextField
|
|
|
|
|
name="email"
|
|
|
|
|
placeholder="How can we reach you?"
|
|
|
|
|
type="email"
|
|
|
|
|
/>
|
|
|
|
|
</StyledFormGroup>
|
2021-10-29 09:10:30 +00:00
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-password"
|
|
|
|
|
label={createMessage(WELCOME_FORM_CREATE_PASSWORD)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<FormTextField
|
|
|
|
|
name="password"
|
|
|
|
|
placeholder="Make it strong!"
|
|
|
|
|
type="password"
|
|
|
|
|
/>
|
|
|
|
|
</StyledFormGroup>
|
2021-10-29 09:10:30 +00:00
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-verify-password"
|
|
|
|
|
label={createMessage(WELCOME_FORM_VERIFY_PASSWORD)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<FormTextField
|
2022-04-13 10:07:11 +00:00
|
|
|
data-testid="verifyPassword"
|
2021-09-12 16:36:43 +00:00
|
|
|
name="verifyPassword"
|
|
|
|
|
placeholder="Type correctly"
|
|
|
|
|
type="password"
|
|
|
|
|
/>
|
|
|
|
|
</StyledFormGroup>
|
2021-10-29 09:10:30 +00:00
|
|
|
<DropdownWrapper
|
|
|
|
|
className="t--welcome-form-role-dropdown"
|
|
|
|
|
label={createMessage(WELCOME_FORM_ROLE_DROPDOWN)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<Field
|
|
|
|
|
asyncControl
|
2021-10-21 05:36:17 +00:00
|
|
|
component={withDropdown(roleOptions, "260px")}
|
2021-09-12 16:36:43 +00:00
|
|
|
name="role"
|
2022-04-13 10:07:11 +00:00
|
|
|
placeholder={createMessage(WELCOME_FORM_ROLE_DROPDOWN_PLACEHOLDER)}
|
2021-09-12 16:36:43 +00:00
|
|
|
type="text"
|
|
|
|
|
/>
|
|
|
|
|
</DropdownWrapper>
|
|
|
|
|
{props.role == "other" && (
|
2021-10-29 09:10:30 +00:00
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-role-input"
|
|
|
|
|
label={createMessage(WELCOME_FORM_ROLE)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<FormTextField name="role_name" placeholder="" type="text" />
|
|
|
|
|
</StyledFormGroup>
|
|
|
|
|
)}
|
2021-10-29 09:10:30 +00:00
|
|
|
<DropdownWrapper
|
|
|
|
|
className="t--welcome-form-role-usecase"
|
|
|
|
|
label={createMessage(WELCOME_FORM_USE_CASE)}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<Field
|
|
|
|
|
asyncControl
|
2021-10-21 05:36:17 +00:00
|
|
|
component={withDropdown(useCaseOptions, "260px")}
|
2021-09-12 16:36:43 +00:00
|
|
|
name="useCase"
|
2022-04-13 10:07:11 +00:00
|
|
|
placeholder={createMessage(WELCOME_FORM_USE_CASE_PLACEHOLDER)}
|
2021-09-12 16:36:43 +00:00
|
|
|
type="text"
|
|
|
|
|
/>
|
|
|
|
|
</DropdownWrapper>
|
2022-02-19 06:26:10 +00:00
|
|
|
{props.useCase == "other" && (
|
|
|
|
|
<StyledFormGroup
|
|
|
|
|
className="t--welcome-form-use-case-input"
|
|
|
|
|
label={createMessage(WELCOME_FORM_CUSTOM_USE_CASE)}
|
|
|
|
|
>
|
|
|
|
|
<FormTextField name="custom_useCase" placeholder="" type="text" />
|
|
|
|
|
</StyledFormGroup>
|
|
|
|
|
)}
|
2021-09-12 16:36:43 +00:00
|
|
|
<ButtonWrapper>
|
|
|
|
|
<Button
|
|
|
|
|
category={Category.tertiary}
|
2021-10-29 09:10:30 +00:00
|
|
|
className="t--welcome-form-next-button"
|
2021-09-12 16:36:43 +00:00
|
|
|
disabled={props.invalid}
|
|
|
|
|
onClick={props.onNext}
|
|
|
|
|
size={Size.medium}
|
|
|
|
|
tag="button"
|
|
|
|
|
text="Next"
|
|
|
|
|
type="button"
|
|
|
|
|
/>
|
|
|
|
|
</ButtonWrapper>
|
|
|
|
|
</StyledFormBodyWrapper>
|
|
|
|
|
</DetailsFormWrapper>
|
|
|
|
|
);
|
|
|
|
|
}
|