store
1 year ago
AddonRow.jsx
1 year ago
App.jsx
1 year ago
Metabox.jsx
1 year ago
Modal.jsx
1 year ago
Notices.jsx
1 year ago
Select2.jsx
1 year ago
Settings.jsx
1 year ago
Step1.jsx
1 year ago
Step2.jsx
1 year ago
Step3.jsx
1 year ago
StepWrapper.jsx
1 year ago
main.js
1 year ago
Metabox.jsx
64 lines
| 1 | /** |
| 2 | * WordPress Dependencies |
| 3 | */ |
| 4 | import { useContext } from '@wordpress/element'; |
| 5 | import { OneClickContext } from './store/context'; |
| 6 | |
| 7 | /** |
| 8 | * Internal Dependencies |
| 9 | */ |
| 10 | import Step1 from './Step1'; |
| 11 | import Step2 from './Step2'; |
| 12 | import Step3 from './Step3'; |
| 13 | import StepWrapper from './StepWrapper'; |
| 14 | |
| 15 | export default function Metabox() { |
| 16 | const { showMetabox, currentStep } = useContext(OneClickContext); |
| 17 | const { metabox } = advancedAds.oneclick; |
| 18 | if (!showMetabox) { |
| 19 | return null; |
| 20 | } |
| 21 | |
| 22 | return ( |
| 23 | <div id="advads-m2-connect" className="postbox position-full"> |
| 24 | <h2 className="hndle"> |
| 25 | <span>{metabox.title}</span> |
| 26 | </h2> |
| 27 | <div className="inside"> |
| 28 | {1 === currentStep && ( |
| 29 | <StepWrapper title={advancedAds.oneclick.step1.title}> |
| 30 | <Step1 /> |
| 31 | </StepWrapper> |
| 32 | )} |
| 33 | {2 === currentStep && ( |
| 34 | <StepWrapper title={advancedAds.oneclick.step2.title}> |
| 35 | <Step2 /> |
| 36 | </StepWrapper> |
| 37 | )} |
| 38 | {3 === currentStep && ( |
| 39 | <StepWrapper> |
| 40 | <Step3 /> |
| 41 | </StepWrapper> |
| 42 | )} |
| 43 | <footer> |
| 44 | <a |
| 45 | href={metabox.visitLink} |
| 46 | target="_blank" |
| 47 | rel="noreferrer" |
| 48 | > |
| 49 | {metabox.visitText} |
| 50 | <span className="screen-reader-text"> |
| 51 | {' '} |
| 52 | (opens in a new tab) |
| 53 | </span> |
| 54 | <span |
| 55 | aria-hidden="true" |
| 56 | className="dashicons dashicons-external" |
| 57 | ></span> |
| 58 | </a> |
| 59 | </footer> |
| 60 | </div> |
| 61 | </div> |
| 62 | ); |
| 63 | } |
| 64 |