Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PRESS2-1267-update-fork-new #363

Merged
merged 19 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/**
* Interface Cards with standard design.
*
* @param {Object} root0
* @param {string} root0.title
* @param {string} root0.subtitle
*/

import { useSelect } from '@wordpress/data';
import { store as nfdOnboardingStore } from '../../../store';

const HeadingWithSubHeading = ( { title, subtitle } ) => {
const { brandName } = useSelect( ( select ) => {
return {
brandName: select( nfdOnboardingStore ).getNewfoldBrandName(),
};
} );

return (
<div className="nfd-onboarding-step__heading">
<h2 className="nfd-onboarding-step__heading__title">{ title }</h2>
{ subtitle && (
<h3 className="nfd-onboarding-step__heading__subtitle">
{ subtitle }
<div
style={ {
display: 'inline-flex',
width: '20px',
height: '20px',
marginBottom: '-2px',
backgroundImage: 'var(--nfd-onboarding-icon)',
backgroundSize: 'contain',
} }
></div>
{ brandName }
</h3>
) }
</div>
);
};

export default HeadingWithSubHeading;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
.nfd-onboarding-step {

&__heading {
color: var(--nfd-onboarding-primary);
width: 96%;
margin: 50px 0 50px;
line-height: 1;

&__title {
font-weight: 300;
text-align: center;
color: var(--nfd-onboarding-white);
margin: 35px !important;
font-size: 30px;
}

&__subtitle {
color: var(--nfd-onboarding-white) !important;
font-weight: 300;
text-align: center;
font-size: 20px;
}
}
}
10 changes: 10 additions & 0 deletions src/OnboardingSPA/components/NewfoldInterfaceSkeleton/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,19 @@ import { forwardRef, useEffect } from '@wordpress/element';
import { __unstableUseNavigateRegions as useNavigateRegions } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useMergeRefs } from '@wordpress/compose';
import bgAiImg from '../../static/images/ai_bg.jpg';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use the same way of mentioning in _icons and not directly reference a static file?


