diff --git a/client/src/components/account.box.jsx b/client/src/components/account.box.jsx
index 4f04b493..c6383c55 100644
--- a/client/src/components/account.box.jsx
+++ b/client/src/components/account.box.jsx
@@ -26,7 +26,6 @@ const addState = connect(
}
);
-
class AccountAvatar extends Component {
constructor() {
super();
@@ -107,7 +106,7 @@ function AccountBox(args) {
{account.name}
- 0 MMR
+
);
}
diff --git a/client/src/components/player.box.jsx b/client/src/components/player.box.jsx
index 409ace1d..29001645 100644
--- a/client/src/components/player.box.jsx
+++ b/client/src/components/player.box.jsx
@@ -1,5 +1,57 @@
+const { Component } = require('preact');
const preact = require('preact');
+const idleAnimation = require('./anims/idle');
+const wiggle = require('./anims/wiggle');
+
+class Img extends Component {
+ constructor() {
+ super();
+ // The animation ids are a check to ensure that animations are not repeated
+ // When a new account animation is communicated with state it will have a corresponding Id
+ // which is a count of how many resoluttions have passed
+ this.animations = [];
+ this.resetAnimations = this.resetAnimations.bind(this);
+ }
+
+ render() {
+ const { id, img } = this.props;
+ const imgStyle = img
+ ? { 'background-image': `url(/imgs/${img}.svg)` }
+ : null;
+ return (
+
+
+ );
+ }
+
+ onClick() {
+ if (this.props.mtxActive) {
+ return this.props.sendMtxAccountApply();
+ }
+ return this.animations.push(wiggle(this.props.id, this.idle));
+ }
+
+ componentDidMount() {
+ this.idle = idleAnimation(this.props.id);
+ return this.animations.push(this.idle);
+ }
+
+ resetAnimations() {
+ for (let i = this.animations.length - 1; i >= 0; i--) {
+ this.animations[i].reset();
+ }
+ }
+
+ componentWillUnmount() {
+ this.resetAnimations();
+ }
+}
+
function Scoreboard(args) {
const {
isPlayer,
@@ -14,29 +66,13 @@ function Scoreboard(args) {
return '';
};
- /*
- let scoreText = () => {
- if (player.score === 'Zero') return '▫▫▫▫';
- if (player.score === 'One') return '■▫▫▫';
- if (player.score === 'Two') return '■■▫▫';
- if (player.score === 'Three') return '■■■▫';
- if (player.score === 'Adv') return '■■■+';
- if (player.score === 'Win') return '■■■■';
- return '';
- };
- */
-
- const imgStyle = player.img
- ? { 'background-image': `url(/imgs/${player.img}.svg)` }
- : null;
-
if (!isPlayer) {
return (
{scoreText()}
{player.name}
-
+
);
@@ -47,7 +83,7 @@ function Scoreboard(args) {
hfhf
{scoreText()}
{player.name}
-
+
);
}