more refactoring, removing imports

This commit is contained in:
2019-07-31 21:48:59 +02:00
parent dae7633c11
commit 15d87e3b47
5 changed files with 74 additions and 73 deletions

View File

@@ -1,18 +1,42 @@
<template>
<main id="app" class="container">
<PlayerView :id="state.player_id"
v-slot="{ player, notifications, actions }">
v-slot="{ player, loot, notifications, actions }">
<section class="section">
<HeaderBar :app_state="state">
<template v-slot:title>{{ player.name }}</template>
<template v-slot:links>
<a class="navbar-item">History of Loot</a>
<template v-if="playerIsGroup">
<hr class="navbar-divider">
<div class="navbar-item heading">Admin</div>
<a class="navbar-item">"Resolve claims"</a>
<a class="navbar-item">"Add player"</a>
</template>
<hr class="navbar-divider">
<div class="navbar-item heading">Changer</div>
<a v-for="(p,i) in state.player_list" :key="i"
@click="setActivePlayer(i)"
href="#" class="navbar-item">
{{ p.name }}</a>
</template>
</HeaderBar>
<p v-if="notifications">{{ notifications }}</p>
<p v-if="notifications.length > 0">{{ notifications }}</p>
<Wealth
:wealth="[player.cp, player.sp, player.gp, player.pp]"
:debt="player.debt"
@update="actions.updateWealth">
</wealth>
<Chest :player="state.show_player_chest ? player.id : 0"
<div class="tabs is-centered is-boxed is-medium" v-show="!playerIsGroup">
<ul>
<li :class="{ 'is-active': !state.show_player_chest }">
<a @click="switchPlayerChestVisibility">Coffre de groupe</a></li>
<li :class="{ 'is-active': state.show_player_chest }">
<a @click="switchPlayerChestVisibility">Mon coffre</a></li>
</ul>
</div>
<Chest :items="state.show_player_chest ? loot : state.group_loot"
:player="state.show_player_chest ? player.id : 0"
@claim="actions.putClaim"
@unclaim="actions.withdrawClaim"></Chest>
</section>
@@ -68,6 +92,13 @@ export default {
}
AppStorage.initStorage(playerId);
},
methods: {
setActivePlayer (idx) { AppStorage.setActivePlayer(idx); },
switchPlayerChestVisibility () { AppStorage.switchPlayerChestVisibility(); },
},
computed: {
playerIsGroup () { return this.state.player_id == 0 },
}
}
</script>