diff --git a/frontend/src/components/Header/index.tsx b/frontend/src/components/Header/index.tsx index a769204a..e2d1a766 100644 --- a/frontend/src/components/Header/index.tsx +++ b/frontend/src/components/Header/index.tsx @@ -81,14 +81,14 @@ const Header = () => { function redirectToLadder() { navigateToPage({ activity: "ladder", - bracket: isMeta ? BRACKETS.shuffle : bracket, + bracket: isMeta || isShuffleMclass ? BRACKETS.shuffle : bracket, }); } function redirectToActivity() { navigateToPage({ activity: "activity", - bracket: isMeta ? BRACKETS.shuffle : bracket, + bracket: isMeta || isShuffleMclass ? BRACKETS.shuffle : bracket, }); } diff --git a/frontend/src/containers/Profile/PlayerCard/Desktop.tsx b/frontend/src/containers/Profile/PlayerCard/Desktop.tsx index 997f3c97..8de16402 100644 --- a/frontend/src/containers/Profile/PlayerCard/Desktop.tsx +++ b/frontend/src/containers/Profile/PlayerCard/Desktop.tsx @@ -1,42 +1,42 @@ -import { PlayerItemLvl, PlayerImages, PlayerName } from './common'; - -import type { IPlayer } from '@/types'; - -interface IProps { - player: IPlayer; - openArmory?: () => void; -} - -const PlayerImage = ({ player }: IProps) => ( - <> -
- - {player.media?.main_raw && ( - Player - )} - -); - -const PlayerCard = ({ player }: IProps) => { - const openArmory = () => { - const url = `https://worldofwarcraft.blizzard.com/en-gb/character/${player.region}/${player.realm}/${player.name}`; - window.open(url, '_blank'); - }; - - return ( -
- - - - - - -
- ); -}; - -export default PlayerCard; +import { openWowArmory } from '@/utils/urlparts'; +import { PlayerItemLvl, PlayerImages, PlayerName } from './common'; + +import type { IPlayer } from '@/types'; + +interface IProps { + player: IPlayer; + openArmory?: () => void; +} + +const PlayerImage = ({ player }: IProps) => ( + <> +
+ + {player.media?.main_raw && ( + Player + )} + +); + +const PlayerCard = ({ player }: IProps) => { + const openArmory = () => { + openWowArmory(player) + }; + + return ( +
+ + + + + + +
+ ); +}; + +export default PlayerCard; diff --git a/frontend/src/containers/Profile/PlayerCard/Modile.tsx b/frontend/src/containers/Profile/PlayerCard/Modile.tsx index a1e80b9a..9a5badb2 100644 --- a/frontend/src/containers/Profile/PlayerCard/Modile.tsx +++ b/frontend/src/containers/Profile/PlayerCard/Modile.tsx @@ -1,36 +1,36 @@ -import { PlayerItemLvl, PlayerImages, PlayerName } from './common'; -import type { IPlayer } from '@/types'; - -interface IProps { - player: IPlayer; - openArmory?: () => void; -} - -const PlayerCard = ({ player }: IProps) => { - const openArmory = () => { - const url = `https://worldofwarcraft.blizzard.com/en-gb/character/${player.region}/${player.realm}/${player.name}`; - window.open(url, '_blank'); - }; - - return ( -
- {player.media?.avatar && ( - Player - )} -
-
- - -
- - -
-
- ); -}; - -export default PlayerCard; +import { openWowArmory } from "@/utils/urlparts"; +import { PlayerItemLvl, PlayerImages, PlayerName } from "./common"; +import type { IPlayer } from "@/types"; + +interface IProps { + player: IPlayer; + openArmory?: () => void; +} + +const PlayerCard = ({ player }: IProps) => { + const openArmory = () => { + openWowArmory(player); + }; + + return ( +
+ {player.media?.avatar && ( + Player + )} +
+
+ + +
+ + +
+
+ ); +}; + +export default PlayerCard; diff --git a/frontend/src/utils/urlparts.ts b/frontend/src/utils/urlparts.ts index ba5554c2..52862060 100644 --- a/frontend/src/utils/urlparts.ts +++ b/frontend/src/utils/urlparts.ts @@ -1,3 +1,4 @@ +import { IPlayer } from '@/types'; import { BRACKETS } from '../constants/pvp-activity'; import { REGION } from '../constants/region'; @@ -36,3 +37,9 @@ export function capitalizeNickname(nickname?: string) { ? `${name}-${realm} ${capitalize(nicknameParts[2])}` : `${name}-${realm}`; } + +export function openWowArmory(player: IPlayer) { + const fixedRealm = player.realm.replaceAll("'", "") + const url = `https://worldofwarcraft.blizzard.com/en-gb/character/${player.region}/${fixedRealm}/${player.name}`; + window.open(url, '_blank'); +}