From bccbb8f4b1c8e238e20f94b299ea0232dd02aecc Mon Sep 17 00:00:00 2001 From: bill bittner Date: Mon, 23 Oct 2017 15:10:49 -0700 Subject: [PATCH] updated publish process to show in flexboxes --- public/assets/css/general.css | 10 ++++- public/assets/js/dropzoneFunctions.js | 4 +- public/assets/js/publishFileFunctions.js | 1 - routes/sockets-routes.js | 2 +- views/index.handlebars | 49 ++++++++++-------------- 5 files changed, 32 insertions(+), 34 deletions(-) diff --git a/public/assets/css/general.css b/public/assets/css/general.css index a1c17d40..9dbe4cc7 100644 --- a/public/assets/css/general.css +++ b/public/assets/css/general.css @@ -33,6 +33,7 @@ body, .flex-container { .flex-container--center { justify-content: center; } + .hidden { display: none; } @@ -460,6 +461,7 @@ table { .dropzone { border: 2px dashed #9b9b9b; text-align: center; + position: relative; } .dropzone:hover, .dropzone--drag-over { @@ -468,8 +470,12 @@ table { background-color: #FCFCFC; } -.dropzone-instructions { - flex: 0 1 auto; +.position-absolute { + position: absolute; + top: 0px; + left: 0px; + height: 100%; + width: 100%; } #asset-preview-holder { diff --git a/public/assets/js/dropzoneFunctions.js b/public/assets/js/dropzoneFunctions.js index fba96cca..e6287746 100644 --- a/public/assets/js/dropzoneFunctions.js +++ b/public/assets/js/dropzoneFunctions.js @@ -1,10 +1,10 @@ function showInstructions () { - document.getElementById('preview-dropzone-instructions').hidden = false; + document.getElementById('preview-dropzone-instructions').setAttribute('class', 'flex-container flex-container--center position-absolute'); document.getElementById('asset-preview').style.opacity = 0.3; } function hideInstructions () { - document.getElementById('preview-dropzone-instructions').hidden = true; + document.getElementById('preview-dropzone-instructions').setAttribute('class', 'hidden'); document.getElementById('asset-preview').style.opacity = 1; } diff --git a/public/assets/js/publishFileFunctions.js b/public/assets/js/publishFileFunctions.js index 861d62cf..26027993 100644 --- a/public/assets/js/publishFileFunctions.js +++ b/public/assets/js/publishFileFunctions.js @@ -81,7 +81,6 @@ function publishStagedFile(event) { if (anonymousOrInChannel === 'anonymous') { channelName = null; }; - console.log('channel name:', channelName); // validate, submit, and handle response validateFilePublishSubmission(stagedFiles, claimName, channelName) .then(() => { diff --git a/routes/sockets-routes.js b/routes/sockets-routes.js index 8f5a1316..88bffef2 100644 --- a/routes/sockets-routes.js +++ b/routes/sockets-routes.js @@ -34,7 +34,7 @@ module.exports = (app, siofu, hostedContentPath) => { uploader.on('saved', ({ file }) => { if (file.success) { logger.debug(`Client successfully uploaded ${file.name}`); - socket.emit('publish-status', 'File upload successfully completed. Your image is being published to LBRY (this might take a second)...'); + socket.emit('publish-update', 'File upload successfully completed. Your image is being published to LBRY (this might take a second)...'); // /* // NOTE: need to validate that client has the credentials to the channel they chose // otherwise they could circumvent security. diff --git a/views/index.handlebars b/views/index.handlebars index 25f10f5e..a502b0c1 100644 --- a/views/index.handlebars +++ b/views/index.handlebars @@ -4,12 +4,12 @@
-
+
-

Drag & drop image or video here to publish

+

Drag & drop image or video here to publish

OR

-

+

- @@ -62,6 +60,7 @@ const publishFormWrapper = document.getElementById('publish-form'); const publishStatus = document.getElementById('publish-status'); + const publishUpdate = document.getElementById('publish-update'); const publishProgressBar = document.getElementById('publish-progress-bar'); const uploadPercent = document.getElementById('upload-percent'); @@ -73,17 +72,16 @@ hidePublishTools(); // show the progress status and animation showPublishStatus(); - updatePublishStatus('File is loading to server') showPublishProgressBar(); - showUploadPercent(); }); uploader.addEventListener('progress', function(event){ var percent = event.bytesLoaded / event.file.size * 100; - updateUploadPercent(`${percent.toFixed(2)} %`) + updatePublishStatus('

File is loading to server

') + updateUploadPercent(`

${percent.toFixed(2)}%

`) }); /* socket.io message listeners */ - socket.on('publish-status', function(msg){ - updatePublishStatus(msg); + socket.on('publish-update', function(msg){ + updatePublishStatus(`

${msg}

`); updateUploadPercent(`

Curious what magic is happening here? learn more

`); }); socket.on('publish-failure', function(msg){ @@ -94,35 +92,30 @@ socket.on('publish-complete', function(msg){ const showUrl = msg.result.claim_id + "/" + msg.name; // update status - updatePublishStatus('

Your publish is complete! You are being redirected to it now.

If you do not get redirected, click here.

'); - hidePublishProgressBar(); - hideUploadPercent(); + updatePublishStatus('

Your publish is complete! You are being redirected to it now.

'); + updateUploadPercent('

If you do not get redirected, click here.

') // redirect the user window.location.href = showUrl; }); function hidePublishTools() { - publishFormWrapper.hidden = true; + publishFormWrapper.setAttribute('class', 'hidden'); } // publish status functions function showPublishStatus() { - publishStatus.hidden = false; + publishStatus.setAttribute('class', 'row row--tall flex-container flex-container--center'); } function updatePublishStatus(msg){ - publishStatus.innerHTML = msg; + publishUpdate.innerHTML = msg; } // progress bar functions function showPublishProgressBar(){ - publishProgressBar.hidden = false; createProgressBar(publishProgressBar, 12); } function hidePublishProgressBar(){ publishProgressBar.hidden = true; } // upload percent functions - function showUploadPercent(){ - uploadPercent.hidden = false; - } function updateUploadPercent(msg){ uploadPercent.innerHTML = msg; }