mirror of
https://github.com/romancm/gamebrary
synced 2024-11-23 19:53:14 +00:00
wallpapers page clean up
This commit is contained in:
parent
ff64e51477
commit
0bc00cf646
1 changed files with 34 additions and 39 deletions
|
@ -10,55 +10,44 @@
|
|||
/>
|
||||
|
||||
<template v-else>
|
||||
<portal to="dock">
|
||||
<div class="d-flex justify-content-between align-items-center">
|
||||
<div class="space-used d-none d-sm-inline ml-auto mr-3">
|
||||
<small
|
||||
class="d-block text-center"
|
||||
:class="{ 'text-danger': outOfSpace }"
|
||||
v-text="usedSpaceText"
|
||||
/>
|
||||
<page-title
|
||||
title="Wallpapers"
|
||||
>
|
||||
<div class="space-used ml-auto mr-3">
|
||||
<small
|
||||
class="d-block text-center"
|
||||
:class="{ 'text-danger': outOfSpace }"
|
||||
v-text="usedSpaceText"
|
||||
/>
|
||||
|
||||
<b-progress
|
||||
:value="spaceUsed"
|
||||
:max="maxSpace"
|
||||
:variant="outOfSpace ? 'danger' : 'success'"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<b-button
|
||||
variant="primary"
|
||||
:disabled="outOfSpace"
|
||||
@click="triggerFileUpload"
|
||||
>
|
||||
<b-spinner small v-if="saving" />
|
||||
|
||||
<template v-else>
|
||||
<i class="fas fa-upload fa-fw" aria-hidden />
|
||||
<span>Upload</span>
|
||||
</template>
|
||||
</b-button>
|
||||
|
||||
<!-- <b-button
|
||||
variant="warning"
|
||||
class="ml-2"
|
||||
>
|
||||
Toggle View
|
||||
</b-button> -->
|
||||
<b-progress
|
||||
:value="spaceUsed"
|
||||
:max="maxSpace"
|
||||
:variant="outOfSpace ? 'danger' : 'success'"
|
||||
/>
|
||||
</div>
|
||||
</portal>
|
||||
|
||||
<b-button
|
||||
:disabled="outOfSpace"
|
||||
@click="triggerFileUpload"
|
||||
>
|
||||
<b-spinner small v-if="saving" />
|
||||
|
||||
<template v-else>
|
||||
<i class="fas fa-upload fa-fw" aria-hidden />
|
||||
<span class="d-none d-sm-inline">Upload</span>
|
||||
</template>
|
||||
</b-button>
|
||||
</page-title>
|
||||
|
||||
<b-alert
|
||||
v-if="isDuplicate && !saving && file && file.name"
|
||||
show
|
||||
dismissible
|
||||
variant="warning"
|
||||
>
|
||||
{{ $t('wallpapers.form.duplicateMessage', { fileName: file.name }) }}
|
||||
</b-alert>
|
||||
|
||||
<h1 class="d-none d-sm-block">Wallpapers</h1>
|
||||
|
||||
<wallpapers-list v-if="wallpapers.length" />
|
||||
|
||||
<b-alert show v-else>You don't have any wallpapers.</b-alert>
|
||||
|
@ -126,7 +115,13 @@ export default {
|
|||
},
|
||||
|
||||
spaceUsed() {
|
||||
return this.wallpapers.reduce((total, file) => total + file.metadata.size || 0, 0);
|
||||
return this.wallpapers.reduce((total, { metadata }) => {
|
||||
const size = metadata && metadata.size
|
||||
? metadata.size
|
||||
: 0;
|
||||
|
||||
return total + size;
|
||||
}, 0);
|
||||
},
|
||||
|
||||
outOfSpace() {
|
||||
|
|
Loading…
Reference in a new issue