diff --git a/src/components/admin/dashboard-statistics/CountryStats.tsx b/src/components/admin/dashboard-statistics/CountryStats.tsx index 78d0dc289..6965a63b3 100644 --- a/src/components/admin/dashboard-statistics/CountryStats.tsx +++ b/src/components/admin/dashboard-statistics/CountryStats.tsx @@ -1,177 +1,177 @@ -import React, { useState } from 'react'; - -import AccessTimeIcon from '@mui/icons-material/AccessTime'; -import VisibilityIcon from '@mui/icons-material/Visibility'; -import Box from '@mui/material/Box'; - -import AverageStatsCard from './cards/AverageStatsCard/AverageStatsCard'; -import ClassesExchangesCard from './cards/ClassesExchangesCard/ClassesExchangesCard'; -import StatsCard from './cards/StatsCard/StatsCard'; -import BarCharts from './charts/BarCharts'; -import DashboardTable from './charts/DashboardTable'; -import HorizontalBars from './charts/HorizontalChart'; -import PieCharts from './charts/PieCharts'; -import CountriesDropdown from './filters/CountriesDropdown'; -import PhaseDropdown from './filters/PhaseDropdown'; -import PhaseDetails from './menu/PhaseDetails'; -import { mockClassroomsStats, mockConnectionsStats } from './mocks/mocks'; -import { PelicoCard } from './pelico-card'; -import styles from './styles/charts.module.css'; -import { sumContribution } from './utils/sumData'; -import { useCountries } from 'src/services/useCountries'; - -const pieChartData = { - data: [ - { id: 0, value: 10, label: 'series A' }, - { id: 1, value: 15, label: 'series B' }, - { id: 2, value: 20, label: 'series C' }, - ], -}; - -const barChartData = [{ data: [4, 3, 5] }, { data: [1, 6, 3] }, { data: [2, 5, 6] }]; -const EngagementBarChartTitle = 'Évolution des connexions'; -const ContributionBarChartTitle = 'Contribution des classes'; - -const CountryStats = () => { - const [selectedCountry, setSelectedCountry] = useState(''); - const pelicoMessage = 'Merci de sélectionner un pays pour analyser ses statistiques '; - const { countries } = useCountries(); - const handleCountryChange = (country: string) => { - setSelectedCountry(country); - }; - - const filteredVillage = mockClassroomsStats.filter((village) => village.classroomCountryCode === selectedCountry); - const countryData = sumContribution[selectedCountry]; - - const { totalActivities = 0, totalComments = 0, totalVideos = 0 } = countryData || {}; - - const classStats = mockConnectionsStats.map((classroom) => ({ - registered: classroom.registeredClassroomsCount, - connected: classroom.connectedClassroomsCount, - contributed: classroom.contributedClassroomsCount, - })); - - const connectStats = mockConnectionsStats.map((connect) => ({ - averageConnection: connect.averageConnections, - averageDuration: connect.averageDuration, - minDuration: connect.minDuration, - maxDuration: connect.maxDuration, - medianDuration: connect.medianDuration, - minConnections: connect.minConnections, - maxConnections: connect.maxConnections, - medianConnections: connect.medianConnections, - })); - - return ( - <> -
-
- -
-
- -
-
-

Statut: Observateur

- {!selectedCountry ? ( - - ) : ( - <> -
- -
- - Ce pays participe dans les villages-monde suivants : -
    - {filteredVillage.map((village, index) => ( -
  • {village.villageName}
  • - ))} -
-
-
- -
-
- Nombre de classes inscrites - Nombre de classes connectées - Nombre de classes contributrices -
-
- } - > - Temps de connexion moyen par classe - - } - > - Nombre de connexions moyen par classe - -
-
- - -
-
- - -
-
- -
-
- -
-
- -
- - )} - - ); -}; - -export default CountryStats; +import React, { useState } from 'react'; + +import AccessTimeIcon from '@mui/icons-material/AccessTime'; +import VisibilityIcon from '@mui/icons-material/Visibility'; +import Box from '@mui/material/Box'; + +import AverageStatsCard from './cards/AverageStatsCard/AverageStatsCard'; +import ClassesExchangesCard from './cards/ClassesExchangesCard/ClassesExchangesCard'; +import StatsCard from './cards/StatsCard/StatsCard'; +import BarCharts from './charts/BarCharts'; +import DashboardTable from './charts/DashboardTable'; +import HorizontalBars from './charts/HorizontalChart'; +import PieCharts from './charts/PieCharts'; +import CountriesDropdown from './filters/CountriesDropdown'; +import PhaseDropdown from './filters/PhaseDropdown'; +import PhaseDetails from './menu/PhaseDetails'; +import { mockClassroomsStats, mockConnectionsStats } from './mocks/mocks'; +import { PelicoCard } from './pelico-card'; +import styles from './styles/charts.module.css'; +import { sumContribution } from './utils/sumData'; +import { useCountries } from 'src/services/useCountries'; + +const pieChartData = { + data: [ + { id: 0, value: 10, label: 'series A' }, + { id: 1, value: 15, label: 'series B' }, + { id: 2, value: 20, label: 'series C' }, + ], +}; + +const barChartData = [{ data: [4, 3, 5] }, { data: [1, 6, 3] }, { data: [2, 5, 6] }]; +const EngagementBarChartTitle = 'Évolution des connexions'; +const ContributionBarChartTitle = 'Contribution des classes'; + +const CountryStats = () => { + const [selectedCountry, setSelectedCountry] = useState(''); + const pelicoMessage = 'Merci de sélectionner un pays pour analyser ses statistiques '; + const { countries } = useCountries(); + const handleCountryChange = (country: string) => { + setSelectedCountry(country); + }; + + const filteredVillage = mockClassroomsStats.filter((village) => village.classroomCountryCode === selectedCountry); + const countryData = sumContribution[selectedCountry]; + + const { totalActivities = 0, totalComments = 0, totalVideos = 0 } = countryData || {}; + + const classStats = mockConnectionsStats.map((classroom) => ({ + registered: classroom.registeredClassroomsCount, + connected: classroom.connectedClassroomsCount, + contributed: classroom.contributedClassroomsCount, + })); + + const connectStats = mockConnectionsStats.map((connect) => ({ + averageConnection: connect.averageConnections, + averageDuration: connect.averageDuration, + minDuration: connect.minDuration, + maxDuration: connect.maxDuration, + medianDuration: connect.medianDuration, + minConnections: connect.minConnections, + maxConnections: connect.maxConnections, + medianConnections: connect.medianConnections, + })); + + return ( + <> +
+
+ +
+
+ +
+
+

Statut: Observateur

+ {!selectedCountry ? ( + + ) : ( + <> +
+ +
+ + Ce pays participe dans les villages-monde suivants : +
    + {filteredVillage.map((village, index) => ( +
  • {village.villageName}
  • + ))} +
+
+
+ +
+
+ Nombre de classes inscrites + Nombre de classes connectées + Nombre de classes contributrices +
+
+ } + > + Temps de connexion moyen par classe + + } + > + Nombre de connexions moyen par classe + +
+
+ + +
+
+ + +
+
+ +
+
+ +
+
+ +
+ + )} + + ); +}; + +export default CountryStats; diff --git a/src/components/admin/dashboard-statistics/VillageStats.tsx b/src/components/admin/dashboard-statistics/VillageStats.tsx index ccde5d90d..a12b9d34f 100644 --- a/src/components/admin/dashboard-statistics/VillageStats.tsx +++ b/src/components/admin/dashboard-statistics/VillageStats.tsx @@ -68,6 +68,18 @@ const VillageStats = () => { return ( <> +
+
+ +
+
+ +
+
+ +
+
+

Tableau à venir

@@ -76,17 +88,6 @@ const VillageStats = () => {

Statistiques - En classe

-
-
- -
-
- -
-
- -
-
{!selectedVillage ? ( ) : ( diff --git a/src/components/admin/dashboard-statistics/filters/VillageDropdown.tsx b/src/components/admin/dashboard-statistics/filters/VillageDropdown.tsx index 64821201e..07f5c6509 100644 --- a/src/components/admin/dashboard-statistics/filters/VillageDropdown.tsx +++ b/src/components/admin/dashboard-statistics/filters/VillageDropdown.tsx @@ -24,7 +24,15 @@ export default function VillageDropdown({ villages, onVillageChange }: VillageDr return ( - Village-monde + + Village-monde +