## Description This PR updates the design of the admin users UI for profiling questions to newer version. Below are the list of changes introduced in this PR : - Deprecated `role` property for the user - Updated components to reuse the similar UI - Updated the background image for the admin setup screen - before <img width="1325" alt="Screenshot 2023-12-21 at 10 29 52 PM" src="https://github.com/appsmithorg/appsmith/assets/7565635/31cc44b6-4534-4a6a-a5e4-1e84b2d5705c"> - after <img width="1295" alt="Screenshot 2023-12-21 at 10 51 58 PM" src="https://github.com/appsmithorg/appsmith/assets/7565635/c4181ded-ec7d-4b68-8b3c-3d0699d00c9c"> - Changed the profiling questions for the admin second page while setting up the instance - before <img width="1273" alt="Screenshot 2023-12-21 at 10 30 16 PM" src="https://github.com/appsmithorg/appsmith/assets/7565635/6f7c5c8c-7f9f-470b-bb2e-3e94b1a741fc"> - after <img width="1311" alt="Screenshot 2023-12-21 at 10 51 48 PM" src="https://github.com/appsmithorg/appsmith/assets/7565635/355c4123-a686-4423-a312-5e67c1c39c13"> #### PR fixes following issue(s) Fixes #29692 > if no issue exists, please create an issue and ask the maintainers about this first > > #### Media > A video or a GIF is preferred. when using Loom, don’t embed because it looks like it’s a GIF. instead, just link to the video > > #### Type of change > Please delete options that are not relevant. - Bug fix (non-breaking change which fixes an issue) - New feature (non-breaking change which adds functionality) - Breaking change (fix or feature that would cause existing functionality to not work as expected) - Chore (housekeeping or task changes that don't impact user perception) - This change requires a documentation update > > > ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [ ] Manual - [ ] JUnit - [ ] Jest - [ ] Cypress > > #### Test Plan > Add Testsmith test cases links that relate to this PR > > #### Issues raised during DP testing > Link issues raised during DP testing for better visiblity and tracking (copy link from comments dropped on this PR) > > > ## Checklist: #### Dev activity - [ ] My code follows the style guidelines of this project - [ ] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [ ] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [ ] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag #### QA activity: - [ ] [Speedbreak features](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#speedbreakers-) have been covered - [ ] Test plan covers all impacted features and [areas of interest](https://github.com/appsmithorg/TestSmith/wiki/Guidelines-for-test-plans#areas-of-interest-) - [ ] Test plan has been peer reviewed by project stakeholders and other QA members - [ ] Manually tested functionality on DP - [ ] We had an implementation alignment call with stakeholders post QA Round 2 - [ ] Cypress test cases have been added and approved by SDET/manual QA - [ ] Added `Test Plan Approved` label after Cypress tests were reviewed - [ ] Added `Test Plan Approved` label after JUnit tests were reviewed <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Introduced a new `UserWelcomeScreen` component to enhance the user onboarding experience. - Added a proficiency level selection to the user setup process. - Updated the use case selection options for a more tailored setup. - **Bug Fixes** - Fixed issues with form input handling for proficiency and use case selections. - **Refactor** - Streamlined the setup process by removing role selection and custom use case input. - Refined the user interface elements related to the setup forms. - **Documentation** - Updated constant messages to align with the new setup flow. - **Style** - Implemented new styles for the `WelcomeBackground` and its components to improve visual appeal. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
115 lines
3.1 KiB
TypeScript
115 lines
3.1 KiB
TypeScript
import React from "react";
|
|
import { Button } from "design-system";
|
|
import {
|
|
WELCOME_FORM_USECASE_FIELD_NAME,
|
|
WELCOME_NON_SUPER_FORM_NAME,
|
|
WELCOME_FORM_PROFICIENCY_LEVEL,
|
|
} from "@appsmith/constants/forms";
|
|
import {
|
|
createMessage,
|
|
WELCOME_ACTION,
|
|
WELCOME_FORM_NON_SUPER_USER_USE_CASE,
|
|
WELCOME_FORM_NON_SUPER_USER_PROFICIENCY_LEVEL,
|
|
WELCOME_FORM_PROFICIENCY_ERROR_MESSAGE,
|
|
WELCOME_FORM_USE_CASE_ERROR_MESSAGE,
|
|
} from "@appsmith/constants/messages";
|
|
import { connect } from "react-redux";
|
|
import type { AppState } from "@appsmith/reducers";
|
|
import type { InjectedFormProps } from "redux-form";
|
|
import { Field, formValueSelector, reduxForm } from "redux-form";
|
|
import styled from "styled-components";
|
|
import { proficiencyOptions, useCaseOptions } from "./constants";
|
|
import RadioButtonGroup from "components/editorComponents/RadioButtonGroup";
|
|
|
|
const ActionContainer = styled.div`
|
|
margin-top: ${(props) => props.theme.spaces[15]}px;
|
|
`;
|
|
|
|
const StyledButton = styled(Button)`
|
|
margin-top: ${(props) => props.theme.spaces[3]}px;
|
|
width: 160px;
|
|
`;
|
|
|
|
interface UserFormProps {
|
|
onGetStarted?: (proficiency?: string, useCase?: string) => void;
|
|
}
|
|
|
|
interface NonSuperUserFormData {
|
|
proficiency?: string;
|
|
useCase?: string;
|
|
}
|
|
|
|
export const Space = styled.div`
|
|
height: 40px;
|
|
`;
|
|
|
|
const validate = (values: any) => {
|
|
const errors: any = {};
|
|
|
|
if (!values.proficiency) {
|
|
errors.proficiency = createMessage(WELCOME_FORM_PROFICIENCY_ERROR_MESSAGE);
|
|
}
|
|
|
|
if (!values.useCase) {
|
|
errors.useCase = createMessage(WELCOME_FORM_USE_CASE_ERROR_MESSAGE);
|
|
}
|
|
|
|
return errors;
|
|
};
|
|
|
|
function NonSuperUserProfilingQuestions(
|
|
props: InjectedFormProps & UserFormProps & NonSuperUserFormData,
|
|
) {
|
|
const onSubmit = (data: NonSuperUserFormData) => {
|
|
props.onGetStarted && props.onGetStarted(data.proficiency, data.useCase);
|
|
};
|
|
|
|
return (
|
|
<form onSubmit={props.handleSubmit(onSubmit)}>
|
|
<Space />
|
|
<Field
|
|
component={RadioButtonGroup}
|
|
label={createMessage(WELCOME_FORM_NON_SUPER_USER_PROFICIENCY_LEVEL)}
|
|
name="proficiency"
|
|
options={proficiencyOptions}
|
|
showSubtitle
|
|
testid="t--user-proficiency"
|
|
/>
|
|
<Space />
|
|
<Field
|
|
component={RadioButtonGroup}
|
|
label={createMessage(WELCOME_FORM_NON_SUPER_USER_USE_CASE)}
|
|
name="useCase"
|
|
options={useCaseOptions}
|
|
testid="t--user-use-case"
|
|
/>
|
|
<ActionContainer>
|
|
<StyledButton
|
|
className="w-full t--get-started-button"
|
|
isDisabled={props.invalid}
|
|
kind="primary"
|
|
renderAs="button"
|
|
size={"md"}
|
|
type="submit"
|
|
>
|
|
{createMessage(WELCOME_ACTION)}
|
|
</StyledButton>
|
|
</ActionContainer>
|
|
</form>
|
|
);
|
|
}
|
|
|
|
const selector = formValueSelector(WELCOME_NON_SUPER_FORM_NAME);
|
|
export default connect((state: AppState) => {
|
|
return {
|
|
proficiency: selector(state, WELCOME_FORM_PROFICIENCY_LEVEL),
|
|
useCase: selector(state, WELCOME_FORM_USECASE_FIELD_NAME),
|
|
};
|
|
}, null)(
|
|
reduxForm<NonSuperUserFormData, UserFormProps>({
|
|
validate,
|
|
form: WELCOME_NON_SUPER_FORM_NAME,
|
|
touchOnBlur: true,
|
|
})(NonSuperUserProfilingQuestions),
|
|
);
|