Skip to content

Commit

Permalink
Remove floating accounts table since it will be visible in 1n 1Villag…
Browse files Browse the repository at this point in the history
…e tab
  • Loading branch information
Benjyhy committed Oct 17, 2024
1 parent 12fdbe0 commit 51d8747
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions src/components/admin/dashboard-statistics/VillageStats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import styles from './styles/charts.module.css';
import { useGetVillagesStats } from 'src/api/statistics/statistics.get';
import { useCountries } from 'src/services/useCountries';
import { useVillages } from 'src/services/useVillages';
import type { FamiliesWithoutAccount, FloatingAccount, OneVillageTableRow } from 'types/statistics.type';
import type { FamiliesWithoutAccount, OneVillageTableRow } from 'types/statistics.type';
import type { VillageFilter } from 'types/village.type';

const VillageStats = () => {
Expand All @@ -36,13 +36,10 @@ const VillageStats = () => {
}, [selectedCountry]);

const [familiesWithoutAccountRows, setFamiliesWithoutAccountRows] = React.useState<Array<OneVillageTableRow>>([]);
const [floatingAccountsRows, setFloatingAccountsRows] = React.useState<Array<OneVillageTableRow>>([]);
React.useEffect(() => {
if (villagesStats.data?.familiesWithoutAccount) {
setFamiliesWithoutAccountRows([]);
setFloatingAccountsRows([]);
setFamiliesWithoutAccountRows(createFamiliesWithoutAccountRows(villagesStats.data?.familiesWithoutAccount));
setFloatingAccountsRows(createFloatingAccountsRows(villagesStats.data?.floatingAccounts));
}
}, [villagesStats.data?.familiesWithoutAccount, villagesStats.data?.floatingAccounts]);

Expand Down Expand Up @@ -78,12 +75,6 @@ const VillageStats = () => {
{ key: 'country', label: 'Pays', sortable: true },
{ key: 'creationDate', label: 'Date de création identifiant', sortable: true },
];
const FloatingAccountsHeaders = [
{ key: 'family', label: 'Nom Prénom Famille', sortable: true },
{ key: 'language', label: 'Langue', sortable: true },
{ key: 'email', label: 'Mail', sortable: true },
{ key: 'creationDate', label: 'Date de création compte', sortable: true },
];
function CustomTabPanel(props: TabPanelProps) {
const { children, value, index, ...other } = props;

Expand All @@ -109,17 +100,6 @@ const VillageStats = () => {
};
});
}
function createFloatingAccountsRows(data: Array<FloatingAccount>): Array<OneVillageTableRow> {
return data.map((row) => {
return {
id: row.id,
family: `${row.firstname} ${row.lastname}`,
language: row.language,
email: row.email,
creationDate: 'À venir',
};
});
}
return (
<>
<Box
Expand Down Expand Up @@ -159,13 +139,6 @@ const VillageStats = () => {
columns={FamiliesWithoutAccountHeaders}
titleContent={`À surveiller : comptes non créés (${familiesWithoutAccountRows.length})`}
/>
<OneVillageTable
admin={false}
emptyPlaceholder={<p>{noDataFoundMessage}</p>}
data={floatingAccountsRows}
columns={FloatingAccountsHeaders}
titleContent={`À surveiller : comptes flottants (${floatingAccountsRows.length})`}
/>
<Box
className={styles.classroomStats}
sx={{
Expand Down

0 comments on commit 51d8747

Please sign in to comment.