Merge pull request #7 from jhalitaksoy/feature/store-stone-count-label
add stone count label to store view
This commit is contained in:
commit
47b39a268b
@ -59,10 +59,11 @@ const HoleView: FunctionComponent<{
|
|||||||
};
|
};
|
||||||
|
|
||||||
const StoreView: FunctionComponent<{
|
const StoreView: FunctionComponent<{
|
||||||
|
context: Context;
|
||||||
pitViewModel: PitViewModel;
|
pitViewModel: PitViewModel;
|
||||||
gridColumn: string;
|
gridColumn: string;
|
||||||
gridRow: string;
|
gridRow: string;
|
||||||
}> = ({ pitViewModel, gridColumn, gridRow }) => {
|
}> = ({ context, pitViewModel, gridColumn, gridRow }) => {
|
||||||
const balls = [...range(pitViewModel.stoneCount)].map((i) => (
|
const balls = [...range(pitViewModel.stoneCount)].map((i) => (
|
||||||
<BallView color={pitViewModel.stoneColor} />
|
<BallView color={pitViewModel.stoneColor} />
|
||||||
));
|
));
|
||||||
@ -79,9 +80,22 @@ const StoreView: FunctionComponent<{
|
|||||||
justifyContent: "center",
|
justifyContent: "center",
|
||||||
alignContent: "center",
|
alignContent: "center",
|
||||||
flexWrap: "wrap",
|
flexWrap: "wrap",
|
||||||
|
position: "relative",
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{balls}
|
{balls}
|
||||||
|
<span
|
||||||
|
style={{
|
||||||
|
position: "absolute",
|
||||||
|
bottom: "2vw",
|
||||||
|
fontFamily: "monospace",
|
||||||
|
fontWeight: "bold",
|
||||||
|
fontSize: "2vw",
|
||||||
|
color: context.themeManager.theme.ballColor,
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{balls.length}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@ -119,6 +133,7 @@ const BoardView: FunctionComponent<{
|
|||||||
boardViewModel.pits[game.board.player2BankIndex()];
|
boardViewModel.pits[game.board.player2BankIndex()];
|
||||||
const player1Bank = (
|
const player1Bank = (
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player1BankViewModel}
|
pitViewModel={player1BankViewModel}
|
||||||
gridColumn="1 / 2"
|
gridColumn="1 / 2"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
@ -126,6 +141,7 @@ const BoardView: FunctionComponent<{
|
|||||||
);
|
);
|
||||||
const player2Bank = (
|
const player2Bank = (
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player2BankViewModel}
|
pitViewModel={player2BankViewModel}
|
||||||
gridColumn="8 / 9"
|
gridColumn="8 / 9"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
@ -149,11 +165,13 @@ const BoardView: FunctionComponent<{
|
|||||||
{userKey === game.player2Id ? (
|
{userKey === game.player2Id ? (
|
||||||
<>
|
<>
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player1BankViewModel}
|
pitViewModel={player1BankViewModel}
|
||||||
gridColumn="1 / 2"
|
gridColumn="1 / 2"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
/>
|
/>
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player2BankViewModel}
|
pitViewModel={player2BankViewModel}
|
||||||
gridColumn="8 / 9"
|
gridColumn="8 / 9"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
@ -164,11 +182,13 @@ const BoardView: FunctionComponent<{
|
|||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player1BankViewModel}
|
pitViewModel={player1BankViewModel}
|
||||||
gridColumn="8 / 9"
|
gridColumn="8 / 9"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
/>
|
/>
|
||||||
<StoreView
|
<StoreView
|
||||||
|
context={context}
|
||||||
pitViewModel={player2BankViewModel}
|
pitViewModel={player2BankViewModel}
|
||||||
gridColumn="1 / 2"
|
gridColumn="1 / 2"
|
||||||
gridRow="1 / 3"
|
gridRow="1 / 3"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user