Ott 995 color for players (#349)

* feat(ott-995): add color

* feat(ott-995): add color

* feat(ott-995): fix comments
keep-around/af30b88d367751c9e05a735e4a0467a96238ef47
Zoia 5 years ago committed by GitHub
parent dcabd96b10
commit 8fe0014155
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      src/features/MatchPage/helpers/buildPlaylists.tsx
  2. 10
      src/features/MatchPage/types.tsx
  3. 4
      src/features/MatchPopup/components/GroupedPlayersList/index.tsx
  4. 4
      src/features/MatchPopup/components/PlayersList/index.tsx
  5. 8
      src/features/MatchPopup/components/PlayersList/styled.tsx
  6. 6
      src/features/MatchPopup/components/PlayersListDesktop/index.tsx
  7. 3
      src/features/MatchPopup/components/PlayersListMobile/index.tsx
  8. 4
      src/features/MatchSidePlaylists/index.tsx
  9. 2
      src/requests/getMatchPlaylists.tsx

@ -48,8 +48,14 @@ export const buildPlaylists = (matchPlaylists: MatchPlaylists | null) => {
lexics: matchPlaylists?.lexics, lexics: matchPlaylists?.lexics,
match: getMatchPlaylists(matchPlaylists), match: getMatchPlaylists(matchPlaylists),
players: { players: {
team1: getPlayerPlaylists(matchPlaylists?.players1), team1: {
team2: getPlayerPlaylists(matchPlaylists?.players2), color: matchPlaylists?.color1 || '222222',
list: getPlayerPlaylists(matchPlaylists?.players1),
},
team2: {
color: matchPlaylists?.color2 || 'FFFFFF',
list: getPlayerPlaylists(matchPlaylists?.players2),
},
}, },
} }
return playlists return playlists

@ -46,7 +46,13 @@ export type Playlists = {
lexics?: Lexics, lexics?: Lexics,
match: MatchPlaylistOptions, match: MatchPlaylistOptions,
players: { players: {
team1: PlayerPlaylistOptions, team1: {
team2: PlayerPlaylistOptions, color: string,
list: PlayerPlaylistOptions,
},
team2: {
color: string,
list: PlayerPlaylistOptions,
},
}, },
} }

@ -36,11 +36,13 @@ const useItemsLoadedState = (items: PlayerPlaylistOptions) => {
type Props = { type Props = {
players: PlayerPlaylistOptions, players: PlayerPlaylistOptions,
team: Teams, team: Teams,
teamColor: string,
} }
export const GroupedPlayersList = ({ export const GroupedPlayersList = ({
players, players,
team, team,
teamColor,
}: Props) => { }: Props) => {
const { allLoaded, onLoad } = useItemsLoadedState(players) const { allLoaded, onLoad } = useItemsLoadedState(players)
@ -60,12 +62,14 @@ export const GroupedPlayersList = ({
} }
<PlayersList <PlayersList
team={team} team={team}
teamColor={teamColor}
players={startingPlayers} players={startingPlayers}
allLoaded={allLoaded} allLoaded={allLoaded}
onLoad={onLoad} onLoad={onLoad}
/> />
<PlayersList <PlayersList
team={team} team={team}
teamColor={teamColor}
players={benchedPlayers} players={benchedPlayers}
allLoaded={allLoaded} allLoaded={allLoaded}
onLoad={onLoad} onLoad={onLoad}

@ -24,6 +24,7 @@ type Props = {
onLoad: (id: number) => void, onLoad: (id: number) => void,
players: PlayerPlaylistOptions, players: PlayerPlaylistOptions,
team: Teams, team: Teams,
teamColor: string,
} }
export const PlayersList = ({ export const PlayersList = ({
@ -31,6 +32,7 @@ export const PlayersList = ({
onLoad, onLoad,
players, players,
team, team,
teamColor,
}: Props) => { }: Props) => {
const { handlePlayerClick, match } = useMatchPopupStore() const { handlePlayerClick, match } = useMatchPopupStore()
@ -47,7 +49,7 @@ export const PlayersList = ({
id={player.id} id={player.id}
sportType={match.sportType} sportType={match.sportType}
profileType={ProfileTypes.PLAYERS} profileType={ProfileTypes.PLAYERS}
team={team} teamColor={teamColor}
onLoad={() => onLoad(player.id)} onLoad={() => onLoad(player.id)}
/> />
{player.gk && ( {player.gk && (

@ -72,7 +72,7 @@ export const Button = styled.button`
` `
type LogoProps = { type LogoProps = {
team: Teams, teamColor: string,
} }
export const Logo = styled(ProfileLogo)<LogoProps>` export const Logo = styled(ProfileLogo)<LogoProps>`
@ -80,11 +80,7 @@ export const Logo = styled(ProfileLogo)<LogoProps>`
height: 100%; height: 100%;
object-fit: contain; object-fit: contain;
border-radius: 50%; border-radius: 50%;
background-color: ${({ team }) => ( background-color: ${({ teamColor }) => `#${teamColor}`};
team === Teams.TEAM1
? '#222222'
: '#FFFFFF'
)};
` `
export const NameWrapper = styled.span` export const NameWrapper = styled.span`

@ -43,11 +43,13 @@ export const PlayersListDesktop = () => {
<ListsWrapper> <ListsWrapper>
<GroupedPlayersList <GroupedPlayersList
team={Teams.TEAM1} team={Teams.TEAM1}
players={matchPlaylists.players.team1} teamColor={matchPlaylists.players.team1.color}
players={matchPlaylists.players.team1.list}
/> />
<GroupedPlayersList <GroupedPlayersList
team={Teams.TEAM2} team={Teams.TEAM2}
players={matchPlaylists.players.team2} teamColor={matchPlaylists.players.team2.color}
players={matchPlaylists.players.team2.list}
/> />
</ListsWrapper> </ListsWrapper>
</Wrapper> </Wrapper>

@ -47,7 +47,8 @@ export const PlayersListMobile = () => {
</Tabs> </Tabs>
<GroupedPlayersList <GroupedPlayersList
team={selectedTeam} team={selectedTeam}
players={players} players={players.list}
teamColor={players.color}
/> />
</Wrapper> </Wrapper>
) )

@ -69,13 +69,13 @@ export const MatchSidePlaylists = ({
<List> <List>
<PlayersPlaylists <PlayersPlaylists
teamName={profile?.team1} teamName={profile?.team1}
players={playlists.players.team1} players={playlists.players.team1.list}
selectedMathPlaylist={selectedPlaylist} selectedMathPlaylist={selectedPlaylist}
onSelect={onSelect} onSelect={onSelect}
/> />
<PlayersPlaylists <PlayersPlaylists
teamName={profile?.team2} teamName={profile?.team2}
players={playlists.players.team2} players={playlists.players.team2.list}
selectedMathPlaylist={selectedPlaylist} selectedMathPlaylist={selectedPlaylist}
onSelect={onSelect} onSelect={onSelect}
/> />

@ -56,6 +56,8 @@ export type Lexics = {
export type MatchPlaylists = { export type MatchPlaylists = {
ball_in_play: PlaylistWithDuration, ball_in_play: PlaylistWithDuration,
color1?: string,
color2?: string,
full_game: PlaylistWithDuration, full_game: PlaylistWithDuration,
goals: PlaylistWithDuration, goals: PlaylistWithDuration,
highlights: PlaylistWithDuration, highlights: PlaylistWithDuration,

Loading…
Cancel
Save