Compare commits

...

2 Commits

Author SHA1 Message Date
daproclaima 23060ddb09 💄(frontend) update member list style
- apply css style to names column
2024-08-08 13:54:33 +02:00
daproclaima f20a6da846 💬(frontend) fix group creation error message
- use a more meaningful error message while creating a group
and its name is already used
- update translations and related e2e tests

closes #293
2024-08-08 13:18:31 +02:00
4 changed files with 28 additions and 3 deletions
@@ -8,7 +8,7 @@ import React, { useEffect, useState } from 'react';
import { useTranslation } from 'react-i18next';
import IconUser from '@/assets/icons/icon-user.svg';
import { Box, Card, TextErrors } from '@/components';
import { Box, Card, Text, TextErrors } from '@/components';
import { useCunninghamTheme } from '@/cunningham';
import { ModalAddMembers } from '@/features/teams/member-add';
import { Role, Team } from '@/features/teams/team-management';
@@ -160,6 +160,15 @@ export const MemberGrid = ({ team, currentRole }: MemberGridProps) => {
{
headerName: t('Names'),
field: 'user.name',
renderCell: ({ row }) => (
<Text
$weight="bold"
$theme="primary"
$css="text-transform: capitalize;"
>
{row.user.name}
</Text>
),
},
{
field: 'user.email',
@@ -1,4 +1,5 @@
import { Input, Loader } from '@openfun/cunningham-react';
import { t } from 'i18next';
import { useEffect, useState } from 'react';
import { APIError } from '@/api';
@@ -23,6 +24,18 @@ export const InputTeamName = ({
}: InputTeamNameProps) => {
const [isInputError, setIsInputError] = useState(isError);
const causes = error?.cause?.map((cause) => {
const isFound = cause === 'Team with this Slug already exists.';
if (isFound) {
cause = t(
'This name is already used for another group. Please enter another one.',
);
}
return cause;
});
useEffect(() => {
if (isError) {
setIsInputError(true);
@@ -42,7 +55,7 @@ export const InputTeamName = ({
}}
state={isInputError ? 'error' : 'default'}
/>
{isError && error && <TextErrors causes={error.cause} />}
{isError && error && <TextErrors causes={causes} />}
{isPending && (
<Box $align="center">
<Loader />
@@ -135,6 +135,7 @@
"This accessibility statement applies to La Régie (Suite Territoriale)": "Cette déclaration daccessibilité sapplique à La Régie (Suite Territoriale)",
"This allows us to measure the number of visits and understand which pages are the most viewed.": "Cela nous permet de mesurer le nombre de visites et de comprendre quelles pages sont les plus consultées.",
"This email prefix is already used.": "Ce préfixe d'email est déjà utilisé.",
"This name is already used for another group. Please enter another one.": "Un autre groupe utilise déjà ce nom. Veuillez en saisir un autre.",
"This procedure is to be used in the following case: you have reported to the website \n manager an accessibility defect which prevents you from accessing content or one of the \n portal's services and you have not obtained a satisfactory response.": "Cette procédure est à utiliser dans le cas suivant : vous avez signalé au responsable du site internet un défaut daccessibilité qui vous empêche daccéder à un contenu ou à un des services du portail et vous navez pas obtenu de réponse satisfaisante.",
"This site does not display a cookie consent banner, why?": "Ce site n'affiche pas de bannière de consentement des cookies, pourquoi?",
"This site places a small text file (a \"cookie\") on your computer when you visit it.": "Ce site place un petit fichier texte (un « cookie ») sur votre ordinateur lorsque vous le visitez.",
@@ -108,7 +108,9 @@ test.describe('Teams Create', () => {
await page.getByRole('button', { name: 'Create the team' }).click();
await expect(
page.getByText('Team with this Slug already exists.'),
page.getByText(
'This name is already used for another group. Please enter another one.',
),
).toBeVisible();
});