Skip to content

Commit 8c73b1a

Browse files
refactor: welcome screen
1 parent be5a6d5 commit 8c73b1a

File tree

2 files changed

+43
-20
lines changed

2 files changed

+43
-20
lines changed

assets/src/dashboard/parts/connect/index.js

Lines changed: 42 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const ConnectLayout = () => {
3939
const [ email, setEmail ] = useState( optimoleDashboardApp.current_user.email );
4040
const [ method, setMethod ] = useState( 'email' );
4141
const [ errors, setErrors ] = useState({});
42+
const [ showBenefits, setShowBenefits ] = useState( false );
4243

4344
const { setAutoConnect } = useDispatch( 'optimole' );
4445

@@ -184,29 +185,50 @@ const ConnectLayout = () => {
184185
/>
185186

186187

187-
<div className="flex py-3 items-center">
188-
<Icon icon="yes-alt" />
189-
<p
190-
className="text-base ml-3 m-0"
191-
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_1 } }
192-
/>
193-
</div>
194-
195-
<div className="flex py-3 items-center">
196-
<Icon icon="yes-alt" />
197-
<p
198-
className="text-base ml-3 m-0"
199-
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_2 } }
188+
<div
189+
onClick={ () => setShowBenefits( ! showBenefits ) }
190+
className="inline-flex items-center bg-light-blue px-4 py-1.5 rounded-full mb-4 text-sm text-gray-500 cursor-pointer transition-all hover:bg-blue-100"
191+
role="button"
192+
tabIndex="0"
193+
onKeyPress={ ( e ) => {
194+
if ( 'Enter' === e.key || ' ' === e.key ) {
195+
setShowBenefits( ! showBenefits );
196+
}
197+
}}
198+
>
199+
<span>{ optimoleDashboardApp.strings.account_needed_benefits_toggle }</span>
200+
<span
201+
className={ `dashicons dashicons-arrow-${ showBenefits ? 'up' : 'down' } ml-1` }
200202
/>
201203
</div>
202204

203-
<div className="flex py-3 items-center">
204-
<Icon icon="yes-alt" />
205-
<p
206-
className="text-base ml-3 m-0"
207-
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_4 } }
208-
/>
209-
</div>
205+
{ showBenefits && (
206+
<div className="mb-4">
207+
<div className="flex py-3 items-center">
208+
<Icon icon="yes-alt" />
209+
<p
210+
className="text-base ml-3 m-0"
211+
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_1 } }
212+
/>
213+
</div>
214+
215+
<div className="flex py-3 items-center">
216+
<Icon icon="yes-alt" />
217+
<p
218+
className="text-base ml-3 m-0"
219+
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_2 } }
220+
/>
221+
</div>
222+
223+
<div className="flex py-3 items-center">
224+
<Icon icon="yes-alt" />
225+
<p
226+
className="text-base ml-3 m-0"
227+
dangerouslySetInnerHTML={ { __html: optimoleDashboardApp.strings.account_needed_subtitle_4 } }
228+
/>
229+
</div>
230+
</div>
231+
) }
210232
</div>
211233

212234
<div className="optml-connect__form basis-4/12 p-8 bg-light-blue border border-blue-300 rounded-md">

inc/admin.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1539,6 +1539,7 @@ private function get_dashboard_strings() {
15391539
'account_needed_sub_heading' => __( 'Stop sacrificing image quality for page speed. Optimole delivers both.', 'optimole-wp' ),
15401540
'account_needed_trust_badge' => __( 'TRUSTED BY 200,000+ HAPPY USERS', 'optimole-wp' ),
15411541
'account_needed_setup_time' => __( 'Setup is instant - just click connect', 'optimole-wp' ),
1542+
'account_needed_benefits_toggle' => __( 'See what you\'ll get', 'optimole-wp' ),
15421543
'invalid_key' => __( 'Invalid API Key', 'optimole-wp' ),
15431544
'keep_connected' => __( 'Ok, keep me connected', 'optimole-wp' ),
15441545
'cloud_library' => __( 'Cloud Library', 'optimole-wp' ),

0 commit comments

Comments
 (0)