From b172db59ce629895b3061bee1a29dd70bb53118d Mon Sep 17 00:00:00 2001 From: Akhilender Date: Thu, 23 Nov 2023 21:21:33 +0530 Subject: [PATCH] fix: altering the words - Made Latest to Newest Signed-off-by: Akhilender --- public/locales/en.json | 2 +- public/locales/fr.json | 2 +- public/locales/hi.json | 2 +- public/locales/sp.json | 2 +- public/locales/zh.json | 2 +- src/screens/Users/Users.test.tsx | 4 ++-- src/screens/Users/Users.tsx | 10 +++++----- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index bca1313e65..87659aab25 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -140,7 +140,7 @@ "loadingUsers": "Loading Users...", "noUserFound": "No User Found", "sort": "Sort", - "Latest": "Latest First", + "Newest": "Newest First", "Oldest": "Oldest First", "filter": "Filter", "noOrgError": "Organizations not found, please create an organization through dashboard", diff --git a/public/locales/fr.json b/public/locales/fr.json index b7deffca62..06d60d568e 100644 --- a/public/locales/fr.json +++ b/public/locales/fr.json @@ -133,7 +133,7 @@ "noUserFound": "Aucun utilisateur trouvé", "sort": "Trier", "Oldest": "Les plus anciennes d'abord", - "Latest": "Les plus récentes d'abord", + "Newest": "Les plus récentes d'abord", "filter": "Filtre", "roleUpdated": "Rôle mis à jour.", "noResultsFoundFor": "Aucun résultat trouvé pour ", diff --git a/public/locales/hi.json b/public/locales/hi.json index bcd4935c1b..1764972fb0 100644 --- a/public/locales/hi.json +++ b/public/locales/hi.json @@ -132,7 +132,7 @@ "noUserFound": "कोई उपयोगकर्ता नहीं मिला।", "sort": "छांटें", "Oldest": "सबसे पुराना पहले", - "Latest": "सबसे नवीनतम पहले", + "Newest": "सबसे नवीनतम पहले", "filter": "फ़िल्टर", "roleUpdated": "भूमिका अपडेट की गई।", "noResultsFoundFor": "के लिए कोई परिणाम नहीं मिला ", diff --git a/public/locales/sp.json b/public/locales/sp.json index c7484ef383..6af8de6c1f 100644 --- a/public/locales/sp.json +++ b/public/locales/sp.json @@ -132,7 +132,7 @@ "noUserFound": "No se encontró ningún usuario.", "sort": "Ordenar", "Oldest": "Más Antiguas Primero", - "Latest": "Más Recientes Primero", + "Newest": "Más Recientes Primero", "filter": "Filtrar", "roleUpdated": "Rol actualizado.", "noResultsFoundFor": "No se encontraron resultados para ", diff --git a/public/locales/zh.json b/public/locales/zh.json index a7331b3b48..2e0548f9a5 100644 --- a/public/locales/zh.json +++ b/public/locales/zh.json @@ -132,7 +132,7 @@ "noUserFound": "找不到用戶。", "sort": "排序", "Oldest": "最旧的优先", - "Latest": "最新的优先", + "Newest": "最新的优先", "filter": "過濾", "roleUpdated": "角色已更新。", "noResultsFoundFor": "未找到结果 ", diff --git a/src/screens/Users/Users.test.tsx b/src/screens/Users/Users.test.tsx index e76e91ee14..4484518529 100644 --- a/src/screens/Users/Users.test.tsx +++ b/src/screens/Users/Users.test.tsx @@ -179,7 +179,7 @@ describe('Testing Users screen', () => { ); }); - test('Testing sort latest and oldest toggle', async () => { + test('Testing sort Newest and oldest toggle', async () => { await act(async () => { render( @@ -202,7 +202,7 @@ describe('Testing Users screen', () => { const inputText = screen.getByTestId('sortUsers'); fireEvent.click(inputText); - const toggleText = screen.getByTestId('latest'); + const toggleText = screen.getByTestId('newest'); fireEvent.click(toggleText); diff --git a/src/screens/Users/Users.tsx b/src/screens/Users/Users.tsx index 34a5a12453..64a9be1735 100644 --- a/src/screens/Users/Users.tsx +++ b/src/screens/Users/Users.tsx @@ -31,7 +31,7 @@ const Users = (): JSX.Element => { const [hasMore, setHasMore] = useState(true); const [isLoadingMore, setIsLoadingMore] = useState(false); const [searchByName, setSearchByName] = useState(''); - const [sortingOption, setSortingOption] = useState('latest'); + const [sortingOption, setSortingOption] = useState('newest'); const userType = localStorage.getItem('UserType'); const loggedInUserId = localStorage.getItem('id'); @@ -173,7 +173,7 @@ const Users = (): JSX.Element => { ): InterfaceQueryUserListItem[] => { const sortedUsers = [...allUsers]; - if (sortingOption === 'latest') { + if (sortingOption === 'newest') { sortedUsers.sort( (a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime() @@ -242,10 +242,10 @@ const Users = (): JSX.Element => { handleSorting('latest')} - data-testid="latest" + onClick={(): void => handleSorting('newest')} + data-testid="newest" > - {t('Latest')} + {t('Newest')} handleSorting('oldest')}