Skip to content

Commit

Permalink
Merge pull request #209 from Andres2D/improve-full-time-design
Browse files Browse the repository at this point in the history
Improve full time design
  • Loading branch information
Andres2D authored Feb 18, 2023
2 parents db71c6f + 5ad9058 commit 2f6bdc7
Show file tree
Hide file tree
Showing 13 changed files with 85 additions and 14 deletions.
6 changes: 6 additions & 0 deletions components/matches/detail/avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,16 @@ const AvatarMatchLayout: NextPage<Props> = ({
: details.match.home_team.showStats;

const changePlayerHandler = () => {
if(details.match.fullTime) {
return;
}
dispatch(matchDetailsActions.toggleChangePlayerModal());
};

const selectPlayerHandler = () => {
if(details.match.fullTime) {
return;
}
dispatch(matchDetailsActions.selectPlayer({ playerId: id, isAway }));

if (
Expand Down
2 changes: 2 additions & 0 deletions components/matches/detail/field/field.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const FieldLayout: NextPage<Props> = ({team, isAway}) => {
teamShield={matchDetails.match[teamKey].shield}
teamOverall={teamAverage}
isAway={isAway}
fullTime={matchDetails.match.fullTime}
/>
<section className={`${styles.field}
${styles[`${formationTypeMap[matchDetails.match[teamKey].formation]}${formationKeyMap[team.length]}`]}`}>
Expand Down Expand Up @@ -113,6 +114,7 @@ const FieldLayout: NextPage<Props> = ({team, isAway}) => {
onChange={updateFormation}
value={matchDetails.match[teamKey].formation}
color={'gray.50'}
disabled={matchDetails.match.fullTime}
>
{ team.length > 0 &&
['t','s','f'].map(op => (
Expand Down
15 changes: 13 additions & 2 deletions components/matches/detail/field/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,18 @@ interface Props {
teamName: string;
teamShield: string;
teamOverall: number;
fullTime: boolean;
isAway?: boolean;
}

const FieldHeader: NextPage<Props> = ({teamName, teamShield, teamOverall, isAway = false}) => {
const FieldHeader: NextPage<Props> = (
{
teamName,
teamShield,
teamOverall,
fullTime,
isAway = false,
}) => {

return (
<header className={`${styles.header} `}>
Expand All @@ -29,7 +37,10 @@ const FieldHeader: NextPage<Props> = ({teamName, teamShield, teamOverall, isAway
/>
<div className={styles.teamDetails}>
<Heading color={'gray.50'} size='2xl'>{teamName}</Heading>
<SetTeam isAway={isAway} />
{
!fullTime &&
<SetTeam isAway={isAway} />
}
</div>
</section>
<RatioStars average={teamOverall} />
Expand Down
2 changes: 1 addition & 1 deletion components/matches/detail/match-detail.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
}

.leaveButton {
margin-top: 30px;
margin: 30px 0;
}
}

Expand Down
17 changes: 10 additions & 7 deletions components/matches/detail/match-detail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ const MatchDetailsLayout: NextPage = () => {
<FieldLayout team={matchDetails.home} />
<FieldLayout team={matchDetails.away} isAway />
</div>
<Button
colorScheme='telegram'
className={styles.leaveButton}
rightIcon={<LeaveIcon />}
onClick={leaveMatchModalOnOpen}
>
{
!matchDetails.match.fullTime &&
<Button
colorScheme='telegram'
className={styles.leaveButton}
rightIcon={<LeaveIcon />}
onClick={leaveMatchModalOnOpen}
>
Leave match
</Button>
</Button>
}
</section>
<ModalAlert
isOpen={leaveMatchModalIsOpen}
Expand Down
9 changes: 9 additions & 0 deletions components/matches/match-list.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@
.details {
color: #f7fafc;
}

.fullTime {
font-weight: bold;
font-size: 20px;
}
}
}
}
Expand Down Expand Up @@ -95,6 +100,10 @@
.containerVS {
flex-direction: row;
margin: 20px;

.versusIcon {
display: none;
}
}
}
}
Expand Down
7 changes: 7 additions & 0 deletions components/matches/match-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,15 @@ const MatchList: NextPage<Props> = ({ matches }) => {
name={home_team.name}
image={home_team.shield}
fullTime={fullTime}
isWinner={homeScore > awayScore}
score={homeScore}
width={120}
height={120}
/>

<div className={styles.containerVS}>
<Image
className={styles.versusIcon}
src={'/images/vs-icon.png'}
alt="Icon versus"
width={55}
Expand All @@ -221,13 +223,18 @@ const MatchList: NextPage<Props> = ({ matches }) => {
<div className={styles.details}>
<h2>{date}</h2>
<h2>{location}</h2>
{
fullTime &&
<h2 className={styles.fullTime}>Full-time</h2>
}
</div>
</div>

<Team
name={away_team.name}
image={away_team.shield}
fullTime={fullTime}
isWinner={awayScore > homeScore}
score={awayScore}
width={120}
height={120}
Expand Down
16 changes: 14 additions & 2 deletions components/matches/team.module.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
@import '../../styles/colors';

.team {
display: flex;
flex-direction: column;
align-items: center;
position: relative;

.tag,
.score {
.tag {
color: #333 !important;
}

Expand All @@ -15,6 +16,17 @@

.score {
margin-top: 5px;
font-weight: bold;
}

.winner {
background-color: $brand;
color: white;
}

.loser {
background-color: $loser;
color: white;
}

.logoShadow {
Expand Down
14 changes: 12 additions & 2 deletions components/matches/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,19 @@ interface Props {
score: number;
width: number;
height: number;
isWinner: boolean;
}

const Team: NextPage<Props> = ({name, image, fullTime, score, width, height}: Props) => {
const Team: NextPage<Props> = (
{
name,
image,
fullTime,
score,
width,
height,
isWinner
}: Props) => {
return (
<div className={styles.team}>
<Image
Expand All @@ -36,7 +46,7 @@ const Team: NextPage<Props> = ({name, image, fullTime, score, width, height}: Pr
size='lg'
variant='solid'
colorScheme='clean'
className={styles.score}
className={`${styles.score} ${ isWinner ? styles.winner : styles.loser}`}
>
{score}
</Tag>
Expand Down
3 changes: 3 additions & 0 deletions interfaces/Match.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export interface IFullMatch extends base {
_id: string;
home_team: IFullTeam;
away_team: IFullTeam;
homeScore: number;
awayScore: number;
fullTime: boolean;
}

export interface IMatchDetailsResponse {
Expand Down
3 changes: 3 additions & 0 deletions mock/match.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const matchDetailsMock: IMatchDetailsResponse = {
formation: 'f',
shield: 'https://media.api-sports.io/football/teams/34.png',
},
awayScore: 0,
fullTime: false,
homeScore: 0
},
home: [
{
Expand Down
3 changes: 3 additions & 0 deletions store/match-details.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ export const initialState: IMatchDetails = {
},
date: '',
location: '',
awayScore: 0,
fullTime: false,
homeScore: 0
},
home: [],
away: [],
Expand Down
2 changes: 2 additions & 0 deletions styles/_colors.scss
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
$skeleton: #B1B1B1;
$brand: #4ECB71;
$loser: #E31E24;

1 comment on commit 2f6bdc7

@vercel
Copy link

@vercel vercel bot commented on 2f6bdc7 Feb 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

cotejoapp – ./

cotejoapp.vercel.app
cotejoapp-andres2d.vercel.app
cotejoapp-git-main-andres2d.vercel.app

Please sign in to comment.