From 5663abe63eaec093a22299a87b007c206617d4aa Mon Sep 17 00:00:00 2001 From: AmitChauhan63390 Date: Tue, 10 Dec 2024 21:45:09 +0530 Subject: [PATCH] little progress and icon changed --- public/locales/en.json | 13 +++++ public/locales/ja.json | 13 ++++- src/components/molecules/NavBar.tsx | 8 ++- src/components/molecules/RunsTable.tsx | 76 ++++++++++++++------------ src/pages/Register.tsx | 2 +- 5 files changed, 72 insertions(+), 40 deletions(-) diff --git a/public/locales/en.json b/public/locales/en.json index 897e1729..b6396893 100644 --- a/public/locales/en.json +++ b/public/locales/en.json @@ -49,5 +49,18 @@ "feedback":"Join Maxun Cloud", "apidocs":"API Docs" + }, + "runstable":{ + "runs":"All Runs", + "runStatus":"Status", + "runName":"Name", + "startedAt":"Started At", + "finishedAt":"Finished At", + "delete":"Delete", + "settings":"Settings", + "search":"Search Runs..." + + + } } \ No newline at end of file diff --git a/public/locales/ja.json b/public/locales/ja.json index 88686e62..881fd131 100644 --- a/public/locales/ja.json +++ b/public/locales/ja.json @@ -37,7 +37,8 @@ }, "edit": "編集", "delete": "削除", - "duplicate": "複製" + "duplicate": "複製", + "search": "ロボットを検索..." }, "mainmenu": { "recordings": "ロボット", @@ -46,5 +47,15 @@ "apikey": "APIキー", "feedback": "Maxunクラウドに参加する", "apidocs": "APIドキュメント" + }, + "runstable": { + "runs": "すべての実行", + "runStatus": "ステータス", + "runName": "名前", + "startedAt": "開始日時", + "finishedAt": "終了日時", + "delete": "削除", + "settings": "設定", + "search": "実行を検索..." } } diff --git a/src/components/molecules/NavBar.tsx b/src/components/molecules/NavBar.tsx index 958492e6..ba607fe4 100644 --- a/src/components/molecules/NavBar.tsx +++ b/src/components/molecules/NavBar.tsx @@ -4,7 +4,7 @@ import styled from "styled-components"; import { stopRecording } from "../../api/recording"; import { useGlobalInfoStore } from "../../context/globalInfo"; import { IconButton, Menu, MenuItem, Typography, Chip } from "@mui/material"; -import { AccountCircle, Logout, Clear } from "@mui/icons-material"; +import { AccountCircle, Logout, Clear, Language } from "@mui/icons-material"; import { useNavigate } from "react-router-dom"; import { AuthContext } from "../../context/auth"; import { SaveRecording } from "../molecules/SaveRecording"; @@ -159,7 +159,7 @@ export const NavBar: React.FC = ({ {t("logout")} - {/* Language dropdown */} + ) : ( <> @@ -190,7 +190,9 @@ export const NavBar: React.FC = ({ marginRight: "10px", }} > - {t("language")} + + + string; } -export const columns: readonly Column[] = [ - { id: 'runStatus', label: 'Status', minWidth: 80 }, - { id: 'name', label: 'Robot Name', minWidth: 80 }, - { id: 'startedAt', label: 'Started at', minWidth: 80 }, - { id: 'finishedAt', label: 'Finished at', minWidth: 80 }, - { id: 'settings', label: 'Settings', minWidth: 80 }, - { id: 'delete', label: 'Delete', minWidth: 80 }, -]; - -export interface Data { +interface Data { id: number; status: string; name: string; @@ -58,15 +61,25 @@ interface RunsTableProps { runningRecordingName: string; } -export const RunsTable = ( - { currentInterpretationLog, abortRunHandler, runId, runningRecordingName }: RunsTableProps) => { +export const RunsTable: React.FC = ({ + currentInterpretationLog, + abortRunHandler, + runId, + runningRecordingName +}) => { + const { t } = useTranslation(); + + // Update column labels using translation if needed + const translatedColumns = columns.map(column => ({ + ...column, + label: t(`runstable.${column.id}`, column.label) + })); + const [page, setPage] = useState(0); const [rowsPerPage, setRowsPerPage] = useState(10); const [rows, setRows] = useState([]); - const [searchTerm, setSearchTerm] = useState(''); - const { notify, rerenderRuns, setRerenderRuns } = useGlobalInfoStore(); const handleChangePage = (event: unknown, newPage: number) => { @@ -86,16 +99,13 @@ export const RunsTable = ( const fetchRuns = async () => { const runs = await getStoredRuns(); if (runs) { - const parsedRows: Data[] = []; - runs.map((run: any, index) => { - parsedRows.push({ - id: index, - ...run, - }); - }); + const parsedRows: Data[] = runs.map((run: any, index: number) => ({ + id: index, + ...run, + })); setRows(parsedRows); } else { - notify('error', 'No runs found. Please try again.') + notify('error', 'No runs found. Please try again.'); } }; @@ -104,7 +114,7 @@ export const RunsTable = ( fetchRuns(); setRerenderRuns(false); } - }, [rerenderRuns]); + }, [rerenderRuns, rows.length, setRerenderRuns]); const handleDelete = () => { setRows([]); @@ -112,7 +122,6 @@ export const RunsTable = ( fetchRuns(); }; - // Filter rows based on search term const filteredRows = rows.filter((row) => row.name.toLowerCase().includes(searchTerm.toLowerCase()) @@ -120,7 +129,6 @@ export const RunsTable = ( // Group filtered rows by robot meta id const groupedRows = filteredRows.reduce((acc, row) => { - if (!acc[row.robotMetaId]) { acc[row.robotMetaId] = []; } @@ -132,11 +140,11 @@ export const RunsTable = ( - All Runs + {t('runstable.runs', 'Runs')} ( }> - {data[data.length - 1].name} - - {columns.map((column) => ( + {translatedColumns.map((column) => ( ); -}; +}; \ No newline at end of file diff --git a/src/pages/Register.tsx b/src/pages/Register.tsx index 57ec676a..b1fb23e2 100644 --- a/src/pages/Register.tsx +++ b/src/pages/Register.tsx @@ -83,7 +83,7 @@ const Register = () => { > logo - Create an Account + {t('register.title')}