diff --git a/src/components/DeveloperIDE/Projects/index.tsx b/src/components/DeveloperIDE/Projects/index.tsx index 8b1d924a..a6cdf685 100644 --- a/src/components/DeveloperIDE/Projects/index.tsx +++ b/src/components/DeveloperIDE/Projects/index.tsx @@ -15,7 +15,8 @@ import { FaFileImport } from 'react-icons/fa'; const Projects = observer(() => { const { w3s, - base: { confirm } + base: { confirm }, + lang: { t } } = useStore(); const { allProjects, selectedNames } = w3s.project; @@ -54,7 +55,7 @@ const Projects = observer(() => { onClick={async () => { await allProjects.call(); w3s.projectManager.sync(); - toast.success('Reloaded'); + toast.success(t("success.reloaded.msg")); }} > Refresh @@ -79,7 +80,7 @@ const Projects = observer(() => { } w3s.project.resetSelectedNames(); eventBus.emit('project.delete'); - toast.success('Deleted successfully'); + toast.success(t("success.delete.msg")); } }); }} @@ -107,15 +108,15 @@ const Projects = observer(() => { err = error.message; } } else { - err = 'Instance not found'; + err = t('error.pause.msg'); } } if (err) { - toast.error('Instance not found'); + toast.error(t('error.pause.msg')); } else { w3s.project.resetSelectedNames(); eventBus.emit('instance.handle'); - toast.success('Suspended successfully'); + toast.success(t('success.pause.msg')); } }} > @@ -244,7 +245,7 @@ const Projects = observer(() => { url: `/api/w3bapp/deploy/${instance.f_instance_id}/HUNGUP` }); eventBus.emit('instance.handle'); - toast.success('Successfully suspended'); + toast.success(t("success.suspended.msg")); } catch (error) { } }} /> @@ -264,7 +265,7 @@ const Projects = observer(() => { url: `/api/w3bapp/deploy/${instance.f_instance_id}/START` }); eventBus.emit('instance.handle'); - toast.success('Successfully started'); + toast.success(t("success.started.msg")); } catch (error) { } }} /> diff --git a/src/components/DeveloperIDE/ToolBar/index.tsx b/src/components/DeveloperIDE/ToolBar/index.tsx index 23be1bb0..d1e90551 100644 --- a/src/components/DeveloperIDE/ToolBar/index.tsx +++ b/src/components/DeveloperIDE/ToolBar/index.tsx @@ -13,7 +13,7 @@ import toast from 'react-hot-toast'; interface ToolBar extends BoxProps {} const ToolBar = (props: ToolBar) => { - const { w3s } = useStore(); + const { w3s, lang:{t} } = useStore(); const { onOpen, onClose, isOpen } = useDisclosure(); const curProjectInstance = w3s.instances.table.dataSource.find((option) => option.project_name === w3s.project.curProject?.name); @@ -58,8 +58,16 @@ const ToolBar = (props: ToolBar) => { if (instance) { w3s.project.allProjects.onSelect(index); w3s.showContent = 'METRICS'; + const now = new Date(); + now.setMinutes(0); + now.setSeconds(0); + now.setMilliseconds(0); + const yesterday = new Date(now.getTime() - 24 * 60 * 60 * 1000) + w3s.metrics.activeDevices.call(yesterday, now); + w3s.metrics.dataMessages.call(yesterday, now); + w3s.metrics.blockchainTransaction.call(yesterday, now); } else { - toast.error('No instance found, please create one first'); + toast.error(t('error.change.project.msg')); } onClose(); }} diff --git a/src/components/IDE/DBTable/index.tsx b/src/components/IDE/DBTable/index.tsx index 3e0ae4d7..3605521f 100644 --- a/src/components/IDE/DBTable/index.tsx +++ b/src/components/IDE/DBTable/index.tsx @@ -18,6 +18,7 @@ import toast from 'react-hot-toast'; const EditTable = observer(() => { const { base: { confirm }, + lang: {t}, w3s: { dbTable, dbTable: { currentColumns } @@ -179,7 +180,8 @@ const EditTable = observer(() => { const ViewData = observer(() => { const { - w3s: { dbTable } + w3s: { dbTable }, + lang: {t} } = useStore(); if (!dbTable.currentTable.tableName) { @@ -210,10 +212,10 @@ const ViewData = observer(() => { dbTable.table.set({ dataSource: data }); - toast.success('Upload CSV success'); + toast.success(t('success.upload.msg')); } } else { - toast.error('CSV file is empty'); + toast.error(t('error.csvfile.empty.msg')); } (document.getElementById('csv-input') as HTMLInputElement).value = ''; }} diff --git a/src/components/IDE/Editor/EditorBottomPanels/ABIPanel.tsx b/src/components/IDE/Editor/EditorBottomPanels/ABIPanel.tsx index 42d728fb..e4c8e222 100644 --- a/src/components/IDE/Editor/EditorBottomPanels/ABIPanel.tsx +++ b/src/components/IDE/Editor/EditorBottomPanels/ABIPanel.tsx @@ -155,7 +155,7 @@ export const FunctionList = observer(({ contract }: { contract: ContractInstance }); export const FunctiomItem = observer(({ functionItem, contract }: { functionItem: FunctionState; contract: ContractInstance }) => { - const { god } = useStore(); + const { god, lang: {t} } = useStore(); const _contract = contract; const store = useLocalObservable(() => ({ loading: new BooleanState(), @@ -222,7 +222,7 @@ export const FunctiomItem = observer(({ functionItem, contract }: { functionItem const Interface = new ethers.utils.Interface(abi); const bytecode = Interface.encodeFunctionData(functionItem.name, params); await navigator.clipboard.writeText(bytecode); - toast.success('Copy Success'); + toast.success(t("success.copy.msg")); } catch (e) { toast.error(e.message); } diff --git a/src/components/IDE/Editor/index.tsx b/src/components/IDE/Editor/index.tsx index 9651c6cb..9d009ffa 100644 --- a/src/components/IDE/Editor/index.tsx +++ b/src/components/IDE/Editor/index.tsx @@ -26,7 +26,8 @@ const Editor = observer(() => { w3s: { projectManager: { curFilesListSchema }, lab - } + }, + lang: {t} } = useStore(); useEffect(() => { const handleSave = (event) => { @@ -86,10 +87,10 @@ const Editor = observer(() => { currentFolder.children[curWasmIndex] = wasmFile; } curFilesListSchema.setActiveFiles(wasmFile); - toast.success('Compile Success!'); + toast.success(t("error.compile.msg")); } catch (error) { console.log(error); - toast.error('Compile Error!'); + toast.error(t("success.compile.msg")); } } })); diff --git a/src/components/IDE/PublishEventRequestTemplates/index.tsx b/src/components/IDE/PublishEventRequestTemplates/index.tsx index 972630ef..7e3c1cb2 100644 --- a/src/components/IDE/PublishEventRequestTemplates/index.tsx +++ b/src/components/IDE/PublishEventRequestTemplates/index.tsx @@ -18,7 +18,8 @@ export const ShowRequestTemplatesButton = observer(({ props = {} }: { props?: Bu formData: { accountRole } } } - } + }, + lang: { t } } = useStore(); return (