diff --git a/apps/remix-ide/src/app/ui/landing-page/landing-page.js b/apps/remix-ide/src/app/ui/landing-page/landing-page.js index bd66f66054..81efff22c3 100644 --- a/apps/remix-ide/src/app/ui/landing-page/landing-page.js +++ b/apps/remix-ide/src/app/ui/landing-page/landing-page.js @@ -4,7 +4,6 @@ import ReactDOM from 'react-dom' import * as packageJson from '../../../../../../package.json' import { ViewPlugin } from '@remixproject/engine-web' import { RemixUiHomeTab } from '@remix-ui/home-tab' // eslint-disable-line -import { id } from '@ethersproject/hash' const yo = require('yo-yo') const globalRegistry = require('../../../global/registry') @@ -37,7 +36,6 @@ export class LandingPage extends ViewPlugin { // to retrieve medium posts document.body.appendChild(yo``) document.body.appendChild(yo``) - } render () { diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css index 224bda49e8..80fb6d7d39 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css @@ -83,4 +83,5 @@ } .remixui_migrationBtn { width: 100px; - } \ No newline at end of file + } + \ No newline at end of file diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx index dc993eccbb..208af4e9d7 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx @@ -25,11 +25,15 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { const [state, setState] = useState<{ showBasicMigration: boolean, themeQuality: { filter: string, name: string }, - showMediaPanel: 'none' | 'twitter' | 'medium' + showMediaPanel: 'none' | 'twitter' | 'medium', + showModalDialog: boolean, + modalInfo: { title: string, loadItem: string, examples: Array } }>({ showBasicMigration: false, themeQuality: registry.get('themeModule').api.currentTheme().quality === 'dark' ? themes.dark : themes.light, - showMediaPanel: 'none' + showMediaPanel: 'none', + showModalDialog: false, + modalInfo: { title: '', loadItem: '', examples: []} }) const playRemi = async () => { @@ -45,20 +49,21 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { return { ...prevState, themeQuality: theme.quality === 'dark' ? themes.dark : themes.light } }) }) - window.addEventListener('click', (e) => { - if (e.target.id !== 'remixIDEHomeTwitterbtn' && e.target.id !== 'remixIDEHomeMediumbtn') { + window.addEventListener('click', (event) => { + const { id } = (event.target as HTMLButtonElement).dataset + if ( id !== 'remixIDEHomeTwitterbtn' && id!== 'remixIDEHomeMediumbtn') { // todo check event.target setState(prevState => { return { ...prevState, showMediaPanel: 'none' } }) } }) }, []) - const createNewFile = () => { - plugin.call('filePanel', 'createNewFile') + const createNewFile = async () => { + await plugin.call('filePanel', 'createNewFile') } - const uploadFile = (target) => { - plugin.call('filePanel', 'uploadFile', target) + const uploadFile = async (target) => { + await plugin.call('filePanel', 'uploadFile', target) } const connectToLocalhost = () => { @@ -104,174 +109,196 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { plugin.verticalIcons.select('pluginManager') } - const load = (service, item, examples, info = '') => {/* - const contentImport = this.contentImport - const fileProviders = registry.get('fileproviders').api - const msg = yo` -
- Enter the ${item} you would like to load. -
${info}
-
e.g ${examples.map((url) => { return yo`` })}
-
` + const showFullMessage = (title: string, loadItem: string, examples: Array) => { + setState(prevState => { + return { ...prevState, modalInfo: { title: title, loadItem: loadItem , examples: examples } } + }) + } + + const hideFullMessage = () => { //eslint-disable-line + setState(prevState => { + return { ...prevState, showModalDialog: false } + }) + } - const title = `Import from ${service}` - modalDialogCustom.prompt(title, msg, null, (target) => { - if (target !== '') { - contentImport.import( - target, - (loadingMsg) => { tooltip(loadingMsg) }, - (error, content, cleanUrl, type, url) => { - if (error) { - modalDialogCustom.alert(title, error.message || error) - } else { - try { - fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) - this.verticalIcons.select('filePanel') - } catch (e) { - modalDialogCustom.alert(title, e.message) - } - } + const processLoading = () => { + const contentImport = plugin.contentImport + const fileProviders = registry.get('fileproviders').api + contentImport.import( + null,//target, + (loadingMsg) => { setState(prevState => { return { ...prevState, tooltip: loadingMsg } }) }, + (error, content, cleanUrl, type, url) => { + if (error) { + //modalDialogCustom.alert(state.modalInfo.title, error.message || error) + } else { + try { + fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) + plugin.call('menuicons', 'select', 'filePanel') + } catch (e) { + //modalDialogCustom.alert(state.modalInfo.title, e.message) } - ) + } } - })*/ + ) } + const maxHeight = Math.max(window.innerHeight - 150, 200) + 'px' return ( -
-
-
- playRemi() } alt=""> - -
-
-
-
-
-

Featured Plugins

-
- - - - - - - - + <> + {} } + hide={ !state.showModalDialog } + handleHide={ () => hideFullMessage() } + okFn={ () => processLoading() } + > +
+ { state.modalInfo.loadItem !== '' && Enter the { state.modalInfo.loadItem } you would like to load. } + { state.modalInfo.examples.length !== 0 && + <> +
e.g
+
+ { state.modalInfo.examples.map((url) => { return `` }) }
+ } +
+
+
+
+
+ playRemi() } alt=""> +
-
-
-

File

-

- - createNewFile()}>New File -

-

- - -

-

- - connectToLocalhost()}>Connect to Localhost -

-

-
- - - - +
+
+
+
+

Featured Plugins

+
+ + startSolidity()} /> + startOptimism()} /> + startSolhint()} /> + startLearnEth()} /> + startSourceVerify()} /> + +
-
-

Resources

-

- - Documentation -

-

- - Gitter channel -

-

- - Featuring website -

-

- - switchToPreviousVersion()}>Old experience -

+
+
+

File

+

+ + createNewFile()}>New File +

+

+ + +

+

+ + connectToLocalhost()}>Connect to Localhost +

+

+
+ + + + +
+
+
+

Resources

+

+ + Documentation +

+

+ + Gitter channel +

+

+ + Featuring website +

+

+ + switchToPreviousVersion()}>Old experience +

+
-
-
-
- - -
-
- { (state.showMediaPanel === 'medium') &&
-
-
+
+
+ + +
+
+ { (state.showMediaPanel === 'medium') &&
+
+
+
-
-
} - { (state.showMediaPanel === 'twitter') &&
-
- - -
-
} +
} + { (state.showMediaPanel === 'twitter') &&
+
+ + +
+
} +
-
+ ) }