Skip to content

Commit

Permalink
Merge pull request #173 from daithihearn/ui-enhancements-3
Browse files Browse the repository at this point in the history
UI enhancements 3
  • Loading branch information
daithihearn authored Jul 5, 2023
2 parents aa33fb5 + fc89e1c commit ee0bacf
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "frontend",
"version": "7.2.0",
"version": "7.2.1",
"description": "React frontend for the Cards 110",
"author": "Daithi Hearn",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"short_name": "Cards 110",
"name": "Cards 110",
"version": "7.2.0",
"version": "7.2.1",
"icons": [
{
"src": "./assets/favicon.png",
Expand Down
11 changes: 11 additions & 0 deletions src/components/Game/PlayerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
Stack,
Box,
useTheme,
CardHeader,
} from "@mui/material"
import { styled } from "@mui/system"
import { getRound } from "caches/GameSlice"
Expand All @@ -21,6 +22,7 @@ import { Player } from "model/Player"
import Leaderboard from "components/Leaderboard/Leaderboard"
import { Suit } from "model/Suit"
import { RoundStatus } from "model/Round"
import { FormatName } from "utils/FormattingUtils"

interface PlayerRowI {
player: Player
Expand Down Expand Up @@ -214,6 +216,15 @@ const PlayerCard: React.FC<PlayerRowI> = ({ player, className }) => {
isCurrentPlayer ? "highlight-player-" + theme.palette.mode : ""
}>
<Card className="no-shadow">
<CardContent className="player-name-container">
<Typography
variant="h4"
component="h4"
className="score-text bg-dark text-light">
{FormatName(profile.name, 7)}
</Typography>
</CardContent>

<CardMedia
image={profile.picture}
onClick={toggleLeaderboardModal}
Expand Down
4 changes: 2 additions & 2 deletions src/components/Header/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const NavBar = () => {
edge="start"
color="inherit"
onClick={navigateHome}>
<HomeButton />
<HomeButton fontSize="large" />
</IconButton>
</Grid>

Expand All @@ -115,7 +115,7 @@ const NavBar = () => {
edge="end"
color="inherit"
onClick={handleClick}>
<MenuButton />
<MenuButton fontSize="large" />
</IconButton>
<Menu
anchorEl={anchorEl}
Expand Down
14 changes: 10 additions & 4 deletions src/components/MyGames/MyGames.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,15 @@ const MyGames = () => {
cursor: "pointer",
}}>
{isGameActive(row) ? (
<PlayIcon />
<PlayIcon
fontSize="large"
aria-label="Play Game"
/>
) : (
<VisibilityIcon />
<VisibilityIcon
fontSize="large"
aria-label="View Game"
/>
)}
</ListItemIcon>

Expand All @@ -98,10 +104,10 @@ const MyGames = () => {

<ListItemSecondaryAction>
{isWinner(row, myProfile.id!) && (
<VictoryIcon />
<VictoryIcon fontSize="large" />
)}
{isLoser(row, myProfile.id!) && (
<FailureIcon />
<FailureIcon fontSize="large" />
)}
</ListItemSecondaryAction>
</ListItem>
Expand Down
11 changes: 8 additions & 3 deletions src/pages/Game/_game.scss
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,14 @@
border-radius: 16%;
}

.player-name-container {
padding-top: 0.2em !important;
padding-bottom: 0.2em !important;
}

.player-score-container {
padding-top: 0.25em;
padding-bottom: 0.25em;
padding-top: 0.5em !important;
padding-bottom: 0.5em !important;
}

.no-shadow {
Expand Down Expand Up @@ -178,7 +183,7 @@
@media (max-width: 420px) {

.player-score-container {
padding: 10px 0px 10px 0px !important;
padding: 2px 0px 2px 0px !important;

}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/FormattingUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const MAX_LENGTH = 20

export const FormatName = (name: string) =>
export const FormatName = (name: string, maxLength?: number) =>
name
.split("@")[0]
.split(RegExp("[ .,]+"))
Expand All @@ -11,4 +11,4 @@ export const FormatName = (name: string) =>
word.slice(1).toLocaleLowerCase(),
)
.join(" ")
.substring(0, MAX_LENGTH)
.substring(0, maxLength ?? MAX_LENGTH)

0 comments on commit ee0bacf

Please sign in to comment.