2021-09-24 09:17:58 +00:00
|
|
|
import React, { memo, useState } from "react";
|
2021-09-12 16:36:43 +00:00
|
|
|
import styled from "styled-components";
|
2021-09-24 09:17:58 +00:00
|
|
|
import { ASSETS_CDN_URL } from "constants/ThirdPartyConstants";
|
2021-09-12 16:36:43 +00:00
|
|
|
import { useEffect } from "react";
|
2021-09-24 09:17:58 +00:00
|
|
|
import { playWelcomeAnimation } from "utils/helpers";
|
|
|
|
|
import {
|
|
|
|
|
createMessage,
|
|
|
|
|
WELCOME_BODY,
|
|
|
|
|
WELCOME_HEADER,
|
2022-02-11 18:08:46 +00:00
|
|
|
} from "@appsmith/constants/messages";
|
2021-10-21 05:36:17 +00:00
|
|
|
import NonSuperUserForm, { SuperUserForm } from "./GetStarted";
|
2023-04-10 07:02:31 +00:00
|
|
|
import { getAssetUrl } from "@appsmith/utils/airgapHelpers";
|
2021-09-12 16:36:43 +00:00
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const LandingPageWrapper = styled.div<{ hide: boolean }>`
|
|
|
|
|
width: ${(props) => props.theme.pageContentWidth}px;
|
2021-09-12 16:36:43 +00:00
|
|
|
height: 100vh;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: center;
|
|
|
|
|
align-items: center;
|
2021-09-24 09:17:58 +00:00
|
|
|
margin: 0 auto;
|
|
|
|
|
opacity: ${(props) => (props.hide ? 0 : 1)};
|
|
|
|
|
`;
|
|
|
|
|
|
|
|
|
|
const LandingPageContent = styled.div`
|
|
|
|
|
width: 100%;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
2021-09-17 10:01:42 +00:00
|
|
|
position: relative;
|
|
|
|
|
z-index: 100;
|
2021-09-12 16:36:43 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const StyledTextBanner = styled.div`
|
|
|
|
|
min-width: ${(props) => props.theme.pageContentWidth * 0.55}px;
|
|
|
|
|
padding-left: 64px;
|
2021-09-12 16:36:43 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const StyledBannerHeader = styled.h1`
|
|
|
|
|
font-family: "Paytone One", sans-serif;
|
|
|
|
|
font-size: 72px;
|
|
|
|
|
margin: 0px 0px;
|
|
|
|
|
`;
|
2021-09-12 16:36:43 +00:00
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const StyledBannerBody = styled.p`
|
|
|
|
|
font-family: "Montserrat", sans-serif;
|
|
|
|
|
font-size: 24px;
|
|
|
|
|
margin: ${(props) => props.theme.spaces[7]}px 0px;
|
|
|
|
|
width: 400px;
|
2021-09-12 16:36:43 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const StyledImageBanner = styled.div`
|
|
|
|
|
min-width: ${(props) => props.theme.pageContentWidth * 0.45}px;
|
2021-09-12 16:36:43 +00:00
|
|
|
`;
|
|
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const getWelcomeImage = () => `${ASSETS_CDN_URL}/welcome-banner.svg`;
|
2021-09-12 16:36:43 +00:00
|
|
|
|
|
|
|
|
type LandingPageProps = {
|
2021-10-21 05:36:17 +00:00
|
|
|
onGetStarted?: (role?: string, useCase?: string) => void;
|
|
|
|
|
forSuperUser: boolean;
|
2021-09-12 16:36:43 +00:00
|
|
|
};
|
|
|
|
|
|
2021-09-24 09:17:58 +00:00
|
|
|
const WELCOME_PAGE_ANIMATION_CONTAINER = "welcome-page-animation-container";
|
|
|
|
|
|
|
|
|
|
const includeFonts = () => {
|
|
|
|
|
const preconnectGoogleapis = document.createElement("link");
|
|
|
|
|
preconnectGoogleapis.rel = "preconnect";
|
|
|
|
|
preconnectGoogleapis.href = "https://fonts.googleapis.com";
|
|
|
|
|
document.head.appendChild(preconnectGoogleapis);
|
|
|
|
|
|
|
|
|
|
const preconnectGstatic = document.createElement("link") as any;
|
|
|
|
|
preconnectGstatic.rel = "preconnect";
|
|
|
|
|
preconnectGstatic.href = "https://fonts.gstatic.com";
|
|
|
|
|
preconnectGstatic.crossorigin = "crossorigin";
|
|
|
|
|
document.head.appendChild(preconnectGstatic);
|
|
|
|
|
|
|
|
|
|
const fonts = document.createElement("link");
|
|
|
|
|
fonts.rel = "stylesheet";
|
|
|
|
|
fonts.href =
|
|
|
|
|
"https://fonts.googleapis.com/css2?family=Montserrat&family=Paytone+One&display=swap";
|
|
|
|
|
document.head.appendChild(fonts);
|
|
|
|
|
};
|
|
|
|
|
|
2021-10-21 05:36:17 +00:00
|
|
|
function Banner() {
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<StyledBannerHeader>{createMessage(WELCOME_HEADER)}</StyledBannerHeader>
|
|
|
|
|
<StyledBannerBody>{createMessage(WELCOME_BODY)}</StyledBannerBody>
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2021-09-12 16:36:43 +00:00
|
|
|
export default memo(function LandingPage(props: LandingPageProps) {
|
2021-09-24 09:17:58 +00:00
|
|
|
const [fontsInjected, setFontsInjected] = useState(false);
|
2021-09-12 16:36:43 +00:00
|
|
|
useEffect(() => {
|
2021-09-24 09:17:58 +00:00
|
|
|
includeFonts();
|
|
|
|
|
playWelcomeAnimation(`#${WELCOME_PAGE_ANIMATION_CONTAINER}`);
|
|
|
|
|
//wait for the fonts to be loaded
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setFontsInjected(true);
|
|
|
|
|
}, 100);
|
2021-09-12 16:36:43 +00:00
|
|
|
}, []);
|
|
|
|
|
return (
|
2021-09-24 09:17:58 +00:00
|
|
|
<LandingPageWrapper
|
2022-05-04 08:43:02 +00:00
|
|
|
data-testid={"welcome-page"}
|
2021-09-24 09:17:58 +00:00
|
|
|
hide={!fontsInjected}
|
|
|
|
|
id={WELCOME_PAGE_ANIMATION_CONTAINER}
|
|
|
|
|
>
|
2021-09-12 16:36:43 +00:00
|
|
|
<LandingPageContent>
|
2021-09-24 09:17:58 +00:00
|
|
|
<StyledTextBanner>
|
2021-10-21 05:36:17 +00:00
|
|
|
<Banner />
|
|
|
|
|
{props.forSuperUser ? (
|
|
|
|
|
<SuperUserForm onGetStarted={props.onGetStarted} />
|
|
|
|
|
) : (
|
|
|
|
|
<NonSuperUserForm onGetStarted={props.onGetStarted} />
|
|
|
|
|
)}
|
2021-09-24 09:17:58 +00:00
|
|
|
</StyledTextBanner>
|
|
|
|
|
<StyledImageBanner>
|
2023-04-10 07:02:31 +00:00
|
|
|
<img src={getAssetUrl(getWelcomeImage())} />
|
2021-09-24 09:17:58 +00:00
|
|
|
</StyledImageBanner>
|
2021-09-12 16:36:43 +00:00
|
|
|
</LandingPageContent>
|
|
|
|
|
</LandingPageWrapper>
|
|
|
|
|
);
|
|
|
|
|
});
|