mirror of
https://github.com/Qortal/Qortal-Hub.git
synced 2025-06-11 02:36:59 +00:00
Add translations to appRating
This commit is contained in:
parent
3e6d2f5e4b
commit
e94ff9ef09
@ -7,6 +7,7 @@ import { StarFilledIcon } from '../../assets/Icons/StarFilled';
|
||||
import { StarEmptyIcon } from '../../assets/Icons/StarEmpty';
|
||||
import { AppInfoUserName } from './Apps-styles';
|
||||
import { Spacer } from '../../common/Spacer';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
|
||||
const [value, setValue] = useState(0);
|
||||
@ -19,6 +20,7 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
|
||||
const [openSnack, setOpenSnack] = useState(false);
|
||||
const [infoSnack, setInfoSnack] = useState(null);
|
||||
const hasCalledRef = useRef(false);
|
||||
const { t } = useTranslation(['core', 'group']);
|
||||
|
||||
const getRating = useCallback(async (name, service) => {
|
||||
try {
|
||||
@ -101,26 +103,39 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
|
||||
const rateFunc = async (event, chosenValue, currentValue) => {
|
||||
try {
|
||||
const newValue = chosenValue || currentValue;
|
||||
if (!myName) throw new Error('You need a name to rate.');
|
||||
if (!myName)
|
||||
throw new Error(
|
||||
t('core:message.generic.name_rate', {
|
||||
postProcess: 'capitalize',
|
||||
})
|
||||
);
|
||||
if (!app?.name) return;
|
||||
const fee = await getFee('CREATE_POLL');
|
||||
|
||||
await show({
|
||||
// TODO translate
|
||||
message: `Would you like to rate this app a rating of ${newValue}?. It will create a POLL tx.`,
|
||||
message: t('core:message.error.generic', {
|
||||
rate: newValue,
|
||||
postProcess: 'capitalize',
|
||||
}),
|
||||
publishFee: fee.fee + ' QORT',
|
||||
});
|
||||
|
||||
if (hasPublishedRating === false) {
|
||||
const pollName = `app-library-${app.service}-rating-${app.name}`;
|
||||
const pollOptions = [`1, 2, 3, 4, 5, initialValue-${newValue}`];
|
||||
const pollDescription = t('core:message.error.generic', {
|
||||
name: app.name,
|
||||
service: app.service,
|
||||
postProcess: 'capitalize',
|
||||
});
|
||||
|
||||
await new Promise((res, rej) => {
|
||||
window
|
||||
.sendMessage(
|
||||
'createPoll',
|
||||
{
|
||||
pollName: pollName,
|
||||
pollDescription: `Rating for ${app.service} ${app.name}`,
|
||||
pollDescription: pollDescription,
|
||||
pollOptions: pollOptions,
|
||||
pollOwnerAddress: myName,
|
||||
},
|
||||
@ -137,7 +152,7 @@ export const AppRating = ({ app, myName, ratingCountPosition = 'right' }) => {
|
||||
message:
|
||||
'Successfully rated. Please wait a couple minutes for the network to propogate the changes.',
|
||||
});
|
||||
setOpenSnack(true);
|
||||
setOpenSnack(true); // TODO translate
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
import React, { useContext, useState } from 'react';
|
||||
import { useContext, useState } from 'react';
|
||||
import { executeEvent } from '../../utils/events';
|
||||
import { getBaseApiReact, MyContext } from '../../App';
|
||||
import { createEndpoint } from '../../background';
|
||||
@ -7,10 +7,9 @@ import {
|
||||
sortablePinnedAppsAtom,
|
||||
} from '../../atoms/global';
|
||||
import { saveToLocalStorage } from './AppsNavBarDesktop';
|
||||
import { base64ToBlobUrl } from '../../utils/fileReading';
|
||||
import { base64ToUint8Array } from '../../qdn/encryption/group-encryption';
|
||||
import { uint8ArrayToObject } from '../../backgroundFunctions/encryption';
|
||||
import { useAtom, useSetAtom } from 'jotai';
|
||||
import { useSetAtom } from 'jotai';
|
||||
|
||||
export const useHandlePrivateApps = () => {
|
||||
const [status, setStatus] = useState('');
|
||||
|
@ -1,7 +1,7 @@
|
||||
import { useCallback, useContext, useEffect, useMemo, useState } from 'react';
|
||||
import { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { executeEvent } from '../../utils/events';
|
||||
import { navigationControllerAtom } from '../../atoms/global';
|
||||
import { Filesystem, Directory, Encoding } from '@capacitor/filesystem';
|
||||
import { Filesystem, Directory } from '@capacitor/filesystem';
|
||||
import { saveFile } from '../../qortalRequests/get';
|
||||
import { mimeToExtensionMap } from '../../utils/memeTypes';
|
||||
import { MyContext } from '../../App';
|
||||
|
@ -111,7 +111,7 @@ export const GeneralNotifications = ({ address }) => {
|
||||
userSelect: 'none',
|
||||
}}
|
||||
>
|
||||
No new notifications
|
||||
{t('core:message.generic.no_notifications')}
|
||||
</Typography>
|
||||
)}
|
||||
{hasNewPayment && (
|
||||
|
@ -233,7 +233,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
||||
{isDesktop ? (
|
||||
<IconWrapper
|
||||
disableWidth={disableWidth}
|
||||
label={t('core:save_options.save', {
|
||||
label={t('core:action.save', {
|
||||
postProcess: 'capitalize',
|
||||
})}
|
||||
selected={false}
|
||||
@ -409,7 +409,7 @@ export const Save = ({ isDesktop, disableWidth, myName }) => {
|
||||
onClick={saveToQdn}
|
||||
variant="contained"
|
||||
>
|
||||
{t('core:save_options.save_qdn', {
|
||||
{t('core:action.save_qdn', {
|
||||
postProcess: 'capitalize',
|
||||
})}
|
||||
</LoadingButton>
|
||||
|
@ -98,12 +98,15 @@
|
||||
"name_available": "{{ name }} is available",
|
||||
"name_benefits": "benefits of a name",
|
||||
"name_checking": "checking if name already exists",
|
||||
"name_rate": "you need a name to rate.",
|
||||
"name_registration": "your balance is {{ balance }} QORT. A name registration requires a {{ fee }} QORT fee",
|
||||
"name_unavailable": "{{ name }} is unavailable",
|
||||
"no_description": "no description",
|
||||
"no_notifications": "no new notifications",
|
||||
"one_app_per_name": "note: Currently, only one App and Website is allowed per Name.",
|
||||
"publish_data": "publish data to Qortal: anything from apps to videos. Fully decentralized!",
|
||||
"publishing": "publishing... Please wait.",
|
||||
"rating": "rating for {{ service }} {{ name }}",
|
||||
"secure_ownership": "secure ownership of data published by your name. You can even sell your name, along with your data to a third party.",
|
||||
"select_zip": "select .zip file containing static content:"
|
||||
},
|
||||
@ -146,13 +149,13 @@
|
||||
"publish_app": "would you like to publish this app?",
|
||||
"publish_qdn": "would you like to publish your settings to QDN (encrypted)?",
|
||||
"qdn": "use QDN saving",
|
||||
"rate_app": "would you like to rate this app a rating of {{ rate }}?. It will create a POLL tx.",
|
||||
"register_name": "you need a registered Qortal name to save your pinned apps to QDN.",
|
||||
"reset_pinned": "don't like your current local changes? Would you like to reset to the default pinned apps?",
|
||||
"reset_qdn": "don't like your current local changes? Would you like to reset to your saved QDN pinned apps?",
|
||||
"revert_default": "revert to default",
|
||||
"revert_qdn": "revert to QDN",
|
||||
"save_qdn": "save to QDN",
|
||||
"save": "save",
|
||||
"settings": "you are using the export/import way of saving settings.",
|
||||
"unsaved_changes": " you have unsaved changes to your pinned apps. Save them to QDN."
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user