@@ -195,7 +255,15 @@ export function Cards({ pairsCount = 3, previewSeconds = 5 }) {
>
)}
- {status === STATUS_IN_PROGRESS ?
: null}
+ {status === STATUS_IN_PROGRESS ? (
+ <>
+
+

+
{counterPerk}
+
+
+ >
+ ) : null}
@@ -210,13 +278,17 @@ export function Cards({ pairsCount = 3, previewSeconds = 5 }) {
))}
+ {isEasyMode &&
{title}
+ {isLeader && (
+
+
+
+
+ )}
Затраченное время:
{gameDurationMinutes.toString().padStart("2", "0")}.{gameDurationSeconds.toString().padStart("2", "0")}
+
+
+ Перейти к лидерборду
+
);
}
diff --git a/src/components/EndGameModal/EndGameModal.module.css b/src/components/EndGameModal/EndGameModal.module.css
index 9368cb8b5..e76386dee 100644
--- a/src/components/EndGameModal/EndGameModal.module.css
+++ b/src/components/EndGameModal/EndGameModal.module.css
@@ -1,12 +1,13 @@
.modal {
width: 480px;
- height: 459px;
+ /* height: 459px; */
border-radius: 12px;
background: #c2f5ff;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
+ padding: 40px 0 48px 0;
}
.image {
@@ -23,10 +24,44 @@
font-style: normal;
font-weight: 400;
line-height: 48px;
+ text-align: center;
margin-bottom: 28px;
}
+.leaderboardInfo {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+}
+
+.nameInput {
+ width: 246px;
+ box-sizing: border-box;
+ outline: none;
+ border: none;
+ padding: 5px 10px;
+ border-radius: 10px;
+ height: 45px;
+ font-size: 24px;
+ margin-bottom: 20px;
+ text-align: center;
+}
+
+.nameInput::placeholder {
+ color: rgb(153, 153, 153);
+ font-family: StratosSkyeng;
+ font-size: 24px;
+ font-weight: 400;
+ /* line-height: 32px; */
+ letter-spacing: 0%;
+ text-align: center;
+}
+
+.saveButton {
+ font-size: 18px;
+}
+
.description {
color: #000;
font-variant-numeric: lining-nums proportional-nums;
@@ -37,6 +72,7 @@
line-height: 32px;
margin-bottom: 10px;
+ margin-top: 10px;
}
.time {
@@ -49,3 +85,12 @@
margin-bottom: 40px;
}
+
+.leaderboardLink {
+ color: rgb(0, 73, 128);
+ font-family: StratosSkyeng;
+ font-size: 18px;
+ font-weight: 400;
+ line-height: 32px;
+ margin-top: 18px;
+}
\ No newline at end of file
diff --git a/src/components/Leaderboard/Leaderboard.jsx b/src/components/Leaderboard/Leaderboard.jsx
new file mode 100644
index 000000000..dd2704eba
--- /dev/null
+++ b/src/components/Leaderboard/Leaderboard.jsx
@@ -0,0 +1,65 @@
+import { Link } from "react-router-dom";
+import { Button } from "../Button/Button";
+import { LeaderboardRow } from "../LeaderboardRow/LeaderboardRow";
+import styles from "./Leaderboard.module.css";
+import cn from "classnames";
+import { useLeaders } from "../../hooks/useLeaders";
+import { useEffect, useState } from "react";
+import { getLeaders } from "../../api";
+
+export function Leaderboard() {
+ const { leaders, setLeaders } = useLeaders();
+ const [isLoading, setIsLoading] = useState(false);
+
+ useEffect(() => {
+ setIsLoading(true);
+
+ getLeaders()
+ .then(response => {
+ const sortedLeaders = response.leaders
+ .map(leader => ({
+ ...leader,
+ name: leader.name.trim() === "" ? "Пользователь" : leader.name,
+ }))
+ .sort((a, b) => a.time - b.time)
+ .slice(0, 10);
+ setLeaders(sortedLeaders);
+ })
+ .finally(() => {
+ setIsLoading(false);
+ });
+ }, [setLeaders]);
+
+ return (
+