diff --git a/src/components/Calendar/Calendar.tsx b/src/components/Calendar/Calendar.tsx index f0aea84..71ca4dc 100644 --- a/src/components/Calendar/Calendar.tsx +++ b/src/components/Calendar/Calendar.tsx @@ -17,6 +17,7 @@ type CalendarProps = { weekId: number showHeader?: boolean size: number + assetsCdn: string } type CalendarState = { @@ -79,7 +80,7 @@ export const Calendar = (props: CalendarProps) => { dataIndex: "home", width: "40%", render: (homeId: any, record: any) => { - const clubBadge = `${config.API_URL}/static/badges/${record.home.externalId}.png`; + const clubBadge = `${props.assetsCdn}/badges/${record.home.id}.png`; return @@ -106,7 +107,7 @@ export const Calendar = (props: CalendarProps) => { dataIndex: "away", width: "40%", render: (awayId: any, record: any) => { - const clubBadge = `${config.API_URL}/static/badges/${record.away.externalId}.png`; + const clubBadge = `${props.assetsCdn}/badges/${record.away.id}.png`; return diff --git a/src/components/Stats/MatchStats.tsx b/src/components/Stats/MatchStats.tsx index 6a3395e..3251aa1 100644 --- a/src/components/Stats/MatchStats.tsx +++ b/src/components/Stats/MatchStats.tsx @@ -7,6 +7,7 @@ declare type MatchStatsProps = { matchId: number homeScore: number awayScore: number + assetsCdn: string } export const MatchStats = (props: MatchStatsProps) => { @@ -35,13 +36,13 @@ export const MatchStats = (props: MatchStatsProps) => { - +
{`${props.homeScore} - ${props.awayScore}`}
- +
diff --git a/src/pages/GameStatsManagement/GameStatsManagement.tsx b/src/pages/GameStatsManagement/GameStatsManagement.tsx index 5b9c910..6cfa9f2 100644 --- a/src/pages/GameStatsManagement/GameStatsManagement.tsx +++ b/src/pages/GameStatsManagement/GameStatsManagement.tsx @@ -14,6 +14,7 @@ import { useNavigate, useParams } from "react-router-dom"; import { TableStyle } from "./GameStatsManagementStyle"; import { MatchStats } from "@/components/Stats/MatchStats"; import { theme } from "@/styles/theme"; +import { useSelector } from "react-redux"; const GameStatsHeaderTable = (props: { name?: string, score: number, type: string }) => { return ( @@ -72,7 +73,9 @@ type GameStatsManagementState = { export const GameStatsManagement = (props: GameStatsMangementProps) => { const { id } = useParams(); const { t } = useTranslation(); - const navigate = useNavigate(); + const navigate = useNavigate(); + const application = useSelector((state: StoreState) => state.application); + const assetsCdn = application.competition.assetsCdn; const PositionLabels: any = { 0: t("player.coachShort"), @@ -187,7 +190,7 @@ export const GameStatsManagement = (props: GameStatsMangementProps) => { render: (txt: number, rec: any, index: number) => { const player = matchPlayers.find((v: Player) => v.id === txt); const playerPositionColor = getPlayerPositionHexColor(player, theme); - const clubBadge = `${config.API_URL}/static/badges/${player?.clubId === match.home.id ? match.home.externalId : match.away.externalId}.png`; + const clubBadge = `${assetsCdn}/badges/${player?.clubId === match.home.id ? match.home.id : match.away.id}.png`; ++index; return ( @@ -230,7 +233,7 @@ export const GameStatsManagement = (props: GameStatsMangementProps) => { return ( - + { matchStatisticsImportSuccess ? { return ( clubsSuccess && playersSuccess && matchesSuccess && teamSuccess && deadlineInfoSuccess && - - { - (initializedExternally && visibleWeekId && - - - {/* TODO: MATCHDAYSELECTOR */} - - Week {visibleWeekId} - - - ) - || null - } - { - (initializedExternally && - - - - { - {t("pointsPage.statsBlockTitle")} {isPublicRoute ? `"${teamName}"` : ""} - } - {/* {`Managed by ${teamUser?.firstName} ${teamUser?.lastName}`} */} - - - - {t("general.footballLineup")} - - + { + (initializedExternally && visibleWeekId && + + + {/* TODO: MATCHDAYSELECTOR */} + + Week {visibleWeekId} + + + ) + || null + } + { + (initializedExternally && + + + + { + {t("pointsPage.statsBlockTitle")} {isPublicRoute ? `"${teamName}"` : ""} + } + {/* {`Managed by ${teamUser?.firstName} ${teamUser?.lastName}`} */} + + + + {t("general.footballLineup")} + + - - - - { - - {t("pointsPage.overviewBlockTitle")} - - - } - { - matches && matches.length && visibleWeekId ? - - {t("general.footballCalendar")} - - - : null - } - - - ) - } - + onSwap={props.onPlayerSwap} + swapPlayerId={props.swapPlayerId} + swappedFrom={props.swappedFrom} + isSwapAble={false} // todo: implement powersub + /> + + + + { + + {t("pointsPage.overviewBlockTitle")} + + + } + { + matches && matches.length && visibleWeekId ? + + {t("general.footballCalendar")} + + + : null + } + + + ) + } + ); }; diff --git a/src/pages/Team/Team.tsx b/src/pages/Team/Team.tsx index 01d4187..360a0d7 100644 --- a/src/pages/Team/Team.tsx +++ b/src/pages/Team/Team.tsx @@ -82,7 +82,7 @@ export const _Team = (props: AbstractTeamType) => { props.initTeamState(starting, bench, teamName, captainId, budget, undefined, undefined, undefined, [], [], [], viceCaptainId, boosters); }; - + useEffect(() => { if (deadlineInfoSuccess && clubsSuccess && teamSuccess && matchesSuccess) { getTeamInfo(props.visibleWeekId); @@ -170,6 +170,7 @@ export const _Team = (props: AbstractTeamType) => { {t("general.footballCalendar")}