mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-07 08:56:58 +00:00
Add translations
This commit is contained in:
parent
8c4b5d27ed
commit
c849854f58
@ -449,6 +449,7 @@ export const ChatList = ({
|
|||||||
</Button>
|
</Button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{enableMentions && (hasSecretKey || isPrivate === false) && (
|
{enableMentions && (hasSecretKey || isPrivate === false) && (
|
||||||
<ChatOptions
|
<ChatOptions
|
||||||
openQManager={openQManager}
|
openQManager={openQManager}
|
||||||
|
@ -24,7 +24,6 @@ import {
|
|||||||
AppsSearchLeft,
|
AppsSearchLeft,
|
||||||
AppsSearchRight,
|
AppsSearchRight,
|
||||||
} from '../Apps/Apps-styles';
|
} from '../Apps/Apps-styles';
|
||||||
|
|
||||||
import IconClearInput from '../../assets/svgs/ClearInput.svg';
|
import IconClearInput from '../../assets/svgs/ClearInput.svg';
|
||||||
import { CellMeasurerCache } from 'react-virtualized';
|
import { CellMeasurerCache } from 'react-virtualized';
|
||||||
import { getBaseApiReact } from '../../App';
|
import { getBaseApiReact } from '../../App';
|
||||||
@ -60,10 +59,12 @@ export const ChatOptions = ({
|
|||||||
const [searchValue, setSearchValue] = useState('');
|
const [searchValue, setSearchValue] = useState('');
|
||||||
const [selectedMember, setSelectedMember] = useState(0);
|
const [selectedMember, setSelectedMember] = useState(0);
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
const parentRef = useRef(null);
|
const parentRef = useRef(null);
|
||||||
const parentRefMentions = useRef(null);
|
const parentRefMentions = useRef(null);
|
||||||
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
const [lastMentionTimestamp, setLastMentionTimestamp] = useState(null);
|
||||||
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
const [debouncedValue, setDebouncedValue] = useState(''); // Debounced value
|
||||||
|
|
||||||
const messages = useMemo(() => {
|
const messages = useMemo(() => {
|
||||||
return untransformedMessages?.map((item) => {
|
return untransformedMessages?.map((item) => {
|
||||||
if (item?.messageText) {
|
if (item?.messageText) {
|
||||||
@ -80,7 +81,7 @@ export const ChatOptions = ({
|
|||||||
messageText: transformedMessage,
|
messageText: transformedMessage,
|
||||||
};
|
};
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// error
|
console.log(error);
|
||||||
}
|
}
|
||||||
} else return item;
|
} else return item;
|
||||||
});
|
});
|
||||||
@ -102,7 +103,12 @@ export const ChatOptions = ({
|
|||||||
rej(response.error);
|
rej(response.error);
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
rej(error.message || 'An error occurred');
|
rej(
|
||||||
|
error.message ||
|
||||||
|
t('core:message.error.generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@ -154,6 +160,7 @@ export const ChatOptions = ({
|
|||||||
}
|
}
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedMember) {
|
if (selectedMember) {
|
||||||
return messages
|
return messages
|
||||||
.filter(
|
.filter(
|
||||||
@ -165,6 +172,7 @@ export const ChatOptions = ({
|
|||||||
)
|
)
|
||||||
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
.filter((message) =>
|
.filter((message) =>
|
||||||
extractTextFromHTML(
|
extractTextFromHTML(
|
||||||
@ -187,6 +195,7 @@ export const ChatOptions = ({
|
|||||||
)
|
)
|
||||||
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
?.sort((a, b) => b?.timestamp - a?.timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
return messages
|
return messages
|
||||||
.filter((message) =>
|
.filter((message) =>
|
||||||
extractTextFromHTML(message?.decryptedData?.message)?.includes(
|
extractTextFromHTML(message?.decryptedData?.message)?.includes(
|
||||||
@ -251,6 +260,7 @@ export const ChatOptions = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -268,9 +278,12 @@ export const ChatOptions = ({
|
|||||||
color: theme.palette.text.primary,
|
color: theme.palette.text.primary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No results
|
{t('core:message.generic.no_results', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -416,6 +429,7 @@ export const ChatOptions = ({
|
|||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</AppsSearchLeft>
|
</AppsSearchLeft>
|
||||||
|
|
||||||
<AppsSearchRight>
|
<AppsSearchRight>
|
||||||
{searchValue && (
|
{searchValue && (
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
@ -428,6 +442,7 @@ export const ChatOptions = ({
|
|||||||
)}
|
)}
|
||||||
</AppsSearchRight>
|
</AppsSearchRight>
|
||||||
</AppsSearchContainer>
|
</AppsSearchContainer>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@ -445,8 +460,11 @@ export const ChatOptions = ({
|
|||||||
value={selectedMember}
|
value={selectedMember}
|
||||||
>
|
>
|
||||||
<MenuItem value={0}>
|
<MenuItem value={0}>
|
||||||
<em>By member</em>
|
<em>
|
||||||
|
{t('core:sort.by_member', { postProcess: 'capitalizeFirst' })}
|
||||||
|
</em>
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
|
||||||
{members?.map((member) => {
|
{members?.map((member) => {
|
||||||
return (
|
return (
|
||||||
<MenuItem key={member} value={member}>
|
<MenuItem key={member} value={member}>
|
||||||
@ -455,6 +473,7 @@ export const ChatOptions = ({
|
|||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</Select>
|
</Select>
|
||||||
|
|
||||||
{!!selectedMember && (
|
{!!selectedMember && (
|
||||||
<CloseIcon
|
<CloseIcon
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@ -476,9 +495,12 @@ export const ChatOptions = ({
|
|||||||
color: theme.palette.text.secondary,
|
color: theme.palette.text.secondary,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
No results
|
{t('core:message.generic.no_results', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
@ -545,7 +567,9 @@ export const ChatOptions = ({
|
|||||||
<ErrorBoundary
|
<ErrorBoundary
|
||||||
fallback={
|
fallback={
|
||||||
<Typography>
|
<Typography>
|
||||||
Error loading content: Invalid Data
|
{t('group.message.generic.invalid_data', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})}
|
||||||
</Typography>
|
</Typography>
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
@ -567,6 +591,7 @@ export const ChatOptions = ({
|
|||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -606,7 +631,7 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
SEARCH
|
{t('core:action.search', { postProcess: 'capitalizeAll' })}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -629,6 +654,7 @@ export const ChatOptions = ({
|
|||||||
<SearchIcon />
|
<SearchIcon />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<ButtonBase
|
<ButtonBase
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
setMode('default');
|
setMode('default');
|
||||||
@ -646,7 +672,7 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Q-MANAGER
|
{t('core:q_apps.q_manager', { postProcess: 'capitalizeAll' })}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -669,6 +695,7 @@ export const ChatOptions = ({
|
|||||||
<InsertLinkIcon sx={{ color: theme.palette.text.primary }} />
|
<InsertLinkIcon sx={{ color: theme.palette.text.primary }} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</ButtonBase>
|
</ButtonBase>
|
||||||
|
|
||||||
<ContextMenuMentions
|
<ContextMenuMentions
|
||||||
getTimestampMention={getTimestampMention}
|
getTimestampMention={getTimestampMention}
|
||||||
groupId={selectedGroup}
|
groupId={selectedGroup}
|
||||||
@ -689,7 +716,9 @@ export const ChatOptions = ({
|
|||||||
fontWeight: 700,
|
fontWeight: 700,
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
MENTIONED
|
{t('core:message.generic.mentioned', {
|
||||||
|
postProcess: 'capitalizeAll',
|
||||||
|
})}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
placement="left"
|
placement="left"
|
||||||
@ -768,6 +797,7 @@ const ShowMessage = ({ message, goToMessage, messages }) => {
|
|||||||
>
|
>
|
||||||
{message?.senderName?.charAt(0)}
|
{message?.senderName?.charAt(0)}
|
||||||
</Avatar>
|
</Avatar>
|
||||||
|
|
||||||
<Typography
|
<Typography
|
||||||
sx={{
|
sx={{
|
||||||
fontWight: 600,
|
fontWight: 600,
|
||||||
@ -788,6 +818,7 @@ const ShowMessage = ({ message, goToMessage, messages }) => {
|
|||||||
>
|
>
|
||||||
{formatTimestamp(message.timestamp)}
|
{formatTimestamp(message.timestamp)}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Box
|
<Box
|
||||||
style={{
|
style={{
|
||||||
cursor: 'pointer',
|
cursor: 'pointer',
|
||||||
|
@ -18,6 +18,7 @@ import { base64ToUint8Array } from '../../qdn/encryption/group-encryption';
|
|||||||
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
||||||
import { useSetAtom } from 'jotai';
|
import { useSetAtom } from 'jotai';
|
||||||
import { txListAtom } from '../../atoms/global';
|
import { txListAtom } from '../../atoms/global';
|
||||||
|
import { useTranslation } from 'react-i18next';
|
||||||
|
|
||||||
export const CreateCommonSecret = ({
|
export const CreateCommonSecret = ({
|
||||||
groupId,
|
groupId,
|
||||||
@ -39,9 +40,9 @@ export const CreateCommonSecret = ({
|
|||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
const theme = useTheme();
|
const theme = useTheme();
|
||||||
|
const { t } = useTranslation(['auth', 'core', 'group']);
|
||||||
|
|
||||||
const getPublishesFromAdmins = async (admins: string[]) => {
|
const getPublishesFromAdmins = async (admins: string[]) => {
|
||||||
// const validApi = await findUsableApi();
|
|
||||||
const queryString = admins.map((name) => `name=${name}`).join('&');
|
const queryString = admins.map((name) => `name=${name}`).join('&');
|
||||||
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
const url = `${getBaseApiReact()}${getArbitraryEndpointReact()}?mode=ALL&service=DOCUMENT_PRIVATE&identifier=symmetric-qchat-group-${
|
||||||
groupId
|
groupId
|
||||||
@ -55,9 +56,11 @@ export const CreateCommonSecret = ({
|
|||||||
const filterId = adminData.filter(
|
const filterId = adminData.filter(
|
||||||
(data: any) => data.identifier === `symmetric-qchat-group-${groupId}`
|
(data: any) => data.identifier === `symmetric-qchat-group-${groupId}`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (filterId?.length === 0) {
|
if (filterId?.length === 0) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const sortedData = filterId.sort((a: any, b: any) => {
|
const sortedData = filterId.sort((a: any, b: any) => {
|
||||||
// Get the most recent date for both a and b
|
// Get the most recent date for both a and b
|
||||||
const dateA = a.updated ? new Date(a.updated) : new Date(a.created);
|
const dateA = a.updated ? new Date(a.updated) : new Date(a.created);
|
||||||
@ -78,8 +81,13 @@ export const CreateCommonSecret = ({
|
|||||||
pauseAllQueues();
|
pauseAllQueues();
|
||||||
|
|
||||||
const { names } = await getGroupAdmins(groupId);
|
const { names } = await getGroupAdmins(groupId);
|
||||||
|
|
||||||
if (!names.length) {
|
if (!names.length) {
|
||||||
throw new Error('Network error');
|
throw new Error(
|
||||||
|
t('core:message.error.network_generic', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const publish = await getPublishesFromAdmins(names);
|
const publish = await getPublishesFromAdmins(names);
|
||||||
|
|
||||||
@ -92,15 +100,18 @@ export const CreateCommonSecret = ({
|
|||||||
publish.identifier
|
publish.identifier
|
||||||
}?encoding=base64&rebuild=true`
|
}?encoding=base64&rebuild=true`
|
||||||
);
|
);
|
||||||
|
|
||||||
const data = await res.text();
|
const data = await res.text();
|
||||||
|
|
||||||
const decryptedKey: any = await decryptResource(data);
|
const decryptedKey: any = await decryptResource(data);
|
||||||
|
|
||||||
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
const dataint8Array = base64ToUint8Array(decryptedKey.data);
|
||||||
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
const decryptedKeyToObject = uint8ArrayToObject(dataint8Array);
|
||||||
|
|
||||||
if (!validateSecretKey(decryptedKeyToObject))
|
if (!validateSecretKey(decryptedKeyToObject))
|
||||||
throw new Error('SecretKey is not valid');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
if (decryptedKeyToObject) {
|
if (decryptedKeyToObject) {
|
||||||
return decryptedKeyToObject;
|
return decryptedKeyToObject;
|
||||||
@ -113,17 +124,31 @@ export const CreateCommonSecret = ({
|
|||||||
const createCommonSecret = async () => {
|
const createCommonSecret = async () => {
|
||||||
try {
|
try {
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
|
|
||||||
await show({
|
await show({
|
||||||
message: 'Would you like to perform an ARBITRARY transaction?',
|
message: t('core:question.perform_transaction', {
|
||||||
|
action: 'ARBITRARY',
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
publishFee: fee.fee + ' QORT',
|
publishFee: fee.fee + ' QORT',
|
||||||
});
|
});
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
|
|
||||||
const secretKey2 = await getSecretKey();
|
const secretKey2 = await getSecretKey();
|
||||||
|
|
||||||
if (!secretKey2 && secretKey2 !== false)
|
if (!secretKey2 && secretKey2 !== false)
|
||||||
throw new Error('invalid secret key');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
if (secretKey2 && !validateSecretKey(secretKey2))
|
if (secretKey2 && !validateSecretKey(secretKey2))
|
||||||
throw new Error('invalid secret key');
|
throw new Error(
|
||||||
|
t('auth:message.error.invalid_secret_key', {
|
||||||
|
postProcess: 'capitalizeFirst',
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const secretKeyToSend = !secretKey2 ? null : secretKey2;
|
const secretKeyToSend = !secretKey2 ? null : secretKey2;
|
||||||
|
|
||||||
@ -136,8 +161,9 @@ export const CreateCommonSecret = ({
|
|||||||
if (!response?.error) {
|
if (!response?.error) {
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message:
|
message: t('auth:message.success.reencrypted_secret_key', {
|
||||||
'Successfully re-encrypted secret key. It may take a couple of minutes for the changes to propagate. Refresh the group in 5 mins.',
|
postProcess: 'capitalizeFirst',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
setTxList((prev) => [
|
setTxList((prev) => [
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
"remove": "remove",
|
"remove": "remove",
|
||||||
"return_apps_dashboard": "return to Apps Dashboard",
|
"return_apps_dashboard": "return to Apps Dashboard",
|
||||||
"save": "save",
|
"save": "save",
|
||||||
|
"search": "search",
|
||||||
"search_apps": "search for apps",
|
"search_apps": "search for apps",
|
||||||
"select_app_type": "select App Type",
|
"select_app_type": "select App Type",
|
||||||
"select_category": "select Category",
|
"select_category": "select Category",
|
||||||
@ -148,6 +149,7 @@
|
|||||||
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
|
"devmode_local_node": "please use your local node for dev mode! Logout and use Local node.",
|
||||||
"fee_qort": "fee: {{ message }} QORT",
|
"fee_qort": "fee: {{ message }} QORT",
|
||||||
"foreign_fee": "foreign fee: {{ message }}",
|
"foreign_fee": "foreign fee: {{ message }}",
|
||||||
|
"mentioned": "mentioned",
|
||||||
"message_with_image": "this message already has an image",
|
"message_with_image": "this message already has an image",
|
||||||
"name_available": "{{ name }} is available",
|
"name_available": "{{ name }} is available",
|
||||||
"name_benefits": "benefits of a name",
|
"name_benefits": "benefits of a name",
|
||||||
@ -218,6 +220,7 @@
|
|||||||
"q_apps": {
|
"q_apps": {
|
||||||
"about": "about this Q-App",
|
"about": "about this Q-App",
|
||||||
"q_mail": "q-mail",
|
"q_mail": "q-mail",
|
||||||
|
"q_manager": "q-manager",
|
||||||
"q_sandbox": "q-Sandbox"
|
"q_sandbox": "q-Sandbox"
|
||||||
},
|
},
|
||||||
"question": {
|
"question": {
|
||||||
@ -234,6 +237,9 @@
|
|||||||
},
|
},
|
||||||
"server": "server",
|
"server": "server",
|
||||||
"settings": "settings",
|
"settings": "settings",
|
||||||
|
"sort": {
|
||||||
|
"by_member": "by member"
|
||||||
|
},
|
||||||
"supply": "supply",
|
"supply": "supply",
|
||||||
"tags": "tags",
|
"tags": "tags",
|
||||||
"theme": {
|
"theme": {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user