Skip to content

Commit

Permalink
fix: Improved no groups message (#439)
Browse files Browse the repository at this point in the history
  • Loading branch information
josebui authored Jul 5, 2022
1 parent f538bb8 commit 285c4ff
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 deletions.
19 changes: 16 additions & 3 deletions src/group/components/GroupList.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React, { useEffect } from 'react';

import _ from 'lodash/fp';
import { useTranslation } from 'react-i18next';
import { Trans, useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';
import { Link as RouterLink, useSearchParams } from 'react-router-dom';

import { Button, Link, Typography } from '@mui/material';
import { Button, Link, Stack, Typography } from '@mui/material';

import TableResponsive from 'common/components/TableResponsive';
import { useDocumentTitle } from 'common/document';
Expand Down Expand Up @@ -155,7 +155,20 @@ const GroupList = () => {
searchFilterField="name"
searchParams={Object.fromEntries(searchParams.entries())}
onSearchParamsChange={setSearchParams}
emptyMessage={t('group.list_empty')}
emptyMessage={
<Trans i18nKey="group.list_empty">
<Stack spacing={2}>
<Typography>First</Typography>
<Typography>
Prefix
<Link component={RouterLink} to={`/groups/new`}>
to add
</Link>
.
</Typography>
</Stack>
</Trans>
}
tableProps={{
initialSort: [
{
Expand Down
4 changes: 3 additions & 1 deletion src/group/components/GroupList.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ test('GroupList: Empty', async () => {
})
);
await setup();
expect(screen.getByText(/No Groups/i)).toBeInTheDocument();
expect(
screen.getByText(/Double-check the spelling of the group name./i)
).toBeInTheDocument();
});
test('GroupList: Display list', async () => {
const isMember = {
Expand Down
2 changes: 1 addition & 1 deletion src/localization/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"list_column_website": "Website",
"list_column_contact": "Email",
"list_column_members": "Members",
"list_empty": "No Groups",
"list_empty": "<0><0>Double-check the spelling of the group name.</0><1>If your group is missing from Terraso, you can <1>create a group</1>.</1></0>",
"members_list_empty": "No members",
"members_list_leave": "Leave",
"members_list_remove": "Remove",
Expand Down
2 changes: 1 addition & 1 deletion src/localization/locales/es-ES.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"list_column_website": "Sitio web",
"list_column_contact": "Correo electrónico",
"list_column_members": "Miembros",
"list_empty": "No hay grupos",
"list_empty": "<0><0>Verifica la ortografía del nombre del grupo.</0><1>Si tu grupo no está en Terraso, puedes <1>crear un grupo</1>.</1></0>",
"members_list_empty": "No existen miembros",
"membership_view_all": "Ver toda(o)s los miembros",
"members_list_leave": "Abandonar",
Expand Down

0 comments on commit 285c4ff

Please sign in to comment.