summaryrefslogtreecommitdiff
path: root/frontend/src/components/game-browser/PlayerInfo.tsx
blob: 4afed671b043e5d775305affe45151b3878a79b2 (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
import { Text } from '@blueprintjs/core';
import React from 'react';
import { connect } from 'react-redux';
import { GlobalState } from '../../reducers';
import { User } from '../../redux/user';
import { getCurrentUser } from '../../redux/user';

type PlayerInfoProps = {
  user: User | null,
}

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

const mapStateToProps = (state: GlobalState): PlayerInfoProps => ({
  user: getCurrentUser(state),
});

const mapDispatchToProps = {
};

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