PluginProbe
Extendify / 2.2.0
Extendify v2.2.0
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Assist / components / dashboard / LaunchCard.jsx

LaunchCard.jsx in Extendify 2.2.0, at src/Assist/components/dashboard/LaunchCard.jsx

110 lines 3.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useState, useEffect } from '@wordpress/element';
2 import { __ } from '@wordpress/i18n';
3 import { useTasksStore } from '@assist/state/tasks';
4
5 const launchSteps = {
6 'website-objective': {
7 step: __('Website Objective', 'extendify-local'),
8 title: __("Let's Start Building Your Website", 'extendify-local'),
9 description: __(
10 'Create a super-fast, beautiful, and fully customized site in minutes with our Site Launcher.',
11 'extendify-local',
12 ),
13 buttonText: __('Add Website Objective', 'extendify-local'),
14 },
15 'site-information': {
16 step: __('Site Industry', 'extendify-local'),
17 title: __('Continue Building Your Website', 'extendify-local'),
18 description: __(
19 'Create a super-fast, beautiful, and fully customized site in minutes with our Site Launcher.',
20 'extendify-local',
21 ),
22 buttonText: __('Add Website Details', 'extendify-local'),
23 },
24 'site-structure': {
25 step: __('Site Structure', 'extendify-local'),
26 title: __('Continue Building Your Website', 'extendify-local'),
27 description: __(
28 'Create a super-fast, beautiful, and fully customized site in minutes with our Site Launcher.',
29 'extendify-local',
30 ),
31 buttonText: __('Pick Your Site Structure', 'extendify-local'),
32 },
33 layout: {
34 step: __('Design', 'extendify-local'),
35 title: __('Continue Building Your Website', 'extendify-local'),
36 description: __(
37 'Create a super-fast, beautiful, and fully customized site in minutes with our Site Launcher.',
38 'extendify-local',
39 ),
40 buttonText: __('Select Site Design', 'extendify-local'),
41 },
42 'page-select': {
43 step: __('Pages', 'extendify-local'),
44 title: __('Continue Building Your Website', 'extendify-local'),
45 description: __(
46 'Create a super-fast, beautiful, and fully customized site in minutes with our Site Launcher.',
47 'extendify-local',
48 ),
49 buttonText: __('Select Site Pages', 'extendify-local'),
50 },
51 };
52
53 const getCurrentLaunchStep = () => {
54 const pageData = JSON.parse(
55 localStorage.getItem(`extendify-pages-${window.extSharedData.siteId}`),
56 ) || { state: {} };
57 const currentPageSlug = pageData?.state?.currentPageSlug;
58
59 // If their last step doesn't exist in our options, just use step 1
60 if (!Object.keys(launchSteps).includes(currentPageSlug)) {
61 return 'website-objective';
62 }
63
64 return currentPageSlug;
65 };
66
67 export const LaunchCard = ({ task }) => {
68 const [currentStep, setCurrentStep] = useState();
69 const { dismissTask } = useTasksStore();
70
71 useEffect(() => {
72 if (currentStep) return;
73 setCurrentStep(getCurrentLaunchStep());
74 }, [currentStep]);
75
76 return (
77 <div className="h-full justify-center overflow-hidden bg-white/95 text-base">
78 <div className="flex h-full flex-col items-center justify-center gap-5 p-7 text-center md:p-8">
79 {task?.htmlBefore()}
80 <div className="flex h-full flex-col items-center justify-center text-center lg:justify-between">
81 <div>
82 <h2 className="mb-2 text-2xl font-semibold leading-10 md:mt-0 lg:text-2xl">
83 {launchSteps[currentStep]?.title}
84 </h2>
85 <p className="m-0 text-sm md:text-base">
86 {launchSteps[currentStep]?.description}
87 </p>
88 </div>
89 <div className="cta mt-6 flex flex-wrap items-center text-sm md:gap-3 lg:mt-3">
90 <a
91 href={`${window.extSharedData.adminUrl}admin.php?page=extendify-launch`}
92 className="min-w-24 cursor-pointer rounded-sm bg-design-main px-4 py-2.5 text-sm font-medium text-design-text no-underline hover:opacity-90">
93 {launchSteps[currentStep]?.buttonText}
94 </a>
95 <button
96 type="button"
97 id="dismiss"
98 onClick={() => {
99 dismissTask('site-builder-launcher');
100 }}
101 className="bg-transparent text-sm text-design-main underline-offset-4 hover:underline">
102 {__('Dismiss', 'extendify-local')}
103 </button>
104 </div>
105 </div>
106 </div>
107 </div>
108 );
109 };
110