From 0f6c1743f0445718387744d7e1d919cf63052aa1 Mon Sep 17 00:00:00 2001 From: Tixie Date: Fri, 15 Mar 2019 23:43:14 +0100 Subject: [PATCH] style(encoding overlay): Add new design with better progress feedback --- src/assets/css/4-modules/encoding.css | 56 ++++++++++++++++++++++++++- src/assets/img/video-encoding.svg | 10 +++++ src/store.js | 10 ++--- src/views/components/encoding.vue | 34 ++++------------ 4 files changed, 78 insertions(+), 32 deletions(-) create mode 100644 src/assets/img/video-encoding.svg diff --git a/src/assets/css/4-modules/encoding.css b/src/assets/css/4-modules/encoding.css index c987ccf..874ca0c 100644 --- a/src/assets/css/4-modules/encoding.css +++ b/src/assets/css/4-modules/encoding.css @@ -7,12 +7,66 @@ top: 0; left: 0; display: flex; + flex-direction: column; justify-content: center; align-items: center; width: 100%; height: 100%; - background-color: rgba(0, 0, 0, .7); + background-color: rgba(0, 0, 0, .9); color: #fff; text-align: center; font-size: 2.4rem; } + +.encoding-illu { + position: relative; + margin-bottom: 5rem; +} + +.encoding-illu::before { + position: absolute; + top: .5rem; + right: -1rem; + left: -1rem; + height: .5rem; + border-radius: .5rem; + border-radius: .4rem; + background: var(--color-primary); + box-shadow: 0 .4rem .4rem rgba(0, 0, 0, .25); + content: ""; + animation: encodingProgress .3s ease-in-out infinite alternate; +} + +@keyframes encodingProgress { + from { + top: .5rem; + } + + to { + top: calc(100% - 1rem); + } +} + +.encoding-label { + font-size: 2rem; +} + +.encoding-progressBar { + overflow: hidden; + margin: 2rem 0; + max-width: 30rem; + width: 90%; + border-radius: .5rem; + background-color: rgba(255, 255, 255, .2); +} + +.encoding-progressBar__state { + height: .5rem; + background: linear-gradient(91.78deg, var(--color-primary) 0%,var(--color-secondary) 100%); +} + +.encoding-percent { + padding-bottom: 2rem; + font-size: 5rem; + line-height: 1; +} diff --git a/src/assets/img/video-encoding.svg b/src/assets/img/video-encoding.svg new file mode 100644 index 0000000..d34ae0b --- /dev/null +++ b/src/assets/img/video-encoding.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/src/store.js b/src/store.js index aa91e68..0c3292e 100644 --- a/src/store.js +++ b/src/store.js @@ -22,7 +22,7 @@ export default new Vuex.Store({ }, encoding: { status: false, - progress: 0 + state: 0 }, downloading: { status: false, @@ -65,8 +65,8 @@ export default new Vuex.Store({ stopEncoding (store) { store.encoding.status = false }, - updateEncodingProgress (store, progress) { - store.encoding.progress = progress + updateEncodingState (store, percent) { + store.encoding.state = percent }, startDownloading (store, objectUrl) { store.downloading.status = true @@ -138,12 +138,12 @@ export default new Vuex.Store({ encoding.on('progress', value => { console.log(`Encoding progress ${Math.round(value * 100)}% (${value})`) - commit('updateEncodingProgress', Math.round(value * 100)) + commit('updateEncodingState', Math.round(value * 100)) }) encoding.once('done', objectUrl => { commit('stopEncoding') - commit('updateEncodingProgress', 0) + commit('updateEncodingState', 0) commit('startDownloading', objectUrl) }) } diff --git a/src/views/components/encoding.vue b/src/views/components/encoding.vue index 5ce31b6..648c009 100644 --- a/src/views/components/encoding.vue +++ b/src/views/components/encoding.vue @@ -1,7 +1,13 @@ @@ -10,34 +16,10 @@ import { mapState } from 'vuex' export default { name: 'encodingOverlay', - data () { - return { - ellipsis: '', - interval: null - } - }, computed: { ...mapState([ 'encoding' ]) - }, - methods: { - makeLoading () { - // Dot loading - this.interval = setInterval(() => { - if (this.ellipsis.length < 3) { - this.ellipsis += '.' - } else { - this.ellipsis = '' - } - }, 200) - } - }, - mounted: function () { - this.makeLoading() - }, - destroyed: function () { - window.clearTimeout(this.interval) } }