diff --git a/lootalot_front/package.json b/lootalot_front/package.json index 9e028e0..18f9bec 100644 --- a/lootalot_front/package.json +++ b/lootalot_front/package.json @@ -62,8 +62,11 @@ "vue" ], "transform": { - ".*\\.(vue)$": "vue-jest", - "^.+\\.js$": "/node_modules/babel-jest" + "^.*\\.(vue)$": "vue-jest", + "^.+\\.js$": "babel-jest" + }, + "moduleNameMapper": { + "^@/(.*)$": "/src/$1" } } } diff --git a/lootalot_front/src/App.vue b/lootalot_front/src/App.vue index d4b8da6..6382c79 100644 --- a/lootalot_front/src/App.vue +++ b/lootalot_front/src/App.vue @@ -1,11 +1,25 @@ diff --git a/lootalot_front/src/components/Player.vue b/lootalot_front/src/components/Player.vue deleted file mode 100644 index 733c8f6..0000000 --- a/lootalot_front/src/components/Player.vue +++ /dev/null @@ -1,124 +0,0 @@ - - - - - diff --git a/lootalot_front/src/components/PlayerView.js b/lootalot_front/src/components/PlayerView.js new file mode 100644 index 0000000..c88ec39 --- /dev/null +++ b/lootalot_front/src/components/PlayerView.js @@ -0,0 +1,32 @@ +import { AppStorage } from '../AppStorage' + +export default { + props: ["id"], + data () { return {}}, + methods: { + updateWealth (value) { + AppStorage.updatePlayerWealth(value) + .then(_ => {if (AppStorage.debug) console.log("Wealth updated")}) + .catch(e => {if (AppStorage.debug) console.error("wealthUpdate Error", e)}) + } + }, + computed: { + player () { + if (!AppStorage.state.initiated) { + return { name: "Loading", + id: 0, + cp: '-', sp: '-', gp: '-', pp: '-', + debt: 0 }; + } else { + console.log("Update player"); + return AppStorage.state.player_list[this.id]; + } + } + }, + render () { + return this.$scopedSlots.default({ + player: this.player, + updateWealth: this.updateWealth, + }) + } +} diff --git a/lootalot_front/src/components/Wealth.vue b/lootalot_front/src/components/Wealth.vue index a80f60a..ffc18ce 100644 --- a/lootalot_front/src/components/Wealth.vue +++ b/lootalot_front/src/components/Wealth.vue @@ -2,12 +2,11 @@
- - - + + +
-