diff --git a/packages/webapp/src/components/App.tsx b/packages/webapp/src/components/App.tsx index 338fefc02..98242e9db 100644 --- a/packages/webapp/src/components/App.tsx +++ b/packages/webapp/src/components/App.tsx @@ -20,6 +20,7 @@ import { queryConfig } from '../hooks/query/base'; import { EnsureUserEmailVerified } from './Guards/EnsureUserEmailVerified'; import { EnsureAuthNotAuthenticated } from './Guards/EnsureAuthNotAuthenticated'; import { EnsureUserEmailNotVerified } from './Guards/EnsureUserEmailNotVerified'; +import { EnsureOneClickDemoAccountEnabled } from '@/containers/OneClickDemo/EnsureOneClickDemoAccountEnabled'; const EmailConfirmation = LazyLoader({ loader: () => import('@/containers/Authentication/EmailConfirmation'), @@ -40,9 +41,11 @@ function AppInsider({ history }) { - - - + + + + + diff --git a/packages/webapp/src/config.ts b/packages/webapp/src/config.ts new file mode 100644 index 000000000..1d2b73985 --- /dev/null +++ b/packages/webapp/src/config.ts @@ -0,0 +1,6 @@ +export const Config = { + oneClickDemo: { + enable: process.env.REACT_APP_ONE_CLICK_DEMO_ENABLE === 'true', + demoUrl: process.env.REACT_APP_DEMO_ACCOUNT_URL || '', + }, +}; diff --git a/packages/webapp/src/containers/OneClickDemo/EnsureOneClickDemoAccountEnabled.tsx b/packages/webapp/src/containers/OneClickDemo/EnsureOneClickDemoAccountEnabled.tsx new file mode 100644 index 000000000..7b224372f --- /dev/null +++ b/packages/webapp/src/containers/OneClickDemo/EnsureOneClickDemoAccountEnabled.tsx @@ -0,0 +1,20 @@ +import React from 'react'; +import { Redirect } from 'react-router-dom'; +import { Config } from '@/config'; + +interface EnsureOneClickDemoAccountEnabledProps { + children: React.ReactNode; + redirectTo?: string; +} + +export const EnsureOneClickDemoAccountEnabled = ({ + children, + redirectTo = '/', +}: EnsureOneClickDemoAccountEnabledProps) => { + const enabeld = Config.oneClickDemo.enable || false; + + if (!enabeld) { + return ; + } + return <>{children}; +}; diff --git a/packages/webapp/src/containers/OneClickDemo/OneClickDemoPage.tsx b/packages/webapp/src/containers/OneClickDemo/OneClickDemoPage.tsx index 8c55da367..cc200ce52 100644 --- a/packages/webapp/src/containers/OneClickDemo/OneClickDemoPage.tsx +++ b/packages/webapp/src/containers/OneClickDemo/OneClickDemoPage.tsx @@ -18,10 +18,10 @@ export default function OneClickDemoPage() { mutateAsync: oneClickDemoSignIn, isLoading: isOneclickDemoSigningIn, } = useOneClickDemoSignin(); - const [buildJobId, setBuildJobId] = useState(''); // Job states. const [demoId, setDemoId] = useState(''); + const [buildJobId, setBuildJobId] = useState(''); const [isJobDone, setIsJobDone] = useState(false); const { diff --git a/packages/webapp/src/containers/Setup/SetupLeftSection.module.scss b/packages/webapp/src/containers/Setup/SetupLeftSection.module.scss new file mode 100644 index 000000000..e30df69ce --- /dev/null +++ b/packages/webapp/src/containers/Setup/SetupLeftSection.module.scss @@ -0,0 +1,22 @@ +.demoButton { + width: 100%; + margin-bottom: 2rem; + background: transparent; + color: rgba(255, 255, 255, 0.75); + border: 1px solid rgb(255, 255, 255, 0.3); + padding: 10px; + font-size: 13px; + font-weight: 500; + border-radius: 5px; + cursor: pointer; + transition: border 0.15s ease-in-out, color 0.15s ease-in-out; + + &:hover { + color: rgba(255, 255, 255, 0.95); + border: 1px solid rgb(255, 255, 255, 0.6); + } +} +.demoButtonLabel{ + color: rgba(255, 255, 255, 0.75); + font-size: 13px; +} \ No newline at end of file diff --git a/packages/webapp/src/containers/Setup/SetupLeftSection.tsx b/packages/webapp/src/containers/Setup/SetupLeftSection.tsx index 300103ed7..6ec091d52 100644 --- a/packages/webapp/src/containers/Setup/SetupLeftSection.tsx +++ b/packages/webapp/src/containers/Setup/SetupLeftSection.tsx @@ -1,9 +1,13 @@ // @ts-nocheck import React from 'react'; -import { Icon, For, FormattedMessage as T } from '@/components'; +import { Icon, For, FormattedMessage as T, Stack } from '@/components'; import { getFooterLinks } from '@/constants/footerLinks'; import { useAuthActions } from '@/hooks/state'; +import style from './SetupLeftSection.module.scss'; +import { Text } from '@blueprintjs/core'; +import { Config } from '@/config'; +import { useHistory } from 'react-router-dom'; /** * Footer item link. @@ -25,8 +29,21 @@ function SetupLeftSectionFooter() { // Retrieve the footer links. const footerLinks = getFooterLinks(); + const handleDemoBtnClick = () => { + window.open(Config.oneClickDemo.demoUrl); + }; + return (
+ {Config.oneClickDemo.demoUrl && ( + + Not Now? + + + )} +