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