diff --git a/src/components/Button.tsx b/src/components/Button.tsx index 317c713..6c09a2c 100644 --- a/src/components/Button.tsx +++ b/src/components/Button.tsx @@ -27,7 +27,7 @@ const Button: FunctionComponent<{ margin: 5px; padding: 10px; border: none; - border-radius: 4vw; + border-radius: 30px; } `} {text} diff --git a/src/components/Center.tsx b/src/components/Center.tsx new file mode 100644 index 0000000..19aeaf8 --- /dev/null +++ b/src/components/Center.tsx @@ -0,0 +1,21 @@ +import * as React from 'react'; +import { FunctionComponent } from 'react'; + +const Center: FunctionComponent = ({children}) => { + return ( +
+ {children} + +
+ ); +} + +export default Center; \ No newline at end of file diff --git a/src/components/CircularPanel.tsx b/src/components/CircularPanel.tsx new file mode 100644 index 0000000..83d7dec --- /dev/null +++ b/src/components/CircularPanel.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { FunctionComponent } from 'react'; + +const CircularPanel: FunctionComponent<{ + color: string; + style?: React.CSSProperties +}> = (props) => { + return ( +
+ + {props.children} +
+ ); +} + +export default CircularPanel; diff --git a/src/components/FloatingPanel.tsx b/src/components/FloatingPanel.tsx index 5a04259..564ec06 100644 --- a/src/components/FloatingPanel.tsx +++ b/src/components/FloatingPanel.tsx @@ -7,7 +7,7 @@ const FloatingPanel: FunctionComponent<{ color: string; visible: boolean; }> = (props) => { - if(!props.visible) return <> + if(props.visible === false) return <> return (
{props.children} diff --git a/src/components/InfoPanel.tsx b/src/components/InfoPanel.tsx index 856023b..1bb966b 100644 --- a/src/components/InfoPanel.tsx +++ b/src/components/InfoPanel.tsx @@ -3,6 +3,7 @@ import * as React from "react"; import { FunctionComponent } from "react"; import { Context } from "../context/context"; import { getColorByBrightness } from "../util/ColorUtil"; +import CircularPanel from "./CircularPanel"; function getInfoPanelTextByGameState(params: { context: Context; @@ -10,7 +11,6 @@ function getInfoPanelTextByGameState(params: { crashMessage?: string; userKey?: string; userKeyWhoLeave?: string; - searchingOpponent: boolean; }): string | undefined { const { context, @@ -18,11 +18,8 @@ function getInfoPanelTextByGameState(params: { crashMessage, userKey, userKeyWhoLeave, - searchingOpponent, } = params; - if (searchingOpponent) { - return context.texts.SearchingOpponent + " " + context.texts.PleaseWait; - } else if (crashMessage) { + if (crashMessage) { return context.texts.GameCrashed + " " + crashMessage; } else if (userKeyWhoLeave) { let message = context.texts.OpponentLeavesTheGame; @@ -50,44 +47,24 @@ function getInfoPanelTextByGameState(params: { return undefined; } -const InfoPanelContainer: FunctionComponent<{ - context: Context; - color: string; -}> = (props) => { - return ( -
- - {props.children} -
- ); -}; - const InfoPanel: FunctionComponent<{ context: Context; game?: MancalaGame; crashMessage?: string; userKey?: string; userKeyWhoLeave?: string; - searchingOpponent: boolean; + style?: React.CSSProperties; + visible?: boolean; }> = ({ context, game, crashMessage, userKey, userKeyWhoLeave, - searchingOpponent, + style, + visible }) => { + if (visible === false) return <>; const isUserTurn = userKey ? game?.checkIsPlayerTurn(userKey) : false; const containerColor = isUserTurn ? context.themeManager.theme.playerTurnColor @@ -102,16 +79,15 @@ const InfoPanel: FunctionComponent<{ game, crashMessage, userKey, - userKeyWhoLeave, - searchingOpponent, + userKeyWhoLeave }); if (text) { return ( - +

{text}

-
+ ); } else { return (
) diff --git a/src/components/Space.tsx b/src/components/Space.tsx new file mode 100644 index 0000000..c1dfc5f --- /dev/null +++ b/src/components/Space.tsx @@ -0,0 +1,10 @@ +import * as React from 'react'; +import { FunctionComponent } from 'react'; + +const Space: FunctionComponent<{ width?: string, height?: string }> = ({ width, height }) => { + return ( +
+ ); +} + +export default Space; \ No newline at end of file diff --git a/src/components/UserStatus.tsx b/src/components/UserStatus.tsx new file mode 100644 index 0000000..20b061b --- /dev/null +++ b/src/components/UserStatus.tsx @@ -0,0 +1,73 @@ +import * as React from 'react'; +import { FunctionComponent } from 'react'; +import { Context } from '../context/context'; +import { User } from '../models/User'; +import { getColorByBrightness } from '../util/ColorUtil'; +import Space from './Space'; + +export type LayoutMode = "right" | "left"; + +const UserStatus: FunctionComponent<{ + context: Context, + user: User, + layoutMode: LayoutMode, + visible?: boolean, + style?: React.CSSProperties +}> = ({ context, user, layoutMode, visible, style }) => { + if (visible === false) return <>; + const textColorOnBoard = getColorByBrightness( + context.themeManager.theme.boardColor, + context.themeManager.theme.textColor, + context.themeManager.theme.textLightColor + ); + return ( +
+ + face_6 + + + {user.isAnonymous ? context.texts.Anonymous : user.name} + +
+ +
+ ); +} + +export default UserStatus; \ No newline at end of file diff --git a/src/components/board/BoardToolbar.tsx b/src/components/board/BoardToolbar.tsx new file mode 100644 index 0000000..f51a029 --- /dev/null +++ b/src/components/board/BoardToolbar.tsx @@ -0,0 +1,22 @@ +import * as React from 'react'; +import { FunctionComponent } from 'react'; + +const BoardToolbar: FunctionComponent<{ visible?: boolean, style?: React.CSSProperties }> = ({ children, visible, style }) => { + if(visible === false) return <>; + return ( +
+ {children} + +
+ ); +} + +export default BoardToolbar; \ No newline at end of file diff --git a/src/components/board/BoardView.tsx b/src/components/board/BoardView.tsx index 5e2ebc2..eb3af16 100644 --- a/src/components/board/BoardView.tsx +++ b/src/components/board/BoardView.tsx @@ -56,7 +56,6 @@ const BoardView: FunctionComponent<{ {isPlayer2 ? player2Pits : player1Pits}