diff --git a/package-lock.json b/package-lock.json index b7d6c0b4..c3910a6d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -7350,6 +7350,11 @@ } } }, + "x0popup": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/x0popup/-/x0popup-0.3.3.tgz", + "integrity": "sha1-Nj2P2hh2N/p1T7bGBCJWZzOz4Q0=" + }, "xdg-basedir": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/xdg-basedir/-/xdg-basedir-3.0.0.tgz", diff --git a/package.json b/package.json index 19c80828..db544636 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "remotestoragejs": "^1.0.2", "serviceworker-cache-polyfill": "^4.0.0", "text-encoding": "^0.6.4", - "tocca": "^2.0.1" + "tocca": "^2.0.1", + "x0popup": "^0.3.3" } } diff --git a/src/App/Sources/View.elm b/src/App/Sources/View.elm index 0270c9c6..645b80f0 100644 --- a/src/App/Sources/View.elm +++ b/src/App/Sources/View.elm @@ -489,7 +489,7 @@ pageNewStep3 source = (Html.a [ Html.Attributes.class "is-styled-link" , Html.Attributes.href "/about#CORS" - , Html.Attributes.type_ "blank" + , Html.Attributes.target "_blank" ] [ Html.text "here" ] ) diff --git a/src/Js/authentication.js b/src/Js/authentication.js index f9140d90..fba356b9 100644 --- a/src/Js/authentication.js +++ b/src/Js/authentication.js @@ -49,6 +49,22 @@ function doWork(worker, requisites) { } +function prompt(question) { + setTimeout(() => node.querySelector(".spinner").style.visibility = "hidden", 0); + + return x0p({ + inputPlaceholder: "example@5apps.com", + maxWidth: "95vw", + title: question, + type: "input", + width: "358px" + }).then(data => { + node.querySelector(".spinner").style.visibility = "visible"; + return data; + }); +} + + // // > Method @@ -309,19 +325,21 @@ AUTH_SYSTEM.METHOD = signIn: _ => new Promise((resolve, reject) => { - const userAddress = prompt( + prompt( "What's your user address?" - ); - if (!userAddress || userAddress.length === 0) { - return resolve("GoBack"); - } + ).then(data => { + if (data.button === "cancel" || data.text.length === 0) { + return resolve("GoBack"); + } - setInstance(); + setInstance(); - rs.on("connected", _ => resolve("Redirect")); - rs.on("error", err => reject(err.message)); - rs.connect(userAddress); + rs.on("connected", _ => resolve("Redirect")); + rs.on("error", err => reject(err.message)); + rs.connect(data.text); + + }); }), diff --git a/src/Static/Css/Proxy.css b/src/Static/Css/Proxy.css index 0ae0b337..fe90c7ea 100644 --- a/src/Static/Css/Proxy.css +++ b/src/Static/Css/Proxy.css @@ -82,3 +82,88 @@ a[href].is-styled-link { transform: rotate(450deg); } } + + + +/** + ** Prompt + ** + */ + +.x0p { + color: white; + font-size: 16px; + height: auto !important; + left: 50%; + line-height: 1.25em; + max-height: auto !important; + position: absolute; + top: 50%; + z-index: 9999; + + -webkit-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + font-smooth: true; +} + + +.x0p-overlay { + background: rgba(0, 0, 0, 0.125); + bottom: 0; + left: 0; + position: absolute; + right: 0; + top: 0; + z-index: 9998; +} + + +.x0p .title { + font-family: "Montserrat", Overpass, sans-serif; + margin-bottom: 1.563em; + margin-top: 60.5px; + text-align: center; +} + + +#x0p-input { + background: transparent; + border: 0; + border-bottom: 1px solid rgba(255, 255, 255, 0.425); + box-sizing: border-box; + color: white; + font-family: Overpass, sans-serif; + font-size: 1.25em; + padding: 0.512em 0; + width: 100%; +} + + +#x0p-input::placeholder { + color: rgba(255, 255, 255, 0.475); +} + + +#x0p-input:focus { + border-bottom-color: rgb(254, 196, 24); + outline: 0; +} + + +#x0p-buttons { + margin-top: 1.563em; +} + + +#x0p-buttons button { + background: transparent; + border: 0; + color: white; + cursor: pointer; + font-size: 1em; + font-family: Overpass, sans-serif; + font-weight: 600; +} diff --git a/src/Vendor/package.js b/src/Vendor/package.js index da0e0e9a..8ab225ab 100644 --- a/src/Vendor/package.js +++ b/src/Vendor/package.js @@ -10,5 +10,6 @@ self.RemoteStorage = require("remotestoragejs"); if (self.document) { self.tocca = require("tocca"); + self.x0p = require("x0popup"); require("pepjs"); }