diff --git a/src/Wallets.tsx b/src/Wallets.tsx index 281e07e..20fb5a6 100644 --- a/src/Wallets.tsx +++ b/src/Wallets.tsx @@ -322,7 +322,7 @@ export const Wallets = ({ setExtState, setRawWallet, rawWallet }) => { sx={{ display: 'flex', flexDirection: 'column', - }} + }} // TODO translate > { const object64 = await objectToBase64(objectToSave); const decryptedData = await window.sendMessage( 'ENCRYPT_QORTAL_GROUP_DATA', - { base64: object64, groupId: selectedGroup, @@ -313,7 +312,7 @@ export const AppsPrivate = ({ myName }) => { display: 'flex', flexDirection: 'column', gap: '5px', - }} + }} // TODO translate > diff --git a/src/components/Group/AddGroup.tsx b/src/components/Group/AddGroup.tsx index e9e9515..f9cbbf8 100644 --- a/src/components/Group/AddGroup.tsx +++ b/src/components/Group/AddGroup.tsx @@ -371,7 +371,6 @@ export const AddGroup = ({ address, open, setOpen }) => { }} > + setValue(e.target.value)} /> + + + + + { const [promotionTimeInterval, setPromotionTimeInterval] = useAtom( promotionTimeIntervalAtom ); - const [isExpanded, setIsExpanded] = React.useState(false); - const [openSnack, setOpenSnack] = useState(false); const [infoSnack, setInfoSnack] = useState(null); const [fee, setFee] = useState(null); @@ -99,7 +96,6 @@ export const ListOfGroupPromotions = () => { const [isLoadingPublish, setIsLoadingPublish] = useState(false); const { show } = useContext(MyContext); const setTxList = useSetAtom(txListAtom); - const theme = useTheme(); const { t } = useTranslation(['core', 'group']); const listRef = useRef(null); @@ -250,8 +246,9 @@ export const ListOfGroupPromotions = () => { }); setInfoSnack({ type: 'success', - message: - 'Successfully published promotion. It may take a couple of minutes for the promotion to appear', + message: t('group:message.success.group_promotion', { + postProcess: 'capitalize', + }), }); setOpenSnack(true); setText(''); @@ -261,7 +258,10 @@ export const ListOfGroupPromotions = () => { setInfoSnack({ type: 'error', message: - error?.message || 'Error publishing the promotion. Please try again', + error?.message || + t('group:message.error.group_promotion', { + postProcess: 'capitalize', + }), }); setOpenSnack(true); } finally { @@ -290,8 +290,9 @@ export const ListOfGroupPromotions = () => { if (!response?.error) { setInfoSnack({ type: 'success', - message: - 'Successfully requested to join group. It may take a couple of minutes for the changes to propagate', + message: t('group:message.success.group_join', { + postProcess: 'capitalize', + }), }); if (isOpen) { @@ -299,8 +300,14 @@ export const ListOfGroupPromotions = () => { { ...response, type: 'joined-group', - label: `Joined Group ${group?.groupName}: awaiting confirmation`, - labelDone: `Joined Group ${group?.groupName}: success!`, + label: t('group:message.success.group_join_label', { + group_name: group?.groupName, + postProcess: 'capitalize', + }), + labelDone: t('group:message.success.group_join_label', { + group_name: group?.groupName, + postProcess: 'capitalize', + }), done: false, groupId, }, @@ -311,15 +318,20 @@ export const ListOfGroupPromotions = () => { { ...response, type: 'joined-group-request', - label: `Requested to join Group ${group?.groupName}: awaiting confirmation`, - labelDone: `Requested to join Group ${group?.groupName}: success!`, + label: t('group:message.success.group_join_request', { + group_name: group?.groupName, + postProcess: 'capitalize', + }), + labelDone: t('group:message.success.group_join_outcome', { + group_name: group?.groupName, + postProcess: 'capitalize', + }), done: false, groupId, }, ...prev, ]); } - setOpenSnack(true); handlePopoverClose(); res(response); @@ -336,7 +348,9 @@ export const ListOfGroupPromotions = () => { .catch((error) => { setInfoSnack({ type: 'error', - message: error.message || 'An error occurred', + message: + error.message || + t('core:message.error.generic', { postProcess: 'capitalize' }), }); setOpenSnack(true); rej(error); @@ -385,7 +399,7 @@ export const ListOfGroupPromotions = () => { fontSize: '1rem', }} > - Group promotions{' '} + {t('group:group.promotions', { postProcess: 'capitalize' })}{' '} {promotions.length > 0 && ` (${promotions.length})`} @@ -444,7 +458,7 @@ export const ListOfGroupPromotions = () => { fontSize: '12px', }} > - Add Promotion + {t('group.action.add_promotion', { postProcess: 'capitalize' })} @@ -490,7 +504,9 @@ export const ListOfGroupPromotions = () => { color: 'rgba(255, 255, 255, 0.2)', }} > - Nothing to display + {t('group.message.generic.no_display', { + postProcess: 'capitalize', + })} )} @@ -537,23 +553,25 @@ export const ListOfGroupPromotions = () => { ref={rowVirtualizer.measureElement} //measure dynamic row height key={promotion?.identifier} style={{ - position: 'absolute', - top: 0, - left: '50%', // Move to the center horizontally - transform: `translateY(${virtualRow.start}px) translateX(-50%)`, // Adjust for centering - width: '100%', // Control width (90% of the parent) - padding: '10px 0', - display: 'flex', alignItems: 'center', - overscrollBehavior: 'none', + display: 'flex', flexDirection: 'column', gap: '5px', + left: '50%', // Move to the center horizontally + overscrollBehavior: 'none', + padding: '10px 0', + position: 'absolute', + top: 0, + transform: `translateY(${virtualRow.start}px) translateX(-50%)`, // Adjust for centering + width: '100%', // Control width (90% of the parent) }} > - Error loading content: Invalid Data + {t('group.message.generic.invalid_data', { + postProcess: 'capitalize', + })} } > @@ -568,7 +586,7 @@ export const ListOfGroupPromotions = () => { { + onClose={(reason) => { if (reason === 'backdropClick') { // Prevent closing on backdrop click return; @@ -603,7 +621,10 @@ export const ListOfGroupPromotions = () => { fontWeight: 600, }} > - Group name: {` ${promotion?.groupName}`} + {t('group:group.name', { + postProcess: 'capitalize', + })} + : {` ${promotion?.groupName}`} { fontWeight: 600, }} > - Number of members:{' '} - {` ${promotion?.memberCount}`} + {t('group:group.member_number', { + postProcess: 'capitalize', + })} + : {` ${promotion?.memberCount}`} {promotion?.description && ( @@ -634,9 +657,9 @@ export const ListOfGroupPromotions = () => { fontWeight: 600, }} > - *This is a closed/private group, so you - will need to wait until an admin accepts - your request + {t('group:message.generic.closed_group', { + postProcess: 'capitalize', + })} )} @@ -657,7 +680,9 @@ export const ListOfGroupPromotions = () => { variant="contained" onClick={handlePopoverClose} > - Close + {t('core:action.close', { + postProcess: 'capitalize', + })} { ) } > - Join + {t('core:action.join', { + postProcess: 'capitalize', + })} @@ -755,8 +782,12 @@ export const ListOfGroupPromotions = () => { }} > {promotion?.isOpen - ? 'Public group' - : 'Private group'} + ? t('group:group.public', { + postProcess: 'capitalize', + }) + : t('group:group.private', { + postProcess: 'capitalize', + })} @@ -790,7 +821,10 @@ export const ListOfGroupPromotions = () => { color: theme.palette.text.primary, }} > - Join Group: {` ${promotion?.groupName}`} + {t('group:action.join_group', { + postProcess: 'capitalize', + })} + : {` ${promotion?.groupName}`} @@ -810,90 +844,114 @@ export const ListOfGroupPromotions = () => { - {isShowModal && ( - - - {'Promote your group to non-members'} - - - - Only the latest promotion from the week will be shown for your - group. - - - Max 200 characters. Publish Fee: {fee && fee} {' QORT'} - - - + + {t('group:action.promote_group', { postProcess: 'capitalize' })} + + + + + {t('group:message.generic.latest_promotion', { + postProcess: 'capitalize', + })} + + + + {t('group:message.generic.max_chars', { + postProcess: 'capitalize', + })} + : {fee && fee} {' QORT'} + + + + + + + + + + setSelectedGroup(e.target.value)} - variant="outlined" - > - {myGroupsWhereIAmAdmin?.map((group) => { - return ( - - {group?.groupName} - - ); - })} - - - - setText(e.target.value)} - inputProps={{ - maxLength: 200, - }} - multiline={true} - sx={{ - '& .MuiFormLabel-root': { - color: theme.palette.text.primary, - }, - '& .MuiFormLabel-root.Mui-focused': { - color: theme.palette.text.primary, - }, - }} - /> - - - - - - - )} + {myGroupsWhereIAmAdmin?.map((group) => { + return ( + + {group?.groupName} + + ); + })} + + + + + + setText(e.target.value)} + inputProps={{ + maxLength: 200, + }} + multiline={true} + sx={{ + '& .MuiFormLabel-root': { + color: theme.palette.text.primary, + }, + '& .MuiFormLabel-root.Mui-focused': { + color: theme.palette.text.primary, + }, + }} + /> + + + + + + + + { - +export const LoadingSnackbar = ({ open, info }) => { return (
- - + + {info?.message}
); -} \ No newline at end of file +}; diff --git a/src/components/Snackbar/Snackbar.tsx b/src/components/Snackbar/Snackbar.tsx index d79677e..d4315ed 100644 --- a/src/components/Snackbar/Snackbar.tsx +++ b/src/components/Snackbar/Snackbar.tsx @@ -1,4 +1,3 @@ -import * as React from 'react'; import Snackbar, { SnackbarCloseReason } from '@mui/material/Snackbar'; import Alert from '@mui/material/Alert'; diff --git a/src/components/TaskManager/TaskManager.tsx b/src/components/TaskManager/TaskManager.tsx index d49077e..d34bb5e 100644 --- a/src/components/TaskManager/TaskManager.tsx +++ b/src/components/TaskManager/TaskManager.tsx @@ -198,9 +198,11 @@ export const TaskManager = ({ getUserInfo }) => { /> )} + {open ? : } + {txList.map((item) => ( diff --git a/src/i18n/locales/en/core.json b/src/i18n/locales/en/core.json index c819a38..91b7f48 100644 --- a/src/i18n/locales/en/core.json +++ b/src/i18n/locales/en/core.json @@ -27,7 +27,8 @@ }, "notify": "notify", "post": "post", - "post_message": "post message" + "post_message": "post message", + "publish": "publish" }, "admin": "admin", "core": { diff --git a/src/i18n/locales/en/group.json b/src/i18n/locales/en/group.json index 6fba714..5e0db18 100644 --- a/src/i18n/locales/en/group.json +++ b/src/i18n/locales/en/group.json @@ -1,5 +1,6 @@ { "action": { + "add_promotion": "add promotion", "ban": "ban member from group", "cancel_ban": "cancel ban", "copy_private_key": "copy private key", @@ -16,9 +17,11 @@ "load_members": "load members with names", "make_admin": "make an admin", "manage_members": "manage members", + "promote_group": "promote your group to non-members", "refetch_page": "refetch page", "remove_admin": "remove as admin", - "return_to_thread": "return to threads" + "return_to_thread": "return to threads", + "select_group": "select a group" }, "advanced_options": "advanced options", "approval_threshold": "group Approval Threshold (number / percentage of Admins that must approve a transaction)", @@ -36,6 +39,9 @@ "member_number": "number of members", "name": "group name", "open": "open (public)", + "private": "private group", + "promotions": "group promotions", + "public": "public group", "type": "group type" }, "invitation_expiry": "invitation Expiry Time", @@ -46,12 +52,16 @@ "latest_mails": "latest Q-Mails", "message": { "generic": { + "admin_only": "only groups where you are an admin will be shown", "already_in_group": "you are already in this group!", "closed_group": "this is a closed/private group, so you will need to wait until an admin accepts your request", "descrypt_wallet": "decrypting wallet...", "encryption_key": "the group's first common encryption key is in the process of creation. Please wait a few minutes for it to be retrieved by the network. Checking every 2 minutes...", "group_invited_you": "{{group}} has invited you", + "invalid_data": "error loading content: Invalid Data", + "latest_promotion": "only the latest promotion from the week will be shown for your group.", "loading_members": "loading member list with names... please wait.", + "max_chars": " Max 200 characters. Publish Fee", "no_display": "nothing to display", "no_selection": "no group selected", "not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.", @@ -66,6 +76,7 @@ "descrypt_wallet": "error decrypting wallet {{ :errorMessage }}", "description_required": "please provide a description", "group_info": "cannot access group information", + "group_promotion": "error publishing the promotion. Please try again", "group_secret_key": "cannot get group secret key", "name_required": "please provide a name", "notify_admins": "try notifying an admin from the list of admins below:", @@ -87,6 +98,7 @@ "group_leave_name": "left group {{group_name}}: awaiting confirmation", "group_leave_label": "left group {{name}}: success!", "group_member_admin": "successfully made member an admin. It may take a couple of minutes for the changes to propagate", + "group_promotion": "successfully published promotion. It may take a couple of minutes for the promotion to appear", "group_remove_member": "successfully removed member as an admin. It may take a couple of minutes for the changes to propagate", "invitation_cancellation": "successfully canceled invitation. It may take a couple of minutes for the changes to propagate", "invitation_request": "accepted join request: awaiting confirmation",