-
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: switch to the nice-modal-react modal management (#518)
- Loading branch information
1 parent
35b19bc
commit 4f35efb
Showing
34 changed files
with
30,661 additions
and
483 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,25 +1,40 @@ | ||
import React, { useEffect } from 'react'; | ||
import { useEffect } from 'react'; | ||
import { show } from '@ebay/nice-modal-react'; | ||
|
||
import AsyncAPIStudio from './studio'; | ||
import { AsyncAPIStudio } from './studio'; | ||
import { RedirectedModal } from './components/Modals'; | ||
|
||
import state from './state'; | ||
|
||
const App: React.FunctionComponent = () => { | ||
import type { FunctionComponent } from 'react'; | ||
|
||
async function onInit(editorLoaded: boolean, redirectedFrom: string | false) { | ||
if (!editorLoaded) { | ||
return; | ||
} | ||
|
||
const preloader = document.getElementById('preloader'); | ||
if (preloader) { | ||
preloader.classList.add('loaded'); | ||
} | ||
|
||
if (typeof redirectedFrom === 'string') { | ||
show(RedirectedModal); | ||
} | ||
} | ||
|
||
export const App: FunctionComponent = () => { | ||
const appState = state.useAppState(); | ||
const editorState = state.useEditorState(); | ||
|
||
const redirectedFrom = appState.redirectedFrom.get(); | ||
const editorLoaded = editorState.editorLoaded.get(); | ||
|
||
useEffect(() => { | ||
if (editorLoaded === true) { | ||
const preloader = document.getElementById('preloader'); | ||
if (preloader) { | ||
preloader.classList.add('loaded'); | ||
} | ||
} | ||
}, [editorLoaded]); // eslint-disable-line | ||
onInit(editorLoaded, redirectedFrom); | ||
}, [editorLoaded, redirectedFrom]); // eslint-disable-line | ||
|
||
return ( | ||
<AsyncAPIStudio /> | ||
); | ||
}; | ||
|
||
export default App; |
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
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
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
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
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
Oops, something went wrong.