summaryrefslogtreecommitdiff
path: root/frontend/src/components/PlayerInfo.jsx
blob: 42d3142a907873885220bc50f8f6bd00faa3e9a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// @flow
import { Text } from '@blueprintjs/core';
import React from 'react';
import { connect } from 'react-redux';
import type { Player } from '../models/players';
import { getCurrentPlayer } from '../redux/players';

export type PlayerInfoProps = {
  player: ?Player,
}

const PlayerInfoPresenter = ({player}: PlayerInfoProps) => (
    <Text>
      <b>Username:</b>
      {' '}
      {player && player.displayName}
    </Text>
);

const mapStateToProps = state => ({
  player: getCurrentPlayer(state),
});

const mapDispatchToProps = {
};

export const PlayerInfo = connect(mapStateToProps, mapDispatchToProps)(PlayerInfoPresenter);
bgstack15