Translation for appRating

This commit is contained in:
Nicola Benaglia 2025-05-16 07:46:38 +02:00
parent e94ff9ef09
commit d93262fc92
2 changed files with 25 additions and 9 deletions

View File

@ -149,10 +149,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
res(response); res(response);
setInfoSnack({ setInfoSnack({
type: 'success', type: 'success',
message: message: t('core:message.success.rated_app', {
'Successfully rated. Please wait a couple minutes for the network to propogate the changes.', postProcess: 'capitalize',
}),
}); });
setOpenSnack(true); // TODO translate setOpenSnack(true);
} }
}) })
.catch((error) => { .catch((error) => {
@ -166,7 +167,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
(option) => +option.optionName === +newValue (option) => +option.optionName === +newValue
); );
if (isNaN(optionIndex) || optionIndex === -1) if (isNaN(optionIndex) || optionIndex === -1)
throw new Error('Cannot find rating option'); throw new Error(
t('core:message.error.rating_option', {
postProcess: 'capitalize',
})
);
await new Promise((res, rej) => { await new Promise((res, rej) => {
window window
.sendMessage( .sendMessage(
@ -185,8 +190,9 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
res(response); res(response);
setInfoSnack({ setInfoSnack({
type: 'success', type: 'success',
message: message: t('core:message.success.rated_app', {
'Successfully rated. Please wait a couple minutes for the network to propogate the changes.', postProcess: 'capitalize',
}),
}); });
setOpenSnack(true); setOpenSnack(true);
} }
@ -200,7 +206,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
console.log('error', error); console.log('error', error);
setInfoSnack({ setInfoSnack({
type: 'error', type: 'error',
message: error?.message || 'Unable to rate', message:
error?.message ||
t('core:message.error.unable_rate', {
postProcess: 'capitalize',
}),
}); });
setOpenSnack(true); setOpenSnack(true);
} }
@ -210,8 +220,8 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
<div> <div>
<Box <Box
sx={{ sx={{
display: 'flex',
alignItems: 'center', alignItems: 'center',
display: 'flex',
flexDirection: ratingCountPosition === 'top' ? 'column' : 'row', flexDirection: ratingCountPosition === 'top' ? 'column' : 'row',
}} }}
> >
@ -222,8 +232,11 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
(votesInfo?.voteCounts?.length === 6 ? 1 : 0)}{' '} (votesInfo?.voteCounts?.length === 6 ? 1 : 0)}{' '}
{' RATINGS'} {' RATINGS'}
</AppInfoUserName> </AppInfoUserName>
<Spacer height="6px" /> <Spacer height="6px" />
<AppInfoUserName>{value?.toFixed(1)}</AppInfoUserName> <AppInfoUserName>{value?.toFixed(1)}</AppInfoUserName>
<Spacer height="6px" /> <Spacer height="6px" />
</> </>
)} )}

View File

@ -92,7 +92,9 @@
"minting_account_remove": "unable to remove minting account", "minting_account_remove": "unable to remove minting account",
"missing_fields": "missing: {{ fields }}", "missing_fields": "missing: {{ fields }}",
"publish_app": "unable to publish app", "publish_app": "unable to publish app",
"save_qdn": "unable to save to QDN" "rating_option": "cannot find rating option",
"save_qdn": "unable to save to QDN",
"unable_rate": "unable to rate"
}, },
"generic": { "generic": {
"name_available": "{{ name }} is available", "name_available": "{{ name }} is available",
@ -123,6 +125,7 @@
"order_submitted": "your buy order was submitted", "order_submitted": "your buy order was submitted",
"published": "successfully published. Please wait a couple minutes for the network to propogate the changes.", "published": "successfully published. Please wait a couple minutes for the network to propogate the changes.",
"published_qdn": "successfully published to QDN", "published_qdn": "successfully published to QDN",
"rated_app": "successfully rated. Please wait a couple minutes for the network to propogate the changes.",
"request_read": "I have read this request", "request_read": "I have read this request",
"transfer": "the transfer was succesful!" "transfer": "the transfer was succesful!"
} }