-
Notifications
You must be signed in to change notification settings - Fork 313
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3630 from 10up/feature/3629
Abstract Sync page logic into a provider pattern
- Loading branch information
Showing
21 changed files
with
245 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* WordPress dependencies. | ||
*/ | ||
import { createRoot, render, WPElement } from '@wordpress/element'; | ||
import { SyncProvider } from '../sync'; | ||
|
||
/** | ||
* Internal dependencies. | ||
*/ | ||
import { | ||
ajaxUrl, | ||
autoIndex, | ||
lastSyncDateTime, | ||
lastSyncFailed, | ||
indexMeta, | ||
isEpio, | ||
nonce, | ||
} from './config'; | ||
import SettingsPage from './apps/settings-page'; | ||
|
||
/** | ||
* App component. | ||
* | ||
* @returns {WPElement} App component. | ||
*/ | ||
const App = () => ( | ||
<SyncProvider | ||
ajaxUrl={ajaxUrl} | ||
autoIndex={autoIndex} | ||
defaultLastSyncDateTime={lastSyncDateTime} | ||
defaultLastSyncFailed={lastSyncFailed} | ||
indexMeta={indexMeta} | ||
isEpio={isEpio} | ||
nonce={nonce} | ||
> | ||
<SettingsPage /> | ||
</SyncProvider> | ||
); | ||
|
||
if (typeof createRoot === 'function') { | ||
const root = createRoot(document.getElementById('ep-sync')); | ||
|
||
root.render(<App />); | ||
} else { | ||
render(<App />, document.getElementById('ep-sync')); | ||
} |
Oops, something went wrong.