Skip to content

Commit

Permalink
Merge pull request #384 from ungdev/dev
Browse files Browse the repository at this point in the history
Merge master
  • Loading branch information
Suboyyy authored Sep 19, 2024
2 parents 7b32183 + 0dd38de commit b3a8f5a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/(dashboard)/admin/users/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const columnTitles = {
scannedLabel: 'Scanné',
permissionsLabel: 'Permissions',
teamName: 'Équipe',
status: 'Rôle',
tournamentName: 'Tournoi',
place: 'Place',
};
Expand Down Expand Up @@ -79,6 +80,7 @@ const Users = () => {
lockedLabel: true,
paidLabel: true,
scannedLabel: true,
status: true,
permissionsLabel: true,
teamName: true,
tournamentName: true,
Expand Down
4 changes: 1 addition & 3 deletions src/modules/register.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@ export const registerUser = async (user: RegisterUser) => {
return;
}

delete user.passwordConfirmation;
delete user.legalRepresentativeAccepted;
await API.post('auth/register', user);
await API.post('auth/register', { ...user, passwordConfirmation: undefined, legalRepresentativeAccepted: undefined });
toast.success('Inscription réussie, vérifie tes emails');
return true;
};
Expand Down
18 changes: 17 additions & 1 deletion src/modules/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,31 @@ const initialState: UsersAction = {
};

const format = (users: Array<UserWithTeamAndMessageAndTournamentInfo>) => {
function userType(type: string) {
switch (type) {
case UserType.player:
return 'Joueur';
case UserType.coach:
return 'Coach';
case UserType.spectator:
return 'Spectateur';
case UserType.attendant:
return 'Accompagnateur';
default:
return type;
}
}

return users.map((user) => ({
...user,
fullname: `${user.firstname} ${user.lastname}`,
tournamentName: user.team ? user.team.tournament.name : '',
teamName: user.team ? user.team.name : user.type === UserType.spectator ? '(spectateur)' : '',
teamName: user.team ? user.team.name : '',
lockedLabel: user.team && user.team.lockedAt ? '✔' : '✖',
paidLabel: user.hasPaid ? '✔' : '✖',
scannedLabel: user.scannedAt ? '✔' : '✖',
permissionsLabel: user.permissions.join(', ') || '',
status: user.type ? userType(user.type) : '',
}));
};

Expand Down

0 comments on commit b3a8f5a

Please sign in to comment.