simplify modals

This commit is contained in:
Gamebrary 2020-10-14 14:47:02 -07:00
parent 3f87019aa5
commit ab463adbe1
7 changed files with 61 additions and 86 deletions

View file

@ -14,21 +14,15 @@
:body-text-variant="nightMode ? 'white' : null" :body-text-variant="nightMode ? 'white' : null"
:footer-bg-variant="nightMode ? 'dark' : null" :footer-bg-variant="nightMode ? 'dark' : null"
:footer-text-variant="nightMode ? 'white' : null" :footer-text-variant="nightMode ? 'white' : null"
footer-class="d-flex justify-content-between"
@show="resetBoard" @show="resetBoard"
@hidden="resetBoard" @hidden="resetBoard"
> >
<template v-slot:modal-header="{ close }"> <template v-slot:modal-header="{ close }">
<modal-header <modal-header
title="Create board" :title="$t('boards.create')"
> @close="close"
<b-button />
variant="light"
size="sm"
@click="close"
>
<icon name="x" />
</b-button>
</modal-header>
</template> </template>
<form ref="createBoardForm" @submit.stop.prevent="submit"> <form ref="createBoardForm" @submit.stop.prevent="submit">
@ -85,7 +79,7 @@
</form> </form>
<template v-slot:modal-footer="{ cancel }"> <template v-slot:modal-footer="{ cancel }">
<b-button @click="cancel"> <b-button @click="cancel" variant="light">
Cancel Cancel
</b-button> </b-button>

View file

