From f7f8944e0027953060d5878865d9d38b71af5d4b Mon Sep 17 00:00:00 2001 From: Danny Coates Date: Thu, 27 Sep 2018 15:46:46 -0700 Subject: [PATCH] stubbed in signup dialog --- app/main.css | 1 + app/templates/expireInfo/index.js | 6 +-- app/templates/modal/index.js | 2 +- app/templates/modal/modal.css | 1 - app/templates/okDialog/index.js | 2 +- app/templates/signupDialog/index.js | 57 +++++++++++++++++++++ app/templates/signupDialog/signupDialog.css | 22 ++++++++ 7 files changed, 85 insertions(+), 6 deletions(-) create mode 100644 app/templates/signupDialog/index.js create mode 100644 app/templates/signupDialog/signupDialog.css diff --git a/app/main.css b/app/main.css index d7f73cad..3a98d958 100644 --- a/app/main.css +++ b/app/main.css @@ -17,6 +17,7 @@ @import './templates/popup/popup.css'; @import './templates/selectbox/selectbox.css'; @import './templates/setPasswordSection/setPasswordSection.css'; +@import './templates/signupDialog/signupDialog.css'; @import './templates/signupPromo/signupPromo.css'; @import './templates/title/title.css'; @import './templates/uploadedFile/uploadedFile.css'; diff --git a/app/templates/expireInfo/index.js b/app/templates/expireInfo/index.js index e4840425..d0aa7ac7 100644 --- a/app/templates/expireInfo/index.js +++ b/app/templates/expireInfo/index.js @@ -3,7 +3,7 @@ const html = require('choo/html'); const raw = require('choo/html/raw'); const selectbox = require('../selectbox'); const timeLimitText = require('../timeLimitText'); -const okDialog = require('../okDialog'); +const signupDialog = require('../signupDialog'); module.exports = function(state, emit) { const el = html`
${raw( @@ -31,7 +31,7 @@ module.exports = function(state, emit) { value => { const max = state.user.maxDownloads; if (value > max) { - state.modal = okDialog('todo: this setting requires an account'); + state.modal = signupDialog(); value = max; } state.downloadCount = value; @@ -54,7 +54,7 @@ module.exports = function(state, emit) { value => { const max = state.user.maxExpireSeconds; if (value > max) { - state.modal = okDialog('todo: this setting requires an account'); + state.modal = signupDialog(); value = max; } state.timeLimit = value; diff --git a/app/templates/modal/index.js b/app/templates/modal/index.js index 94f184c3..005824bc 100644 --- a/app/templates/modal/index.js +++ b/app/templates/modal/index.js @@ -4,7 +4,7 @@ module.exports = function(state, emit) { return html` `; diff --git a/app/templates/modal/modal.css b/app/templates/modal/modal.css index 947ea39a..ae1608a1 100644 --- a/app/templates/modal/modal.css +++ b/app/templates/modal/modal.css @@ -15,7 +15,6 @@ .modal__box { max-width: 480px; - max-height: 300px; background: var(--pageBGColor); border-radius: 4px; color: var(--textColor); diff --git a/app/templates/okDialog/index.js b/app/templates/okDialog/index.js index 93015ac7..4986c1b9 100644 --- a/app/templates/okDialog/index.js +++ b/app/templates/okDialog/index.js @@ -1,7 +1,7 @@ const html = require('choo/html'); module.exports = function(message) { - return function(state, close) { + return function(state, emit, close) { return html`
${message}
diff --git a/app/templates/signupDialog/index.js b/app/templates/signupDialog/index.js new file mode 100644 index 00000000..83098643 --- /dev/null +++ b/app/templates/signupDialog/index.js @@ -0,0 +1,57 @@ +/* globals LIMITS */ +const html = require('choo/html'); +const bytes = require('../../utils').bytes; + +// TODO: there's some duplication here with the signin page +module.exports = function() { + return function(state, emit, close) { + return html` +
+
+ ${state.translate('accountBenefitTitle')} +
    +
  • ${state.translate('accountBenefitLargeFiles', { + size: bytes(LIMITS.MAX_FILE_SIZE) + })}
  • +
  • ${state.translate('accountBenefitExpiry')}
  • +
  • ${state.translate('accountBenefitSync')}
  • +
+
+
+ + +
+ + +
`; + + function submitEmail(event) { + event.preventDefault(); + const el = document.getElementById('email-input'); + const email = el.value; + if (email) { + // just check if it's the right shape + const a = email.split('@'); + if (a.length === 2 && a.every(s => s.length > 0)) { + return emit('login', email); + } + } + el.value = ''; + } + }; +}; diff --git a/app/templates/signupDialog/signupDialog.css b/app/templates/signupDialog/signupDialog.css new file mode 100644 index 00000000..018dbcad --- /dev/null +++ b/app/templates/signupDialog/signupDialog.css @@ -0,0 +1,22 @@ +.signupDialog { + display: flex; + flex-direction: column; + max-width: 400px; + padding: 16px; +} + +.signupDialog__message { + margin: 32px 32px 0 32px; +} + +.signupDialog__emailInput { + box-sizing: border-box; + height: 40px; + width: 100%; + border: 1px solid rgba(0, 0, 0, 0.2); + border-radius: 4px; + margin: 16px 0; + padding: 0 8px; + font-size: 18px; + color: var(--lightTextColor); +}