mirror of
https://github.com/GuerillaStudio/souvenir.git
synced 2024-11-08 12:11:53 +00:00
feat(encoding): moar labels
This commit is contained in:
parent
6b85b10e2f
commit
93e8ad4b5f
1 changed files with 41 additions and 7 deletions
|
@ -2,14 +2,14 @@
|
|||
<div class="encoding">
|
||||
|
||||
<div class="encoding-loader">
|
||||
<encoding-loader :percent="roundedPercentage" class="encoding-progress"></encoding-loader>
|
||||
<encoding-loader :percent="percentage" class="encoding-progress"></encoding-loader>
|
||||
<preview-canvas class="encoding-loader__preview"></preview-canvas>
|
||||
</div>
|
||||
<div class="encoding-percent">{{ roundedPercentage }}%</div>
|
||||
<div class="encoding-percent">{{ percentage }}%</div>
|
||||
|
||||
<div class="layoutOverlay-content">
|
||||
<div class="layoutOverlay-title">Almost ready~</div>
|
||||
<div class="layoutOverlay-subtitle">Encoding may take some time depending on your device</div>
|
||||
<div class="layoutOverlay-title">{{ labelTitle }}</div>
|
||||
<div class="layoutOverlay-subtitle">{{ labelSubtitle }}</div>
|
||||
</div>
|
||||
|
||||
<button class="encoding-notif">
|
||||
|
@ -34,12 +34,46 @@ export default {
|
|||
props: {
|
||||
value: Number
|
||||
},
|
||||
data: () => ({
|
||||
lastTitleUpdate: null,
|
||||
labelTitle: 'Encoding…'
|
||||
}),
|
||||
computed: {
|
||||
percentage () {
|
||||
return this.value * 100
|
||||
return Math.trunc(this.value * 100)
|
||||
},
|
||||
roundedPercentage () {
|
||||
return Math.trunc(this.percentage)
|
||||
labelSubtitle () {
|
||||
return Math.random() < 0.7 ? 'Encoding may take some time depending on your device' : 'Encoding may take some time depending on your level of cuteness'
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
updateTitle () {
|
||||
const currentDate = Date.now()
|
||||
if (!this.lastTitleUpdate || (currentDate - this.lastTitleUpdate > 1000)) {
|
||||
this.lastTitleUpdate = currentDate
|
||||
switch (true) {
|
||||
case this.percentage < 25:
|
||||
this.labelTitle = 'Encoding…'
|
||||
break
|
||||
case this.percentage < 50:
|
||||
this.labelTitle = 'A little bit more'
|
||||
break
|
||||
case this.percentage < 75:
|
||||
this.labelTitle = 'One last touch'
|
||||
break
|
||||
case this.percentage >= 75:
|
||||
this.labelTitle = 'Almost ready ~'
|
||||
break
|
||||
default:
|
||||
this.labelTitle = 'Error'
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
percentage: function () {
|
||||
this.updateTitle()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue