Gameboard clean up

This commit is contained in:
Roman Cervantes 2019-11-21 15:06:14 -07:00
parent 652cf28b99
commit 37a0692783
9 changed files with 74 additions and 50 deletions

View file

@ -38,7 +38,7 @@
<script>
import { mapState } from 'vuex';
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
import Modal from '@/components/Modal';
export default {

View file

@ -0,0 +1,61 @@
<template lang="html">
<modal
ref="game"
large
@close="closeGame"
>
<game
v-if="gameDetailId"
slot="content"
:id="gameDetailId"
:list-id="gameDetailListIndex"
/>
</modal>
</template>
<script>
import Modal from '@/components/Modal';
import Game from '@/pages/Game';
export default {
components: {
Modal,
Game,
},
data() {
return {
gameDetailId: null,
};
},
mounted() {
this.$bus.$on('OPEN_GAME', this.openGame);
},
beforeDestroy() {
this.$bus.$off('OPEN_GAME');
},
methods: {
closeGame() {
this.setPageTitle();
this.gameDetailId = null;
this.$store.commit('CLEAR_ACTIVE_GAME');
},
setPageTitle() {
document.title = this.platform ? `${this.platform.name} - Gamebrary` : 'Gamebrary';
},
openGame({ id, listId }) {
this.gameDetailId = id;
this.gameDetailListIndex = listId;
this.$refs.game.open();
},
},
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
</style>

View file

@ -53,7 +53,7 @@
<script>
import GameRating from '@/components/GameDetail/GameRating';
import GameCardUtils from '@/components/GameCards/GameCard';
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
export default {
components: {

View file

@ -44,7 +44,7 @@
<script>
import GameRating from '@/components/GameDetail/GameRating';
import GameCardUtils from '@/components/GameCards/GameCard';
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
export default {
components: {

View file

@ -53,7 +53,7 @@
<script>
import GameRating from '@/components/GameDetail/GameRating';
import GameCardUtils from '@/components/GameCards/GameCard';
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
export default {
components: {

View file

@ -15,7 +15,7 @@
</template>
<script>
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
import { mapState, mapGetters } from 'vuex';
export default {

View file

@ -112,7 +112,7 @@
<script>
import ToggleSwitch from '@/components/ToggleSwitch';
import Tag from '@/components/Tags/Tag';
import Tag from '@/components/Tag';
import Modal from '@/components/Modal';
import { mapState } from 'vuex';

View file

@ -1,21 +1,6 @@
<template lang="html">
<div v-if="loaded" class="game-board" >
<game-board-placeholder v-if="loading" :id="gameDetailId" />
<modal
ref="game"
large
@close="closeGame"
>
<game
v-if="gameDetailId"
slot="content"
:id="gameDetailId"
:list-id="gameDetailListIndex"
/>
</modal>
<apply-tag />
<game-board-placeholder v-if="loading" />
<list
v-for="(list, listIndex) in gameLists[platform.code]"
@ -28,16 +13,17 @@
/>
<list-add />
<game-modal />
<apply-tag-modal />
</div>
</template>
<script>
import GameBoardPlaceholder from '@/components/GameBoard/GameBoardPlaceholder';
import ListAdd from '@/components/Lists/ListAdd';
import ApplyTag from '@/components/Tags/ApplyTag';
import Modal from '@/components/Modal';
import ApplyTagModal from '@/components/GameBoard/ApplyTagModal';
import GameModal from '@/components/GameBoard/GameModal';
import List from '@/components/Lists/List';
import Game from '@/pages/Game';
import { chunk } from 'lodash';
import { mapState } from 'vuex';
import draggable from 'vuedraggable';
@ -48,9 +34,8 @@ export default {
List,
GameBoardPlaceholder,
ListAdd,
ApplyTag,
Game,
Modal,
ApplyTagModal,
GameModal,
},
data() {
@ -60,7 +45,6 @@ export default {
loading: false,
gameData: null,
gameDetailListIndex: null,
gameDetailId: null,
queryLimit: 500,
};
},
@ -86,30 +70,9 @@ export default {
}
this.load();
this.setPageTitle();
this.$bus.$on('OPEN_GAME', this.openGame);
},
beforeDestroy() {
this.$bus.$off('OPEN_GAME');
},
methods: {
closeGame() {
this.setPageTitle();
this.gameDetailId = null;
this.$store.commit('CLEAR_ACTIVE_GAME');
},
setPageTitle() {
document.title = this.platform ? `${this.platform.name} - Gamebrary` : 'Gamebrary';
},
openGame({ id, listId }) {
this.gameDetailId = id;
this.gameDetailListIndex = listId;
this.$refs.game.open();
},
dragEnd() {
this.dragging = false;