Add group namespace

This commit is contained in:
Nicola Benaglia 2025-04-23 23:57:55 +02:00
parent 072f98c25e
commit a70d77c17e
5 changed files with 69 additions and 22 deletions

View File

@ -42,7 +42,7 @@ i18n
escapeValue: false, escapeValue: false,
}, },
lng: navigator.language, lng: navigator.language,
ns: ['auth', 'core', 'tutorial'], ns: ['auth', 'core', 'group', 'tutorial'],
supportedLngs: ['en', 'it', 'es', 'fr', 'de', 'ru'], supportedLngs: ['en', 'it', 'es', 'fr', 'de', 'ru'],
}); });

View File

@ -18,6 +18,9 @@
"loading": "loading...", "loading": "loading...",
"logout": "logout", "logout": "logout",
"minting_status": "minting status", "minting_status": "minting status",
"page": {
"last": "last"
},
"payment_notification": "payment notification", "payment_notification": "payment notification",
"price": "price", "price": "price",
"q_mail": "q-mail", "q_mail": "q-mail",

View File

@ -0,0 +1,34 @@
{
"provide_thread": "please provide a thread title",
"result": {
"cannot": {
"access_name": "Cannot send a message without a access to your name",
"group_info": "Cannot access group information"
}
},
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": "",
"": ""
}

View File

