From 2382a452456e4bdef4584e1046925e372624cb79 Mon Sep 17 00:00:00 2001 From: Joffrey BION Date: Thu, 16 May 2019 23:48:38 +0200 Subject: Rationalize module names --- sw-ui/src/components/lobby/RadialPlayerList.tsx | 69 +++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 sw-ui/src/components/lobby/RadialPlayerList.tsx (limited to 'sw-ui/src/components/lobby/RadialPlayerList.tsx') diff --git a/sw-ui/src/components/lobby/RadialPlayerList.tsx b/sw-ui/src/components/lobby/RadialPlayerList.tsx new file mode 100644 index 00000000..88db55fc --- /dev/null +++ b/sw-ui/src/components/lobby/RadialPlayerList.tsx @@ -0,0 +1,69 @@ +import { Icon, IconName, Intent } from '@blueprintjs/core'; +import { List } from 'immutable'; +import * as React from 'react'; +import { ReactNode } from 'react'; +import { Flex } from 'reflexbox'; +import { ApiPlayer } from '../../api/model'; +import { RadialList } from './radial-list/RadialList'; +import roundTable from './round-table.png'; + +type PlayerItemProps = { + player: ApiPlayer +}; + +const PlayerItem = ({player}: PlayerItemProps) => ( + + +
{player.displayName}
+
+); + +const PlayerPlaceholder = () => ( + + +
?
+
+); + +type UserIconProps = { + isUser: boolean, + isOwner: boolean, + title: string | null, +}; + +const UserIcon = ({isUser, isOwner, title}: UserIconProps) => { + const icon: IconName = isOwner ? 'badge' : 'user'; + const intent: Intent = isUser ? Intent.WARNING : Intent.NONE; + return ; +}; + +type RadialPlayerListProps = { + players: List +}; + +export const RadialPlayerList = ({players}: RadialPlayerListProps) => { + const orderedPlayers = placeUserFirst(players.toArray()); + const playerItems = orderedPlayers.map(player => ); + const tableImg = Round table; + return ; +}; + +function placeUserFirst(players: ApiPlayer[]): ApiPlayer[] { + while (!players[0].user) { + players.push(players.shift()!); + } + return players; +} + +function completeWithPlaceholders(playerItems: Array): Array { + while (playerItems.length < 3) { + playerItems.push(); + } + return playerItems; +} + -- cgit