@ -5,6 +5,12 @@
size="lg" size="lg"
footer-class="p-2 justify-content-center" footer-class="p-2 justify-content-center"
header-class="align-items-center pb-0 border-0" header-class="align-items-center pb-0 border-0"
:header-bg-variant="nightMode ? 'dark' : null"
:header-text-variant="nightMode ? 'white' : null"
:body-bg-variant="nightMode ? 'dark' : null"
:body-text-variant="nightMode ? 'white' : null"
:footer-bg-variant="nightMode ? 'dark' : null"
:footer-text-variant="nightMode ? 'white' : null"
@show="load" @show="load"
@hidden="reset" @hidden="reset"
> >
@ -15,38 +21,27 @@
<modal-header <modal-header
:title="game.name" :title="game.name"
:subtitle="gameModalData.list.name" :subtitle="gameModalData.list.name"
header-class="border-0" @close="close"
> />
<b-button-toolbar key-nav aria-label="Toolbar with button groups"> <b-button-group>
<b-button-group class="mr-2"> <b-button
<b-button size="sm"
size="sm" :variant="nightMode ? 'dark' : 'light'"
variant="light" :disabled="prevDisabled"
:disabled="prevDisabled" @click="previousGame"
@click="previousGame" >
> <icon name="triangle-left" />
<icon name="triangle-left" /> </b-button>
</b-button>
<b-button
size="sm"
variant="light"
:disabled="nextDisabled"
@click="nextGame"
>
<icon name="triangle-right" />
</b-button>
</b-button-group>
<b-button <b-button
variant="light"
size="sm" size="sm"
@click="close" :variant="nightMode ? 'dark' : 'light'"
:disabled="nextDisabled"
@click="nextGame"
> >
<icon name="x" /> <icon name="triangle-right" />
</b-button> </b-button>
</b-button-toolbar> </b-button-group>
</modal-header>
</template> </template>
<b-container v-if="game.name" class="m-0 p-0"> <b-container v-if="game.name" class="m-0 p-0">
@ -151,7 +146,7 @@
<script> <script>
import moment from 'moment'; import moment from 'moment';
import { mapState } from 'vuex'; import { mapState, mapGetters } from 'vuex';
import GameDetailPlaceholder from '@/components/Game/GameDetailPlaceholder'; import GameDetailPlaceholder from '@/components/Game/GameDetailPlaceholder';
import GameDetails from '@/components/Game/GameDetails'; import GameDetails from '@/components/Game/GameDetails';
import GameNotesTab from '@/components/Game/GameNotesTab'; import GameNotesTab from '@/components/Game/GameNotesTab';
@ -190,6 +185,7 @@ export default {
computed: { computed: {
// TODO: rename gameModalData // TODO: rename gameModalData
...mapState(['gameModalData', 'games', 'platform', 'progresses', 'tags']), ...mapState(['gameModalData', 'games', 'platform', 'progresses', 'tags']),
...mapGetters(['nightMode']),
releaseDate() { releaseDate() {
const releaseDate = this.game const releaseDate = this.game

View file

@ -17,20 +17,14 @@
:body-text-variant="nightMode ? 'white' : null" :body-text-variant="nightMode ? 'white' : null"
:footer-bg-variant="nightMode ? 'dark' : null" :footer-bg-variant="nightMode ? 'dark' : null"
:footer-text-variant="nightMode ? 'white' : null" :footer-text-variant="nightMode ? 'white' : null"
footer-class="d-flex justify-content-between"
@show="show" @show="show"
> >
<template v-slot:modal-header="{ close }"> <template v-slot:modal-header="{ close }">
<modal-header <modal-header
title="Game notes" title="Game notes"
> @close="close"
<b-button />
variant="light"
size="sm"
@click="close"
>
<icon name="x" />
</b-button>
</modal-header>
</template> </template>
<b-form-textarea <b-form-textarea
@ -46,24 +40,35 @@
</a> </a>
</b-form-text> </b-form-text>
<template v-slot:modal-footer> <template v-slot:modal-footer="{ cancel }">
<b-button <b-button
variant="danger" variant="danger"
:disabled="deleting" :disabled="deleting || !notes[game.id]"
@click="deleteNote" @click="deleteNote"
> >
<b-spinner small v-if="deleting" /> <b-spinner small v-if="deleting" />
<span v-else>{{ $t('global.delete') }}</span> <span v-else>{{ $t('global.delete') }}</span>
</b-button> </b-button>
<b-button <div>
variant="primary" <b-button
:disabled="saving" variant="light"
@click="saveNote" class="mx-2"
> :disabled="saving"
<b-spinner small v-if="saving" /> @click="cancel"
<span v-else>{{ $t('global.save') }}</span> >
</b-button> {{ $t('global.cancel') }}
</b-button>
<b-button
variant="primary"
:disabled="saving"
@click="saveNote"
>
<b-spinner small v-if="saving" />
<span v-else>{{ $t('global.save') }}</span>
</b-button>
</div>
</template> </template>
</b-modal> </b-modal>
</b-button> </b-button>

View file

@ -15,20 +15,14 @@
:body-text-variant="nightMode ? 'white' : null" :body-text-variant="nightMode ? 'white' : null"
:footer-bg-variant="nightMode ? 'dark' : null" :footer-bg-variant="nightMode ? 'dark' : null"
:footer-text-variant="nightMode ? 'white' : null" :footer-text-variant="nightMode ? 'white' : null"
footer-class="d-flex justify-content-between"
@show="show" @show="show"
> >
<template v-slot:modal-header="{ close }"> <template v-slot:modal-header="{ close }">
<modal-header <modal-header
title="Set game progress" title="Set game progress"
> @close="close"
<b-button />
variant="light"
size="sm"
@click="close"
>
<icon name="x" />
</b-button>
</modal-header>
</template> </template>
<b-input-group :prepend="`${localProgress}%`" class="mb-4" size="lg"> <b-input-group :prepend="`${localProgress}%`" class="mb-4" size="lg">

View file

@ -25,15 +25,8 @@
<template v-slot:modal-header="{ close }"> <template v-slot:modal-header="{ close }">
<modal-header <modal-header
:title="game.name" :title="game.name"
> @close="close"
<b-button />
variant="light"
size="sm"
@click="close"
>
<icon name="x" />
</b-button>
</modal-header>
</template> </template>
<b-carousel <b-carousel

View file

@ -14,7 +14,7 @@ export default {
computed: { computed: {
...mapState(['settings', 'games', 'tags', 'notes', 'progresses', 'board']), ...mapState(['settings', 'games', 'tags', 'notes', 'progresses', 'board']),
// TODO: remove getter // TODO: remove getter
...mapGetters(['gameTags']), ...mapGetters(['gameTags', 'nightMode']),
showCompletedBadge() { showCompletedBadge() {
return this.gameProgress && Number(this.gameProgress) === 100; return this.gameProgress && Number(this.gameProgress) === 100;

View file

@ -17,15 +17,8 @@
<template v-slot:modal-header="{ close }"> <template v-slot:modal-header="{ close }">
<modal-header <modal-header
:title="$t('board.addGame.title')" :title="$t('board.addGame.title')"
> @close="close"
<b-button />
variant="light"
size="sm"
@click="close"
>
<icon name="x" />
</b-button>
</modal-header>
</template> </template>
<b-form @submit.prevent="search" class="mb-2"> <b-form @submit.prevent="search" class="mb-2">