mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-27 17:41:20 +00:00
Translate newThread
This commit is contained in:
parent
815a8f7ae3
commit
f1d62fe11b
@ -11,6 +11,7 @@
|
|||||||
"close": "close",
|
"close": "close",
|
||||||
"continue": "continue",
|
"continue": "continue",
|
||||||
"continue_logout": "continue to logout",
|
"continue_logout": "continue to logout",
|
||||||
|
"create_thread": "create thread",
|
||||||
"decline": "decline",
|
"decline": "decline",
|
||||||
"decrypt": "decrypt",
|
"decrypt": "decrypt",
|
||||||
"edit": "edit",
|
"edit": "edit",
|
||||||
@ -19,7 +20,13 @@
|
|||||||
"invite": "invite",
|
"invite": "invite",
|
||||||
"join": "join",
|
"join": "join",
|
||||||
"logout": "logout",
|
"logout": "logout",
|
||||||
"notify": "notify"
|
"new": {
|
||||||
|
"post": "new post",
|
||||||
|
"thread": "new thread"
|
||||||
|
},
|
||||||
|
"notify": "notify",
|
||||||
|
"post": "post",
|
||||||
|
"post_message": "post message"
|
||||||
},
|
},
|
||||||
"core": {
|
"core": {
|
||||||
"block_height": "block height",
|
"block_height": "block height",
|
||||||
@ -50,6 +57,7 @@
|
|||||||
"error": {
|
"error": {
|
||||||
"generic": "an error occurred",
|
"generic": "an error occurred",
|
||||||
"incorrect_password": "incorrect password",
|
"incorrect_password": "incorrect password",
|
||||||
|
"missing_field": "missing: {{ field }}",
|
||||||
"save_qdn": "unable to save to QDN"
|
"save_qdn": "unable to save to QDN"
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
@ -66,7 +74,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"minting_status": "minting status",
|
"minting_status": "minting status",
|
||||||
"new_user": "are you a new user?",
|
|
||||||
"page": {
|
"page": {
|
||||||
"last": "last",
|
"last": "last",
|
||||||
"first": "first",
|
"first": "first",
|
||||||
@ -76,6 +83,9 @@
|
|||||||
"payment_notification": "payment notification",
|
"payment_notification": "payment notification",
|
||||||
"price": "price",
|
"price": "price",
|
||||||
"q_mail": "q-mail",
|
"q_mail": "q-mail",
|
||||||
|
"question": {
|
||||||
|
"new_user": "are you a new user?"
|
||||||
|
},
|
||||||
"save_options": {
|
"save_options": {
|
||||||
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
"no_pinned_changes": "you currently do not have any changes to your pinned apps",
|
||||||
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
"overwrite_changes": "the app was unable to download your existing QDN-saved pinned apps. Would you like to overwrite those changes?",
|
||||||
|
@ -48,6 +48,7 @@
|
|||||||
"not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.",
|
"not_part_group": "you are not part of the encrypted group of members. Wait until an admin re-encrypts the keys.",
|
||||||
"only_encrypted": "only unencrypted messages will be displayed.",
|
"only_encrypted": "only unencrypted messages will be displayed.",
|
||||||
"private_key_copied": "private key copied",
|
"private_key_copied": "private key copied",
|
||||||
|
"provide_message": "please provide a first message to the thread",
|
||||||
"secure_place": "keep your private key in a secure place. Do not share!",
|
"secure_place": "keep your private key in a secure place. Do not share!",
|
||||||
"setting_group": "setting up group... please wait."
|
"setting_group": "setting up group... please wait."
|
||||||
},
|
},
|
||||||
@ -56,8 +57,10 @@
|
|||||||
"descrypt_wallet": "error decrypting wallet {{ :errorMessage }}",
|
"descrypt_wallet": "error decrypting wallet {{ :errorMessage }}",
|
||||||
"description_required": "please provide a description",
|
"description_required": "please provide a description",
|
||||||
"group_info": "cannot access group information",
|
"group_info": "cannot access group information",
|
||||||
|
"group_secret_key": "cannot get group secret key",
|
||||||
"name_required": "please provide a name",
|
"name_required": "please provide a name",
|
||||||
"notify_admins": "try notifying an admin from the list of admins below:"
|
"notify_admins": "try notifying an admin from the list of admins below:",
|
||||||
|
"thread_id": "unable to locate thread Id"
|
||||||
},
|
},
|
||||||
"success": {
|
"success": {
|
||||||
"group_creation": "successfully created group. It may take a couple of minutes for the changes to propagate",
|
"group_creation": "successfully created group. It may take a couple of minutes for the changes to propagate",
|
||||||
@ -70,6 +73,8 @@
|
|||||||
"group_join_request": "requested to join Group {{group_name}}: awaiting confirmation",
|
"group_join_request": "requested to join Group {{group_name}}: awaiting confirmation",
|
||||||
"group_join_outcome": "requested to join Group {{group_name}}: success!",
|
"group_join_outcome": "requested to join Group {{group_name}}: success!",
|
||||||
"loading_threads": "loading threads... please wait.",
|
"loading_threads": "loading threads... please wait.",
|
||||||
|
"post_creation": "successfully created post. It may take some time for the publish to propagate",
|
||||||
|
"thread_creation": "successfully created thread. It may take some time for the publish to propagate",
|
||||||
"unbanned_user": "successfully unbanned user. It may take a couple of minutes for the changes to propagate"
|
"unbanned_user": "successfully unbanned user. It may take a couple of minutes for the changes to propagate"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,11 @@ export const NewThread = ({
|
|||||||
// 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 = t('group:message.error.missing_field', {
|
||||||
errorMsg = errMsg; // TODO translate
|
field: missingFieldsString,
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
});
|
||||||
|
errorMsg = errMsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errorMsg) {
|
if (errorMsg) {
|
||||||
@ -213,8 +216,12 @@ export const NewThread = ({
|
|||||||
|
|
||||||
const htmlContent = editorRef.current.getHTML();
|
const htmlContent = editorRef.current.getHTML();
|
||||||
|
|
||||||
if (!htmlContent?.trim() || htmlContent?.trim() === '<p></p>')
|
if (!htmlContent?.trim() || htmlContent?.trim() === '<p></p>') {
|
||||||
throw new Error('Please provide a first message to the thread');
|
const errMsg = t('group:message.generic.provide_message', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
});
|
||||||
|
throw new Error(errMsg);
|
||||||
|
}
|
||||||
|
|
||||||
const fee = await getFee('ARBITRARY');
|
const fee = await getFee('ARBITRARY');
|
||||||
let feeToShow = fee.fee;
|
let feeToShow = fee.fee;
|
||||||
@ -237,6 +244,7 @@ export const NewThread = ({
|
|||||||
delete reply.reply;
|
delete reply.reply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const mailObject: any = {
|
const mailObject: any = {
|
||||||
createdAt: Date.now(),
|
createdAt: Date.now(),
|
||||||
version: 1,
|
version: 1,
|
||||||
@ -249,7 +257,10 @@ export const NewThread = ({
|
|||||||
const secretKey =
|
const secretKey =
|
||||||
isPrivate === false ? null : await getSecretKey(false, true);
|
isPrivate === false ? null : await getSecretKey(false, true);
|
||||||
if (!secretKey && isPrivate) {
|
if (!secretKey && isPrivate) {
|
||||||
throw new Error('Cannot get group secret key');
|
const errMsg = t('group:message.error.group_secret_key', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
});
|
||||||
|
throw new Error(errMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isMessage) {
|
if (!isMessage) {
|
||||||
@ -272,17 +283,18 @@ export const NewThread = ({
|
|||||||
isPrivate === false
|
isPrivate === false
|
||||||
? threadToBase64
|
? threadToBase64
|
||||||
: await encryptSingleFunc(threadToBase64, secretKey);
|
: await encryptSingleFunc(threadToBase64, secretKey);
|
||||||
let identifierThread = `grp-${groupInfo.groupId}-thread-${idThread}`;
|
const identifierThread = `grp-${groupInfo.groupId}-thread-${idThread}`;
|
||||||
await publishGroupEncryptedResource({
|
await publishGroupEncryptedResource({
|
||||||
identifier: identifierThread,
|
identifier: identifierThread,
|
||||||
encryptedData: encryptSingleThread,
|
encryptedData: encryptSingleThread,
|
||||||
});
|
});
|
||||||
|
|
||||||
let identifierPost = `thmsg-${identifierThread}-${idMsg}`;
|
const identifierPost = `thmsg-${identifierThread}-${idMsg}`;
|
||||||
await publishGroupEncryptedResource({
|
await publishGroupEncryptedResource({
|
||||||
identifier: identifierPost,
|
identifier: identifierPost,
|
||||||
encryptedData: encryptSingleFirstPost,
|
encryptedData: encryptSingleFirstPost,
|
||||||
});
|
});
|
||||||
|
|
||||||
const dataToSaveToStorage = {
|
const dataToSaveToStorage = {
|
||||||
name: myName,
|
name: myName,
|
||||||
identifier: identifierThread,
|
identifier: identifierThread,
|
||||||
@ -291,6 +303,7 @@ export const NewThread = ({
|
|||||||
created: Date.now(),
|
created: Date.now(),
|
||||||
groupId: groupInfo.groupId,
|
groupId: groupInfo.groupId,
|
||||||
};
|
};
|
||||||
|
|
||||||
const dataToSaveToStoragePost = {
|
const dataToSaveToStoragePost = {
|
||||||
name: myName,
|
name: myName,
|
||||||
identifier: identifierPost,
|
identifier: identifierPost,
|
||||||
@ -299,6 +312,7 @@ export const NewThread = ({
|
|||||||
created: Date.now(),
|
created: Date.now(),
|
||||||
threadId: identifierThread,
|
threadId: identifierThread,
|
||||||
};
|
};
|
||||||
|
|
||||||
await saveTempPublish({ data: dataToSaveToStorage, key: 'thread' });
|
await saveTempPublish({ data: dataToSaveToStorage, key: 'thread' });
|
||||||
await saveTempPublish({
|
await saveTempPublish({
|
||||||
data: dataToSaveToStoragePost,
|
data: dataToSaveToStoragePost,
|
||||||
@ -306,36 +320,32 @@ export const NewThread = ({
|
|||||||
});
|
});
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message:
|
message: t('group:message.success.thread_creation', {
|
||||||
'Successfully created thread. It may take some time for the publish to propagate',
|
postProcess: 'capitalize',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
|
|
||||||
// dispatch(
|
|
||||||
// setNotification({
|
|
||||||
// msg: "Message sent",
|
|
||||||
// alertType: "success",
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
if (publishCallback) {
|
if (publishCallback) {
|
||||||
publishCallback();
|
publishCallback();
|
||||||
}
|
}
|
||||||
closeModal();
|
closeModal();
|
||||||
} else {
|
} else {
|
||||||
if (!currentThread) throw new Error('unable to locate thread Id');
|
if (!currentThread) {
|
||||||
|
const errMsg = t('group:message.error.thread_id', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
});
|
||||||
|
throw new Error(errMsg);
|
||||||
|
}
|
||||||
const idThread = currentThread.threadId;
|
const idThread = currentThread.threadId;
|
||||||
const messageToBase64 = await objectToBase64(mailObject);
|
const messageToBase64 = await objectToBase64(mailObject);
|
||||||
const encryptSinglePost =
|
const encryptSinglePost =
|
||||||
isPrivate === false
|
isPrivate === false
|
||||||
? messageToBase64
|
? messageToBase64
|
||||||
: await encryptSingleFunc(messageToBase64, secretKey);
|
: await encryptSingleFunc(messageToBase64, secretKey);
|
||||||
const idMsg = uid.rnd();
|
|
||||||
let identifier = `thmsg-${idThread}-${idMsg}`;
|
|
||||||
const res = await publishGroupEncryptedResource({
|
|
||||||
identifier: identifier,
|
|
||||||
encryptedData: encryptSinglePost,
|
|
||||||
});
|
|
||||||
|
|
||||||
|
const idMsg = uid.rnd();
|
||||||
|
const identifier = `thmsg-${idThread}-${idMsg}`;
|
||||||
const dataToSaveToStoragePost = {
|
const dataToSaveToStoragePost = {
|
||||||
threadId: idThread,
|
threadId: idThread,
|
||||||
name: myName,
|
name: myName,
|
||||||
@ -348,32 +358,17 @@ export const NewThread = ({
|
|||||||
data: dataToSaveToStoragePost,
|
data: dataToSaveToStoragePost,
|
||||||
key: 'thread-post',
|
key: 'thread-post',
|
||||||
});
|
});
|
||||||
// await qortalRequest(multiplePublishMsg);
|
|
||||||
// dispatch(
|
|
||||||
// setNotification({
|
|
||||||
// msg: "Message sent",
|
|
||||||
// alertType: "success",
|
|
||||||
// })
|
|
||||||
// );
|
|
||||||
setInfoSnack({
|
setInfoSnack({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message:
|
message: t('group:message.success.post_creation', {
|
||||||
'Successfully created post. It may take some time for the publish to propagate',
|
postProcess: 'capitalize',
|
||||||
|
}),
|
||||||
});
|
});
|
||||||
setOpenSnack(true);
|
setOpenSnack(true);
|
||||||
if (publishCallback) {
|
if (publishCallback) {
|
||||||
publishCallback();
|
publishCallback();
|
||||||
}
|
}
|
||||||
// messageCallback({
|
|
||||||
// identifier,
|
|
||||||
// id: identifier,
|
|
||||||
// name,
|
|
||||||
// service: MAIL_SERVICE_TYPE,
|
|
||||||
// created: Date.now(),
|
|
||||||
// ...mailObject,
|
|
||||||
// });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closeModal();
|
closeModal();
|
||||||
} catch (error: any) {
|
} catch (error: any) {
|
||||||
if (error?.message) {
|
if (error?.message) {
|
||||||
@ -392,6 +387,7 @@ export const NewThread = ({
|
|||||||
const sendMail = () => {
|
const sendMail = () => {
|
||||||
publishQDNResource();
|
publishQDNResource();
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
@ -406,7 +402,15 @@ export const NewThread = ({
|
|||||||
onClick={() => setIsOpen(true)}
|
onClick={() => setIsOpen(true)}
|
||||||
>
|
>
|
||||||
<ComposeIcon />
|
<ComposeIcon />
|
||||||
<ComposeP>{currentThread ? 'New Post' : 'New Thread'}</ComposeP>
|
<ComposeP>
|
||||||
|
{currentThread
|
||||||
|
? t('core:action.new.post', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})
|
||||||
|
: t('core:action.new.thread', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
|
</ComposeP>
|
||||||
</ComposeContainer>
|
</ComposeContainer>
|
||||||
|
|
||||||
<ReusableModal
|
<ReusableModal
|
||||||
@ -432,8 +436,15 @@ export const NewThread = ({
|
|||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NewMessageHeaderP>
|
<NewMessageHeaderP>
|
||||||
{isMessage ? 'Post Message' : 'New Thread'}
|
{isMessage
|
||||||
|
? t('core:action.post_message', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})
|
||||||
|
: t('core:action.new.thread', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
</NewMessageHeaderP>
|
</NewMessageHeaderP>
|
||||||
|
|
||||||
<CloseContainer
|
<CloseContainer
|
||||||
sx={{
|
sx={{
|
||||||
height: '40px',
|
height: '40px',
|
||||||
@ -447,6 +458,7 @@ export const NewThread = ({
|
|||||||
/>
|
/>
|
||||||
</CloseContainer>
|
</CloseContainer>
|
||||||
</InstanceListHeader>
|
</InstanceListHeader>
|
||||||
|
|
||||||
<InstanceListContainer
|
<InstanceListContainer
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: theme.palette.background.paper,
|
backgroundColor: theme.palette.background.paper,
|
||||||
@ -458,6 +470,7 @@ export const NewThread = ({
|
|||||||
{!isMessage && (
|
{!isMessage && (
|
||||||
<>
|
<>
|
||||||
<Spacer height="10px" />
|
<Spacer height="10px" />
|
||||||
|
|
||||||
<NewMessageInputRow>
|
<NewMessageInputRow>
|
||||||
<Input
|
<Input
|
||||||
id="standard-adornment-name"
|
id="standard-adornment-name"
|
||||||
@ -520,22 +533,22 @@ export const NewThread = ({
|
|||||||
|
|
||||||
<InstanceFooter
|
<InstanceFooter
|
||||||
sx={{
|
sx={{
|
||||||
backgroundColor: theme.palette.background.paper,
|
|
||||||
padding: '20px 42px',
|
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
|
backgroundColor: theme.palette.background.paper,
|
||||||
height: '90px',
|
height: '90px',
|
||||||
|
padding: '20px 42px',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<NewMessageSendButton onClick={sendMail}>
|
<NewMessageSendButton onClick={sendMail}>
|
||||||
{isSending && (
|
{isSending && (
|
||||||
<Box
|
<Box
|
||||||
sx={{
|
sx={{
|
||||||
|
alignItems: 'center',
|
||||||
|
display: 'flex',
|
||||||
height: '100%',
|
height: '100%',
|
||||||
|
justifyContent: 'center',
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
display: 'flex',
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<CircularProgress
|
<CircularProgress
|
||||||
@ -548,7 +561,13 @@ export const NewThread = ({
|
|||||||
)}
|
)}
|
||||||
|
|
||||||
<NewMessageSendP>
|
<NewMessageSendP>
|
||||||
{isMessage ? 'Post' : 'Create Thread'}
|
{isMessage
|
||||||
|
? t('core:action.post', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})
|
||||||
|
: t('core:action.create_thread', {
|
||||||
|
postProcess: 'capitalize',
|
||||||
|
})}
|
||||||
</NewMessageSendP>
|
</NewMessageSendP>
|
||||||
|
|
||||||
{isMessage ? (
|
{isMessage ? (
|
||||||
|
@ -36,7 +36,7 @@ export const NewUsersCTA = ({ balance }) => {
|
|||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{t('core:new_user', { postProcess: 'capitalize' })}
|
{t('core:question.new_user', { postProcess: 'capitalize' })}
|
||||||
</Typography>
|
</Typography>
|
||||||
|
|
||||||
<Spacer height="20px" />
|
<Spacer height="20px" />
|
||||||
|
Loading…
x
Reference in New Issue
Block a user