ensure alert has a title

pull/933/head
yann300 4 years ago
parent 1c7507d3a2
commit 37d9c377e3
  1. 7
      apps/remix-ide/src/app/ui/landing-page/landing-page.js
  2. 2
      apps/remix-ide/src/app/ui/modal-dialog-custom.js
  3. 6
      apps/remix-ide/src/lib/gist-handler.js

@ -240,20 +240,21 @@ export class LandingPage extends ViewPlugin {
<div>e.g ${examples.map((url) => { return yo`<div class="p-1"><a>${url}</a></div>` })}</div> <div>e.g ${examples.map((url) => { return yo`<div class="p-1"><a>${url}</a></div>` })}</div>
</div>` </div>`
modalDialogCustom.prompt(`Import from ${service}`, msg, null, (target) => { const title = `Import from ${service}`
modalDialogCustom.prompt(title, msg, null, (target) => {
if (target !== '') { if (target !== '') {
compilerImport.import( compilerImport.import(
target, target,
(loadingMsg) => { tooltip(loadingMsg) }, (loadingMsg) => { tooltip(loadingMsg) },
(error, content, cleanUrl, type, url) => { (error, content, cleanUrl, type, url) => {
if (error) { if (error) {
modalDialogCustom.alert(error.message || error) modalDialogCustom.alert(title, error.message || error)
} else { } else {
try { try {
fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url) fileProviders.workspace.addExternal(type + '/' + cleanUrl, content, url)
this.verticalIcons.select('fileExplorers') this.verticalIcons.select('fileExplorers')
} catch (e) { } catch (e) {
modalDialogCustom.alert(e.message) modalDialogCustom.alert(title, e.message)
} }
} }
} }

@ -5,7 +5,7 @@ var css = require('./styles/modal-dialog-custom-styles')
module.exports = { module.exports = {
alert: function (title, text) { alert: function (title, text) {
if (text) return modal(title, yo`<div>${text}</div>`, null, { label: null }) if (text) return modal(title, yo`<div>${text}</div>`, null, { label: null })
return modal('', yo`<div>${title}</div>`, null, { label: null }) return modal('alert', yo`<div>${title}</div>`, null, { label: null })
}, },
prompt: function (title, text, inputValue, ok, cancel, focus) { prompt: function (title, text, inputValue, ok, cancel, focus) {
return prompt(title, text, false, inputValue, ok, cancel, focus) return prompt(title, text, false, inputValue, ok, cancel, focus)

@ -20,7 +20,7 @@ function GistHandler (_window) {
if (gistId) { if (gistId) {
cb(gistId) cb(gistId)
} else { } else {
modalDialogCustom.alert('Error while loading gist. Please provide a valid Gist ID or URL.') modalDialogCustom.alert('Gist load error', 'Error while loading gist. Please provide a valid Gist ID or URL.')
} }
} }
}) })
@ -49,7 +49,7 @@ function GistHandler (_window) {
json: true json: true
}, async (error, response, data = {}) => { }, async (error, response, data = {}) => {
if (error || !data.files) { if (error || !data.files) {
modalDialogCustom.alert(`Gist load error: ${error || data.message}`) modalDialogCustom.alert('Gist load error', error || data.message)
return return
} }
const obj = {} const obj = {}
@ -61,7 +61,7 @@ function GistHandler (_window) {
const provider = fileManager.getProvider('workspace') const provider = fileManager.getProvider('workspace')
provider.lastLoadedGistId = gistId provider.lastLoadedGistId = gistId
} else { } else {
modalDialogCustom.alert(errorLoadingFile.message || errorLoadingFile) modalDialogCustom.alert('Gist load error', errorLoadingFile.message || errorLoadingFile)
} }
}) })
}) })

Loading…
Cancel
Save