Skip to content

Commit

Permalink
added data to DB; revealed all tournaments info
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Farmaha committed Sep 7, 2024
1 parent 18c6dc7 commit 1ff9c4a
Show file tree
Hide file tree
Showing 7 changed files with 56 additions and 26 deletions.
13 changes: 13 additions & 0 deletions src/Api/members.json
Original file line number Diff line number Diff line change
Expand Up @@ -1545,5 +1545,18 @@
"forhand": "Справа",
"backhand": "Дворучний",
"joinTennisYear": 1999
},
{
"id": "120",
"name": "Лойко Тетяна",
"birthDate": "2010-01-25",
"avatar": "https://raw.githubusercontent.com/M-Farmaha/100-club/main/src/components/MembersList/avatars/120.jpg",
"sex": "female",
"hometown": "Львів",
"type": "Професіонал",
"category": null,
"forhand": "Справа",
"backhand": "Дворучний",
"joinTennisYear": 2017
}
]
19 changes: 19 additions & 0 deletions src/Api/tournaments.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,25 @@
{ "member_id": "85", "win": 8, "defeat": 0, "position": 1 },
{ "member_id": "76", "win": 4, "defeat": 3, "position": 2 }
]
},
{
"date": "2024-08-24",
"players": [
{ "member_id": "39", "win": 5, "defeat": 1, "position": 1 },
{ "member_id": "57", "win": 0, "defeat": 6, "position": 4 },
{ "member_id": "1", "win": 3, "defeat": 3, "position": 3 },
{ "member_id": "85", "win": 4, "defeat": 2, "position": 2 }
]
},
{
"date": "2024-09-01",
"players": [
{ "member_id": "39", "win": 8, "defeat": 5, "position": 2 },
{ "member_id": "57", "win": 2, "defeat": 10, "position": 5 },
{ "member_id": "1", "win": 9, "defeat": 4, "position": 1 },
{ "member_id": "85", "win": 6, "defeat": 7, "position": 4 },
{ "member_id": "76", "win": 7, "defeat": 6, "position": 3 }
]
}
]
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/LastUpdateSection/LastUpdateSection.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const LastUpdateSection = () => {
<use href={sprite + "#icon-loop"}></use>
</IconSvg>
</IconWrap>
Останнє оновлення: 19.08.2024
Останнє оновлення: 07.09.2024
</Text>
</Section>
</>
Expand Down
Binary file added src/components/MembersList/avatars/120.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 9 additions & 11 deletions src/components/ParticipantNestedPage/ParticipantNestedPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { TitleSection } from "../TitleSection/TitleSection";

import sprite from "../../sprite.svg";
import { getMedalColor } from "../../helpers/getMedalColor";
import { isDateHidden } from "../../helpers/isDateHidden";
// import { isDateHidden } from "../../helpers/isDateHidden";

export const ParticipantNestedPage = () => {
const { globalState } = useStateContext();
Expand All @@ -39,7 +39,7 @@ export const ParticipantNestedPage = () => {
const currentPlayerRank = defineRank(position);
const member = members.find((member) => member.id === playerId);

const isHide = isDateHidden(stageId);
// const isHide = isDateHidden(stageId);

const handleBack = () => {
navigate(`/tournaments/${tournamentId}/${stageId}`);
Expand All @@ -63,16 +63,14 @@ export const ParticipantNestedPage = () => {
<ItemText>
<ButtonIconSvg
color={
isHide
? "var(--player-default-color)"
: getMedalColor(position) || "var(--player-default-color)"
getMedalColor(position) || "var(--player-default-color)"
}
>
<use href={sprite + "#icon-medal"}></use>
</ButtonIconSvg>
Позиція
</ItemText>
<ItemText>{isHide ? "?" : position}</ItemText>
<ItemText>{position}</ItemText>
</ItemWrap>
</Item>

Expand All @@ -84,7 +82,7 @@ export const ParticipantNestedPage = () => {
</ButtonIconSvg>
Рейтинг
</ItemText>
<ItemText>{isHide ? "?" : currentPlayerRank}</ItemText>
<ItemText>{currentPlayerRank}</ItemText>
</ItemWrap>
</Item>

Expand All @@ -108,7 +106,7 @@ export const ParticipantNestedPage = () => {
</ButtonIconSvg>
Kількість перемог
</ItemText>
<ItemText>{isHide ? "?" : win}</ItemText>
<ItemText>{win}</ItemText>
</ItemWrap>
</Item>

Expand All @@ -123,7 +121,7 @@ export const ParticipantNestedPage = () => {
</ButtonIconSvg>
Kількість поразок
</ItemText>
<ItemText>{isHide ? "?" : defeat}</ItemText>
<ItemText>{defeat}</ItemText>
</ItemWrap>
</Item>

Expand All @@ -135,7 +133,7 @@ export const ParticipantNestedPage = () => {
</ButtonIconSvg>
Відсоток перемог
</ItemText>
<ItemText>{isHide ? "?" : winPercentage} %</ItemText>
<ItemText>{winPercentage} %</ItemText>
</ItemWrap>
</Item>

Expand All @@ -150,7 +148,7 @@ export const ParticipantNestedPage = () => {
</ButtonIconSvg>
Відсоток поразок
</ItemText>
<ItemText>{isHide ? "?" : defeatPercentage} %</ItemText>
<ItemText>{defeatPercentage} %</ItemText>
</ItemWrap>
</Item>
</List>
Expand Down
22 changes: 11 additions & 11 deletions src/components/ParticipantsList/ParticipantsItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,56 @@ import {
ItemText,
ItemWrap,
} from "./ParticipantsList-styled";
import { useNavigate, useParams } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import { defineRank } from "../../helpers/defineRank";
import { useStateContext } from "../../state/stateContext";
import { isDateHidden } from "../../helpers/isDateHidden";
// import { isDateHidden } from "../../helpers/isDateHidden";
import { getMedalColor } from "../../helpers/getMedalColor";

export const ParticipantsItem = ({ el, index }) => {
const { globalState } = useStateContext();
const { members } = globalState;
const navigate = useNavigate();

const { id } = useParams();
// const { id } = useParams();
const participant = members.find((member) => member.id === el.member_id);
const participantRank = defineRank(el.position);

const handleItemClick = () => {
navigate(el.member_id);
};

const isHide = isDateHidden(id);
// const isHide = isDateHidden(id);

return (
<>
<Item id={el.member_id} onClick={handleItemClick}>
{!isHide && (
{
<ItemIndictator
style={{ backgroundColor: getMedalColor(el.position) }}
/>
)}
}

<ItemWrap>
<ItemText>{index + 1}.</ItemText>

<ItemText>{participant?.name || "Невідомий учасник"}</ItemText>

<ItemText>{isHide ? "?" : el.win}</ItemText>
<ItemText>{el.win}</ItemText>

<ItemText>{isHide ? "?" : el.defeat}</ItemText>
<ItemText>{el.defeat}</ItemText>

<ItemText>{isHide ? "?" : participantRank}</ItemText>
<ItemText>{participantRank}</ItemText>

{!isHide && (
{
<ItemIndictatorBG
style={{
background: `linear-gradient(to right, transparent, ${getMedalColor(
el.position
)})`,
}}
/>
)}
}
</ItemWrap>
</Item>
</>
Expand Down
6 changes: 3 additions & 3 deletions src/components/StagesList/StagesItem.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Item, ItemText, ItemWrap } from "./StagesList-styled";
import { useNavigate } from "react-router-dom";
import { useStateContext } from "../../state/stateContext";
import { isDateHidden } from "../../helpers/isDateHidden";
// import { isDateHidden } from "../../helpers/isDateHidden";
import { getUkrLocaleDate } from "../../helpers/getUkrLocaleDate";

export const StagesItem = ({ el, index }) => {
Expand All @@ -10,7 +10,7 @@ export const StagesItem = ({ el, index }) => {

const navigate = useNavigate();

const isHide = isDateHidden(el.date);
// const isHide = isDateHidden(el.date);

const winner = el?.players?.find((player) => player.position === 1);
const { name } = members?.find((member) => member.id === winner.member_id);
Expand All @@ -26,7 +26,7 @@ export const StagesItem = ({ el, index }) => {
<ItemText>{index + 1}.</ItemText>

<ItemText>{getUkrLocaleDate(el.date)}</ItemText>
<ItemText>{isHide ? "Приховано" : name}</ItemText>
<ItemText>{name}</ItemText>
</ItemWrap>
</Item>
</>
Expand Down

0 comments on commit 1ff9c4a

Please sign in to comment.