From ab1e36fd4edd87892d3ca54076b993861544c366 Mon Sep 17 00:00:00 2001 From: Nicola Benaglia Date: Mon, 19 May 2025 23:53:43 +0200 Subject: [PATCH] Add translations --- src/components/Group/BlockedUsersModal.tsx | 1 + src/components/Group/Group.tsx | 1 + src/components/Group/GroupInvites.tsx | 9 ++++---- src/components/Group/GroupJoinRequests.tsx | 6 ++++- src/components/Group/GroupList.tsx | 17 +++++++------- src/components/Group/HomeDesktop.tsx | 22 ++++++------------- src/components/Group/ListOfBans.tsx | 8 ++++++- .../Group/ListOfGroupPromotions.tsx | 16 ++++++-------- src/components/Group/ListOfJoinRequests.tsx | 12 +++++----- .../Group/ListOfThreadPostsWatched.tsx | 4 +++- src/components/Group/ManageMembers.tsx | 18 +++++++-------- src/components/Group/QMailMessages.tsx | 1 + src/components/Group/Settings.tsx | 2 ++ src/components/Group/WalletsAppWrapper.tsx | 6 ++++- src/components/UserLookup.tsx/UserLookup.tsx | 2 +- src/i18n/locales/en/core.json | 7 +++--- 16 files changed, 72 insertions(+), 60 deletions(-) diff --git a/src/components/Group/BlockedUsersModal.tsx b/src/components/Group/BlockedUsersModal.tsx index 4b7a622..aa0ac0a 100644 --- a/src/components/Group/BlockedUsersModal.tsx +++ b/src/components/Group/BlockedUsersModal.tsx @@ -138,6 +138,7 @@ export const BlockedUsersModal = () => { } catch (error) { setOpenSnackGlobal(true); setInfoSnackCustom({ + //TODO translate type: 'error', message: error?.message || 'Unable to block user', }); diff --git a/src/components/Group/Group.tsx b/src/components/Group/Group.tsx index 6e8b56c..165a8ee 100644 --- a/src/components/Group/Group.tsx +++ b/src/components/Group/Group.tsx @@ -2388,6 +2388,7 @@ export const Group = ({ : 'flex', }} > + { const [groupsWithJoinRequests, setGroupsWithJoinRequests] = useState([]); const [isExpanded, setIsExpanded] = useState(false); - const [loading, setLoading] = useState(true); + const { t } = useTranslation(['auth', 'core', 'group']); + const theme = useTheme(); const getJoinRequests = async () => { try { @@ -37,9 +38,6 @@ export const GroupInvites = ({ myAddress, setOpenAddGroup }) => { } }; - const { t } = useTranslation(['auth', 'core', 'group']); - const theme = useTheme(); - useEffect(() => { if (myAddress) { getJoinRequests(); @@ -75,6 +73,7 @@ export const GroupInvites = ({ myAddress, setOpenAddGroup }) => { {groupsWithJoinRequests?.length > 0 && ` (${groupsWithJoinRequests?.length})`} + {isExpanded ? ( { )} + {!loading && groupsWithJoinRequests.length === 0 && ( { )} + 0 && ` (${filteredJoinRequests?.filter((group) => group?.data?.length > 0)?.length})`} + {isExpanded ? ( )} + )} + {!loading && (filteredJoinRequests.length === 0 || filteredJoinRequests?.filter((group) => group?.data?.length > 0) @@ -212,6 +215,7 @@ export const GroupJoinRequests = ({ )} + diff --git a/src/components/Group/GroupList.tsx b/src/components/Group/GroupList.tsx index b9b0433..156d744 100644 --- a/src/components/Group/GroupList.tsx +++ b/src/components/Group/GroupList.tsx @@ -29,7 +29,6 @@ import { isRunningPublicNodeAtom, timestampEnterDataSelector, } from '../../atoms/global'; - import { timeDifferenceForNotificationChats } from './Group'; import { useAtom, useAtomValue } from 'jotai'; import { useTranslation } from 'react-i18next'; @@ -56,23 +55,23 @@ export const GroupList = ({ return (
@@ -296,7 +295,7 @@ const GroupItem = React.memo( theme.palette.text.primary, fontSize: '16px', }, - }} // Change the color of the primary text + }} secondaryTypographyProps={{ style: { color: diff --git a/src/components/Group/HomeDesktop.tsx b/src/components/Group/HomeDesktop.tsx index e5e0d4e..a5cf85e 100644 --- a/src/components/Group/HomeDesktop.tsx +++ b/src/components/Group/HomeDesktop.tsx @@ -1,5 +1,5 @@ import { Box, Divider, Typography, useTheme } from '@mui/material'; -import React from 'react'; +import { useEffect, useMemo, useState } from 'react'; import { Spacer } from '../../common/Spacer'; import { ThingsToDoInitial } from './ThingsToDoInitial'; import { GroupJoinRequests } from './GroupJoinRequests'; @@ -28,28 +28,28 @@ export const HomeDesktop = ({ setDesktopViewMode, desktopViewMode, }) => { - const [checked1, setChecked1] = React.useState(false); - const [checked2, setChecked2] = React.useState(false); + const [checked1, setChecked1] = useState(false); + const [checked2, setChecked2] = useState(false); const { t } = useTranslation(['auth', 'core', 'group']); const theme = useTheme(); - React.useEffect(() => { + useEffect(() => { if (balance && +balance >= 6) { setChecked1(true); } }, [balance]); - React.useEffect(() => { + useEffect(() => { if (name) setChecked2(true); }, [name]); - const isLoaded = React.useMemo(() => { + const isLoaded = useMemo(() => { if (userInfo !== null) return true; return false; }, [userInfo]); - const hasDoneNameAndBalanceAndIsLoaded = React.useMemo(() => { + const hasDoneNameAndBalanceAndIsLoaded = useMemo(() => { if (isLoaded && checked1 && checked2) return true; return false; }, [checked1, isLoaded, checked2]); @@ -136,14 +136,6 @@ export const HomeDesktop = ({ {desktopViewMode === 'home' && ( <> - {/* - - */} {hasDoneNameAndBalanceAndIsLoaded && ( <> { const handleCancelBan = async (address) => { try { const fee = await getFee('CANCEL_GROUP_BAN'); + await show({ message: t('core:message.question.perform_transaction', { action: 'CANCEL_GROUP_BAN', @@ -94,6 +95,7 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { }), publishFee: fee.fee + ' QORT', }); + setIsLoadingUnban(true); new Promise((res, rej) => { window @@ -125,7 +127,11 @@ export const ListOfBans = ({ groupId, setInfoSnack, setOpenSnack, show }) => { .catch((error) => { setInfoSnack({ type: 'error', - message: error.message || 'An error occurred', + message: + error.message || + t('core:message.error.generic', { + postProcess: 'capitalizeFirst', + }), }); setOpenSnack(true); rej(error); diff --git a/src/components/Group/ListOfGroupPromotions.tsx b/src/components/Group/ListOfGroupPromotions.tsx index eb35dfe..a133c30 100644 --- a/src/components/Group/ListOfGroupPromotions.tsx +++ b/src/components/Group/ListOfGroupPromotions.tsx @@ -1,10 +1,4 @@ -import React, { - useCallback, - useContext, - useEffect, - useRef, - useState, -} from 'react'; +import { useCallback, useContext, useEffect, useRef, useState } from 'react'; import { Avatar, Box, @@ -88,7 +82,7 @@ export const ListOfGroupPromotions = () => { const [promotionTimeInterval, setPromotionTimeInterval] = useAtom( promotionTimeIntervalAtom ); - const [isExpanded, setIsExpanded] = React.useState(false); + const [isExpanded, setIsExpanded] = useState(false); const [openSnack, setOpenSnack] = useState(false); const [infoSnack, setInfoSnack] = useState(null); const [fee, setFee] = useState(null); @@ -101,7 +95,7 @@ export const ListOfGroupPromotions = () => { const listRef = useRef(null); const rowVirtualizer = useVirtualizer({ count: promotions.length, - getItemKey: React.useCallback( + getItemKey: useCallback( (index) => promotions[index]?.identifier, [promotions] ), @@ -495,6 +489,7 @@ export const ListOfGroupPromotions = () => { )} + {!loading && promotions.length === 0 && ( { )} +
{ }} /> )} + {promotion?.isOpen === true && ( { }} /> )} +
diff --git a/src/components/Group/ListOfThreadPostsWatched.tsx b/src/components/Group/ListOfThreadPostsWatched.tsx index fc94ee5..024612f 100644 --- a/src/components/Group/ListOfThreadPostsWatched.tsx +++ b/src/components/Group/ListOfThreadPostsWatched.tsx @@ -117,6 +117,7 @@ export const ListOfThreadPostsWatched = () => { )} + {!loading && posts.length === 0 && ( { )} + {posts?.length > 0 && ( { } > - diff --git a/src/components/Group/ManageMembers.tsx b/src/components/Group/ManageMembers.tsx index 419009e..22c6d0c 100644 --- a/src/components/Group/ManageMembers.tsx +++ b/src/components/Group/ManageMembers.tsx @@ -367,9 +367,9 @@ export const ManageMembers = ({ {value === 0 && (