Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mario Reder committed Feb 18, 2020
2 parents 2739491 + c4ecff0 commit f9b8304
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 11 deletions.
1 change: 0 additions & 1 deletion src/renderer/components/panels/ServerPanel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
align-items: flex-start;
align-content: flex-start;
padding: 6px;
min-width: 300px;
max-height: 340px;
overflow: hidden;
}
Expand Down
20 changes: 13 additions & 7 deletions src/renderer/components/panels/ServerPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ class Panel extends React.PureComponent<ServerPanelProps, ServerPanelState> {
}

private renderPlayers (players: (Player | null)[]): JSX.Element[] {
const { isConnected } = this.props
return players
.filter(player => !!player)
.map(
Expand All @@ -344,12 +345,17 @@ class Panel extends React.PureComponent<ServerPanelProps, ServerPanelState> {
key={index}
className='server-panel-player'
>
<div className='server-panel-player-img'>
<img src={course.icon} />
</div>
<div className='server-panel-player-course'>
{ course.short }
</div>
{
isConnected &&
<>
<div className='server-panel-player-img'>
<img src={course.icon} />
</div>
<div className='server-panel-player-course'>
{ course.short }
</div>
</>
}
<div className='server-panel-player-img'>
<img src={`img/${CHARACTER_IMAGES[player!.characterId || 0]}`} />
</div>
Expand Down Expand Up @@ -464,7 +470,7 @@ class Panel extends React.PureComponent<ServerPanelProps, ServerPanelState> {
/>
</div>
}
<div className='server-panel-details-playerlist'>
<div className='server-panel-details-playerlist' style={{ minWidth: isConnected ? 450 : 300 }}>
{
this.renderPlayers(players)
}
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/reducers/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export const connection = (state: ConnectionState = initialState.connection, act
case ConnectionActionType.UPDATE_PLAYER_POSITIONS:
draft.selfPos = action.self
draft.cameraAngle = action.cameraAngle
if (!draft.server) return
if (!draft.server.players) return
for (let i = 0; i < action.positions.length; i++) {
const position = action.positions[i]
if (!position) continue
if (!draft.server) return
if (!draft.server.players) return
if (!draft.server.players[i + 1]) return
if (!draft.server.players[i + 1]) continue
const prevCourse = draft.server.players[i + 1]!.position != null ? draft.server.players[i + 1]!.position!.course : 0
draft.server.players[i + 1]!.position = position
if (draft.server.players[i + 1]!.position!.course === 0) {
Expand Down

0 comments on commit f9b8304

Please sign in to comment.