PluginProbe ʕ •ᴥ•ʔ
Starter Sites & Templates by Neve / trunk
Starter Sites & Templates by Neve vtrunk
1.4.0 1.3.0 1.2.29 1.2.28 1.2.6 1.2.7 1.2.8 1.2.9 trunk 1.0.10 1.0.11 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.21 1.1.22 1.1.23 1.1.24 1.1.25 1.1.26 1.1.27 1.1.28 1.1.29 1.1.3 1.1.30 1.1.31 1.1.32 1.1.33 1.1.34 1.1.35 1.1.36 1.1.37 1.1.38 1.1.39 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.3 1.2.4 1.2.5
templates-patterns-collection / onboarding / src / Components / Steps / Welcome.js
templates-patterns-collection / onboarding / src / Components / Steps Last commit date
CustomizeSite.js 1 year ago Import.js 2 weeks ago SiteList.js 2 weeks ago Welcome.js 2 years ago
Welcome.js
92 lines
1 /* global tiobDash */
2 import { __ } from '@wordpress/i18n';
3 import { withSelect, withDispatch } from '@wordpress/data';
4 import { useEffect } from '@wordpress/element';
5 import { compose } from '@wordpress/compose';
6 import CategoryButtons from '../CategoryButtons';
7 import Search from '../Search';
8 import { ONBOARDING_CAT } from '../../utils/common';
9 import { track } from '../../utils/rest';
10 import WelcomeMock from '../WelcomeMock';
11
12 const Welcome = ( { trackingId, setTrackingId, fetching, setFetching } ) => {
13 useEffect( () => {
14 if ( trackingId ) {
15 setFetching( false );
16 return;
17 }
18
19 setFetching( true );
20 const data = {
21 slug: 'neve',
22 license_id: tiobDash.license,
23 site: tiobDash.onboarding.homeUrl || '',
24 };
25 track( trackingId, data )
26 .then( ( id ) => {
27 if ( id ) {
28 setTrackingId( id );
29 }
30 } )
31 .catch( ( error ) => {
32 // eslint-disable-next-line no-console
33 console.error( error );
34 } )
35 .finally( () => {
36 setFetching( false );
37 } );
38 }, [] );
39
40 return (
41 <div className="ob-container narrow">
42 { ! fetching ? (
43 <>
44 <h1>
45 { __(
46 'What type of website are you creating?',
47 'templates-patterns-collection'
48 ) }
49 </h1>
50 <p>
51 { __(
52 'Pick a category and we will provide you with relevant suggestions so you can find the starter site that works best for you.',
53 'templates-patterns-collection'
54 ) }
55 </p>
56 <CategoryButtons
57 categories={ ONBOARDING_CAT }
58 style={ { margin: '26px 0' } }
59 />
60 <div className="ob-search-container">
61 <Search
62 label={ __(
63 'Or search for a site',
64 'templates-patterns-collection'
65 ) }
66 />
67 </div>
68 </>
69 ) : (
70 <WelcomeMock />
71 ) }
72 </div>
73 );
74 };
75
76 export default compose(
77 withSelect( ( select ) => {
78 const { getTrackingId, getFetching } = select( 'ti-onboarding' );
79 return {
80 trackingId: getTrackingId(),
81 fetching: getFetching(),
82 };
83 } ),
84 withDispatch( ( dispatch ) => {
85 const { setTrackingId, setFetching } = dispatch( 'ti-onboarding' );
86 return {
87 setTrackingId,
88 setFetching,
89 };
90 } )
91 )( Welcome );
92