@ -1,5 +1,4 @@
import React, { import React, {
FC,
useCallback, useCallback,
useEffect, useEffect,
useMemo, useMemo,
@ -17,7 +16,6 @@ import {
ComposeIcon, ComposeIcon,
ComposeP, ComposeP,
GroupContainer, GroupContainer,
GroupNameP,
InstanceFooter, InstanceFooter,
InstanceListContainer, InstanceListContainer,
InstanceListContainerRow, InstanceListContainerRow,
@ -58,10 +56,12 @@ import { executeEvent } from '../../../utils/events';
import RefreshIcon from '@mui/icons-material/Refresh'; import RefreshIcon from '@mui/icons-material/Refresh';
import { getArbitraryEndpointReact, getBaseApiReact } from '../../../App'; import { getArbitraryEndpointReact, getBaseApiReact } from '../../../App';
import { addDataPublishesFunc, getDataPublishesFunc } from '../Group'; import { addDataPublishesFunc, getDataPublishesFunc } from '../Group';
import { useTranslation } from 'react-i18next';
const filterOptions = ['Recently active', 'Newest', 'Oldest']; const filterOptions = ['Recently active', 'Newest', 'Oldest'];
export const threadIdentifier = 'DOCUMENT'; export const threadIdentifier = 'DOCUMENT';
export const GroupMail = ({ export const GroupMail = ({
selectedGroup, selectedGroup,
userInfo, userInfo,
@ -82,6 +82,7 @@ export const GroupMail = ({
const anchorElInstanceFilter = useRef<any>(null); const anchorElInstanceFilter = useRef<any>(null);
const [tempPublishedList, setTempPublishedList] = useState([]); const [tempPublishedList, setTempPublishedList] = useState([]);
const dataPublishes = useRef({}); const dataPublishes = useRef({});
const { t } = useTranslation(['core']);
const [isLoading, setIsLoading] = useState(false); const [isLoading, setIsLoading] = useState(false);
const groupIdRef = useRef<any>(null); const groupIdRef = useRef<any>(null);
@ -627,9 +628,9 @@ export const GroupMail = ({
<ThreadContainer> <ThreadContainer>
<Box <Box
sx={{ sx={{
alignItems: 'center',
display: 'flex', display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
alignItems: 'center',
}} }}
> >
<NewThread <NewThread
@ -667,8 +668,8 @@ export const GroupMail = ({
<Spacer height="30px" /> <Spacer height="30px" />
<Box <Box
sx={{ sx={{
display: 'flex',
alignItems: 'center', alignItems: 'center',
display: 'flex',
justifyContent: 'space-between', justifyContent: 'space-between',
}} }}
> >
@ -682,6 +683,7 @@ export const GroupMail = ({
}} }}
/> />
</Box> </Box>
<Spacer height="30px" /> <Spacer height="30px" />
{combinedListTempAndReal.map((thread) => { {combinedListTempAndReal.map((thread) => {
@ -754,8 +756,8 @@ export const GroupMail = ({
{filterMode === 'Recently active' && ( {filterMode === 'Recently active' && (
<div <div
style={{ style={{
display: 'flex',
alignItems: 'center', alignItems: 'center',
display: 'flex',
}} }}
> >
<ThreadSingleLastMessageP> <ThreadSingleLastMessageP>
@ -776,16 +778,16 @@ export const GroupMail = ({
}, 300); }, 300);
}} }}
sx={{ sx={{
position: 'absolute', alignItems: 'center',
bottom: '2px',
right: '2px',
borderRadius: '5px',
backgroundColor: '#27282c', backgroundColor: '#27282c',
borderRadius: '5px',
bottom: '2px',
cursor: 'pointer',
display: 'flex', display: 'flex',
gap: '10px', gap: '10px',
alignItems: 'center',
padding: '5px', padding: '5px',
cursor: 'pointer', position: 'absolute',
right: '2px',
'&:hover': { '&:hover': {
background: 'rgba(255, 255, 255, 0.60)', background: 'rgba(255, 255, 255, 0.60)',
}, },
@ -795,9 +797,11 @@ export const GroupMail = ({
sx={{ sx={{
color: 'white', color: 'white',
fontSize: '12px', fontSize: '12px',
}} // TODO translate }}
> >
Last page {t('core:page.last', {
postProcess: 'capitalize',
})}
</Typography> </Typography>
<ArrowForwardIosIcon <ArrowForwardIosIcon
sx={{ sx={{

View File

@ -1,11 +1,9 @@
import React, { useEffect, useRef, useState } from 'react'; import React, { useEffect, useRef, useState } from 'react';
import { Box, CircularProgress, Input } from '@mui/material'; import { Box, CircularProgress, Input } from '@mui/material';
import ShortUniqueId from 'short-unique-id'; import ShortUniqueId from 'short-unique-id';
import CloseIcon from '@mui/icons-material/Close';
import ModalCloseSVG from '../../../assets/svgs/ModalClose.svg'; import ModalCloseSVG from '../../../assets/svgs/ModalClose.svg';
import ComposeIconSVG from '../../../assets/svgs/ComposeIcon.svg'; import ComposeIconSVG from '../../../assets/svgs/ComposeIcon.svg';
import { import {
AttachmentContainer,
CloseContainer, CloseContainer,
ComposeContainer, ComposeContainer,
ComposeIcon, ComposeIcon,
@ -30,6 +28,7 @@ import TipTap from '../../Chat/TipTap';
import { MessageDisplay } from '../../Chat/MessageDisplay'; import { MessageDisplay } from '../../Chat/MessageDisplay';
import { CustomizedSnackbars } from '../../Snackbar/Snackbar'; import { CustomizedSnackbars } from '../../Snackbar/Snackbar';
import { saveTempPublish } from '../../Chat/GroupAnnouncements'; import { saveTempPublish } from '../../Chat/GroupAnnouncements';
import { useTranslation } from 'react-i18next';
const uid = new ShortUniqueId({ length: 8 }); const uid = new ShortUniqueId({ length: 8 });
@ -129,6 +128,7 @@ export const encryptSingleFunc = async (data: string, secretKeyObject: any) => {
console.log(error); console.log(error);
} }
}; };
export const NewThread = ({ export const NewThread = ({
groupInfo, groupInfo,
members, members,
@ -143,8 +143,8 @@ export const NewThread = ({
setPostReply, setPostReply,
isPrivate, isPrivate,
}: NewMessageProps) => { }: NewMessageProps) => {
const { t } = useTranslation(['core', 'group']);
const { show } = React.useContext(MyContext); const { show } = React.useContext(MyContext);
const [isOpen, setIsOpen] = useState<boolean>(false); const [isOpen, setIsOpen] = useState<boolean>(false);
const [value, setValue] = useState(''); const [value, setValue] = useState('');
const [isSending, setIsSending] = useState(false); const [isSending, setIsSending] = useState(false);
@ -183,21 +183,27 @@ export const NewThread = ({
const missingFields: string[] = []; const missingFields: string[] = [];
if (!isMessage && !threadTitle) { if (!isMessage && !threadTitle) {
errorMsg = 'Please provide a thread title'; errorMsg = t('group:provide_thread', {
postProcess: 'capitalize',
});
} }
if (!name) { if (!name) {
errorMsg = 'Cannot send a message without a access to your name'; errorMsg = t('group:result.cannot.access_name', {
postProcess: 'capitalize',
});
} }
if (!groupInfo) { if (!groupInfo) {
errorMsg = 'Cannot access group information'; errorMsg = t('group:result.cannot.group_info', {
} // TODO translate postProcess: 'capitalize',
});
}
// if (!description) missingFields.push('subject') // if (!description) missingFields.push('subject')
if (missingFields.length > 0) { if (missingFields.length > 0) {
const missingFieldsString = missingFields.join(', '); const missingFieldsString = missingFields.join(', ');
const errMsg = `Missing: ${missingFieldsString}`; const errMsg = `Missing: ${missingFieldsString}`;
errorMsg = errMsg; errorMsg = errMsg; // TODO translate
} }
if (errorMsg) { if (errorMsg) {