diff --git a/package.json b/package.json index df91173..835f164 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frontend", - "version": "5.3.1", + "version": "5.3.2", "description": "React frontend for the Cards 110", "author": "Daithi Hearn", "license": "MIT", diff --git a/public/manifest.json b/public/manifest.json index d887752..34b3139 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -1,7 +1,7 @@ { "short_name": "Cards 110", "name": "Cards 110", - "version": "5.3.1", + "version": "5.3.2", "icons": [ { "src": "./assets/favicon.png", diff --git a/src/components/GameStats/PlayerSwitcher.tsx b/src/components/GameStats/PlayerSwitcher.tsx index df34435..1a75c09 100644 --- a/src/components/GameStats/PlayerSwitcher.tsx +++ b/src/components/GameStats/PlayerSwitcher.tsx @@ -11,6 +11,7 @@ import { getMyProfile } from "../../caches/MyProfileSlice" import { getPlayerProfiles } from "../../caches/PlayerProfilesSlice" import { PlayerProfile } from "../../model/Player" import StatsService from "../../services/StatsService" +import { FormatName } from "../../utils/FormattingUtils" const PlayerSwitcher: React.FC = () => { const dispatch = useAppDispatch() @@ -70,7 +71,7 @@ const PlayerSwitcher: React.FC = () => { setCurrentPlayer(p)}> - {p.name} + {FormatName(p.name)} ) })} diff --git a/src/components/Leaderboard/DoublesLeaderboard.tsx b/src/components/Leaderboard/DoublesLeaderboard.tsx index 91d6ef6..13eca35 100644 --- a/src/components/Leaderboard/DoublesLeaderboard.tsx +++ b/src/components/Leaderboard/DoublesLeaderboard.tsx @@ -99,7 +99,6 @@ const DoublesLeaderboard = () => { const columns: TableColumn[] = [ { - name: "Player 1", cell: row => ( <>
@@ -137,7 +136,6 @@ const DoublesLeaderboard = () => { ), }, { - name: "Player 2", cell: row => (
{ const columns: TableColumn[] = useMemo( () => [ { - name: "Avatar", cell: row => ( {row.name} ), diff --git a/src/components/StartNewGame/StartNewGame.tsx b/src/components/StartNewGame/StartNewGame.tsx index 43d6555..0c56085 100644 --- a/src/components/StartNewGame/StartNewGame.tsx +++ b/src/components/StartNewGame/StartNewGame.tsx @@ -23,6 +23,7 @@ import { useSnackbar } from "notistack" import { customStyles } from "../Tables/CustomStyles" import parseError from "../../utils/ErrorUtils" import moment from "moment" +import { FormatName } from "../../utils/FormattingUtils" const StartNewGame = () => { const dispatch = useAppDispatch() @@ -94,6 +95,7 @@ const StartNewGame = () => { { name: "Player", selector: row => row.name, + format: row => FormatName(row.name), sortable: true, }, { diff --git a/src/utils/FormattingUtils.ts b/src/utils/FormattingUtils.ts new file mode 100644 index 0000000..63f2398 --- /dev/null +++ b/src/utils/FormattingUtils.ts @@ -0,0 +1,10 @@ +export const FormatName = (name: string) => + name + .split(" ") + .map(word => + word.length < 3 + ? word + : word.charAt(0).toUpperCase() + + word.slice(1).toLocaleLowerCase(), + ) + .join(" ")