Skip to content

Commit 2d360d3

Browse files
committed
Merge branch 'mathis/improve-coaching-infos'
2 parents 1694270 + 2497c43 commit 2d360d3

File tree

9 files changed

+947
-103
lines changed

9 files changed

+947
-103
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"build": "tsc && vite build",
8+
"build": "tsc && yarn test --run && vite build",
99
"preview": "vite preview",
1010
"tauri": "tauri",
1111
"knip": "knip",

src/_common/components/Alert.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
/* eslint-disable react/prop-types */
2-
"use client";
3-
4-
import * as React from "react";
52
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
63
import { cn } from "../utils/utils";
4+
import React from "react";
75

86
const AlertDialog = AlertDialogPrimitive.Root;
97

src/_common/utils/seasons.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ describe("getCurrentSeasonDate", () => {
77
const result = getSeasonDate(testDate);
88

99
expect(result.startDate).toEqual(new Date(2024, 7, 1)); // August 1, 2024
10-
expect(result.endDate).toEqual(new Date(2024, 11, 31)); // December 31, 2024
10+
expect(result.endDate).toEqual(new Date(2025, 6, 31)); // July 31, 2025
1111
});
1212

1313
it("should return correct dates when current date is before season (before September)", () => {
@@ -23,7 +23,15 @@ describe("getCurrentSeasonDate", () => {
2323
const result = getSeasonDate(testDate);
2424

2525
expect(result.startDate).toEqual(new Date(2024, 7, 1)); // August 1, 2024
26-
expect(result.endDate).toEqual(new Date(2024, 11, 31)); // December 31, 2024
26+
expect(result.endDate).toEqual(new Date(2025, 6, 31)); // July 31, 2025
27+
});
28+
29+
it("should handle the transition month (August) correctly", () => {
30+
const testDate = new Date(2024, 7, 4); // August 4, 2024
31+
const result = getSeasonDate(testDate);
32+
33+
expect(result.startDate).toEqual(new Date(2024, 7, 1)); // August 1, 2024
34+
expect(result.endDate).toEqual(new Date(2025, 6, 31)); // July 31, 2025
2735
});
2836

2937
it("should handle year transition correctly", () => {

src/parameters/components/RowerStats.tsx

Lines changed: 25 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { useGetRowerStats } from "../utils/getRowerStats";
99
import { CalculatorIcon } from "@heroicons/react/16/solid";
1010
import { ClockIcon } from "@heroicons/react/16/solid";
1111
import { ChartBarIcon } from "@heroicons/react/16/solid";
12+
import { AcademicCapIcon } from "@heroicons/react/16/solid";
1213

1314
export const RowerStats = ({ rowerId }: { rowerId: string }) => {
1415
const {
@@ -19,8 +20,14 @@ export const RowerStats = ({ rowerId }: { rowerId: string }) => {
1920
const [selectedSeason, setSelectedSeason] = useState(
2021
getSeasonDate(new Date())
2122
);
22-
const { count, totalDuration, mostUsedBoats, mostFrequentPartners } =
23-
useGetRowerStats(rowerId, selectedSeason);
23+
const {
24+
count,
25+
totalDuration,
26+
mostUsedBoats,
27+
mostFrequentPartners,
28+
coachedSessionsCount,
29+
coachedSessionsPercentage,
30+
} = useGetRowerStats(rowerId, selectedSeason);
2431
const { getBoatById, getRowerById } = useClubOverviewStore();
2532

2633
if (count === undefined) return <Loading />;
@@ -39,7 +46,7 @@ export const RowerStats = ({ rowerId }: { rowerId: string }) => {
3946
/>
4047
</div>
4148

42-
<div className="grid grid-cols-3 gap-2">
49+
<div className="grid grid-cols-2 gap-2 mb-4">
4350
<div className="bg-white rounded-lg shadow-sm border p-4 flex items-center gap-4">
4451
<div className="p-3 bg-steel-blue-50 rounded-lg">
4552
<ChartBarIcon className="w-6 h-6 text-steel-blue-600" />
@@ -79,10 +86,24 @@ export const RowerStats = ({ rowerId }: { rowerId: string }) => {
7986
</p>
8087
</div>
8188
</div>
89+
90+
<div className="bg-white rounded-lg shadow-sm border p-4 flex items-center gap-4">
91+
<div className="p-3 bg-steel-blue-50 rounded-lg">
92+
<AcademicCapIcon className="w-6 h-6 text-steel-blue-600" />
93+
</div>
94+
<div>
95+
<h3 className="text-sm text-gray-500 font-medium">
96+
Sessions encadrées
97+
</h3>
98+
<p className="text-xl font-semibold text-gray-900">
99+
{coachedSessionsCount} ({coachedSessionsPercentage.toFixed(2)}%)
100+
</p>
101+
</div>
102+
</div>
82103
</div>
83104

84105
<div className="flex w-full justify-between">
85-
<div className="flex-1 flex flex-col items-start">
106+
<div className="flex-1 flex flex-col items-start">
86107
<h1 className="font-medium text-lg mb-2 mt-4">
87108
Bateaux les plus utilisés
88109
</h1>

0 commit comments

Comments
 (0)