function useHTMLClass( className ) {
useEffect( () => {
// eslint-disable-next-line no-undef
const mainImage = new Image();
mainImage.src = bgAiImg;
mainImage.onload = () => {
document.querySelector(
'.nfd-onboarding-skeleton--sitegen'
).style.backgroundImage = `url('${ bgAiImg }')`;
};

const element =
document && document.querySelector( `html:not(.${ className })` );
if ( ! element ) {
Expand Down
11 changes: 11 additions & 0 deletions src/OnboardingSPA/components/NewfoldInterfaceSkeleton/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -197,3 +197,14 @@ html.nfd-interface-interface-skeleton__html-container {
}
}
}

.nfd-onboarding-skeleton--sitegen::after {
content: "";
background-color: #060606;
opacity: 0.75;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
93 changes: 93 additions & 0 deletions src/OnboardingSPA/components/StartOptions/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import { SITEGEN_FLOW } from '../../data/flows/constants';
import { resolveGetDataForFlow } from '../../data/flows';
import { useSelect, useDispatch } from '@wordpress/data';
import { validateFlow } from '../../data/flows/utils';
import { useNavigate } from 'react-router-dom';
import { store as nfdOnboardingStore } from '../../store';

const StartOptions = ( { questionnaire, oldFlow, options } ) => {
const navigate = useNavigate();
const { brandConfig, migrationUrl } = useSelect( ( select ) => {
return {
brandConfig: select( nfdOnboardingStore ).getNewfoldBrandConfig(),
migrationUrl: select( nfdOnboardingStore ).getMigrationUrl(),
};
} );
const {
updateAllSteps,
updateTopSteps,
updateRoutes,
updateDesignRoutes,
updateInitialize,
} = useDispatch( nfdOnboardingStore );

const switchFlow = ( newFlow ) => {
if ( ! validateFlow( brandConfig, newFlow ) ) {
return false;
}
const currentFlow = window.nfdOnboarding.currentFlow;
const getData = resolveGetDataForFlow( newFlow );
const data = getData();
updateAllSteps( data.steps );
updateTopSteps( data?.topSteps );
updateRoutes( data.routes );
updateDesignRoutes( data?.designRoutes );
if ( SITEGEN_FLOW !== currentFlow ) {
window.nfdOnboarding.oldFlow = currentFlow;
}
window.nfdOnboarding.currentFlow = newFlow;
updateInitialize( true );
navigate( data.steps[ 1 ].path );
};
const selectFlow = ( flow ) => {
switch ( flow ) {
case 'onboarding':
return switchFlow( oldFlow );
case 'ai':
return switchFlow( SITEGEN_FLOW );
case 'migration':
return window.open( migrationUrl, '_blank' );
}
};
return (
<div className="">
<p className="nfd-onboarding-sitegen-options__questionnaire">
{ questionnaire }
</p>
<div className="nfd-onboarding-sitegen-options__container">
{ options.map( ( tab, idx ) => {
return (
<div
className="nfd-onboarding-sitegen-options__container__options"
key={ idx }
role="button"
tabIndex={ 0 }
onClick={ () => {
selectFlow( tab.flow );
} }
onKeyDown={ () => {
{
selectFlow( tab.flow );
}
} }
>
<h3 className="nfd-onboarding-sitegen-options__container__heading__title">
{ tab.span && (
<span className="nfd-onboarding-sitegen-options__container__options__span">
{ tab.span }
</span>
) }
{ tab.title }
</h3>
<p className="nfd-onboarding-sitegen-options__container__heading__subtitle">
{ tab.subtitle }
</p>
</div>
);
} ) }
</div>
</div>
);
};

export default StartOptions;
73 changes: 73 additions & 0 deletions src/OnboardingSPA/components/StartOptions/stylesheet.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
.nfd-onboarding-sitegen-options {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

&__questionnaire {
color: var(--nfd-onboarding-white);
font-weight: 500;
text-align: center;
font-size: 18px;
}

&__container {
display: flex;
justify-content: center;
flex-wrap: wrap;

&__options {
flex: 1;
min-width: 310px;
height: 130px;
border: 1px solid #9ca2a7;
text-align: center;
padding: 24px;
padding-top: 50px;
margin: 20px;
border-radius: 16px;
color: var(--nfd-onboarding-white);
font-size: 20px;

&__span {
background-color: var(--nfd-onboarding-white);
color: rgb(6, 0, 0);
padding-right: 6px;
padding-left: 5px;
margin-right: 5px;
border: 1px solid #fff;
border-radius: 8px;
}
}

&__options:hover {
background-color: rgba(6, 0, 0, 0.3);
cursor: pointer;
outline: 2px solid #9ca2a7;
transition: 0.1s linear;
}

&__heading {
color: var(--nfd-onboarding-primary);
width: 96%;
margin: 50px 0 50px;
line-height: 1;

&__title {
font-weight: 510;
text-align: center;
color: var(--nfd-onboarding-white);
font-size: 20px;
line-height: 20px;
}

&__subtitle {
color: #e8e8e8 !important;
font-weight: 510;
text-align: center;
font-size: 14px;
line-height: 16.71px;
}
}
}
}
Binary file added src/OnboardingSPA/static/images/ai_bg.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/OnboardingSPA/static/images/ai_bg_low.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
47 changes: 47 additions & 0 deletions src/OnboardingSPA/steps/TheFork/contents.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import { __ } from '@wordpress/i18n';

const getContents = () => {
return {
heading: __( 'Welcome to WordPress', 'wp-module-onboarding' ),
subheading: __( 'powered by ', 'wp-module-onboarding' ),
questionnaire: __(
'Where would you like to start?',
'wp-module-onboarding'
),
options: [
{
title: __( 'Build it myself', 'wp-module-onboarding' ),
subtitle: __(
"We'll stay out of your way.",
'wp-module-onboarding'
),
flow: 'onboarding',
},
{
title: __( ' Website Creator', 'wp-module-onboarding' ),
subtitle: __(
'Custom Al generated content & design.',
'wp-module-onboarding'
),
span: __( 'AI', 'wp-module-onboarding' ),
flow: 'ai',
},
{
title: __( 'Hire a Pro', 'wp-module-onboarding' ),
subtitle: __(
'Leave it to our WordPress experts.',
'wp-module-onboarding'
),
flow: 'migration',
},
],

importtext: __(
'Already have a WordPress site you want to import?',
'wp-module-onboarding'
),
importlink: __( 'http://www.google.com', 'wp-module-onboarding' ),
};
};

export default getContents;
Loading