From f1d088596d14e53236c785eca282cb8ef785a91e Mon Sep 17 00:00:00 2001 From: Artus Date: Thu, 1 Aug 2019 15:46:38 +0200 Subject: [PATCH] adds basic 'views' concept for main content --- lootalot_front/src/App.vue | 58 +++++++++++++---------- lootalot_front/src/components/Chest.vue | 11 +++-- lootalot_front/src/components/Request.vue | 2 +- 3 files changed, 41 insertions(+), 30 deletions(-) diff --git a/lootalot_front/src/App.vue b/lootalot_front/src/App.vue index f06effd..1ddfba8 100644 --- a/lootalot_front/src/App.vue +++ b/lootalot_front/src/App.vue @@ -31,12 +31,13 @@
- +

ItemInput

+ + + + @@ -83,6 +94,8 @@ export default { data () { return { state: AppStorage.state, + activeView: 'group', + shopInventory: [{id: 1, name: "Item from shop #1", base_price: 2000}], }; }, components: { @@ -104,26 +117,23 @@ export default { AppStorage.initStorage(playerId); }, methods: { - setActivePlayer (idx) { AppStorage.setActivePlayer(idx); }, + setActivePlayer (idx) { + if (idx == 0) this.switchView('group'); + AppStorage.setActivePlayer(idx); + }, + switchView (viewId) { + if (!['group', 'player', 'adding'].includes(viewId)) { + console.error("Not a valid view ID :", viewId); + } + this.activeView = viewId; + }, switchPlayerChestVisibility () { AppStorage.switchPlayerChestVisibility(); }, }, computed: { - permissions () { - return { - canGrab: this.state.player_id != 0 && !this.state.show_player_chest, - canSell: this.state.show_player_chest || this.state.player_id == 0, - }; - }, + showPlayerChest () { return this.activeView == 'player' }, + isAdding () { return this.activeView == 'adding' }, playerIsGroup () { return this.state.player_id == 0 }, } } - diff --git a/lootalot_front/src/components/Chest.vue b/lootalot_front/src/components/Chest.vue index fb50377..75bfdce 100644 --- a/lootalot_front/src/components/Chest.vue +++ b/lootalot_front/src/components/Chest.vue @@ -2,10 +2,10 @@ - +
ObjetsObjets Valeur -
+