From 82cbfd35f4f677a456e3c1a50b98ec9b18847741 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Fri, 19 Jul 2024 14:58:13 +0530 Subject: [PATCH] add tooltips on icons --- public/locales/en/common.json | 8 +- public/locales/hi/common.json | 6 +- public/locales/mr/common.json | 4 +- public/locales/or/common.json | 4 +- src/components/ActionIcon.tsx | 16 +-- src/components/HeaderComponent.tsx | 108 ++++++++++--------- src/components/layouts/sidebar/Sidebar.tsx | 117 +++++++++++---------- 7 files changed, 144 insertions(+), 119 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 14b00d04..e174e770 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -12,8 +12,8 @@ "REASON_FOR_DELETION": "Reason for Deletion", "INCORRECT_DATA_ENTRY": "Incorrect Data Entry", "DUPLICATED_USER": "Duplicate User", - - "ALL":"All", + + "ALL": "All", "NO_GO_BACK": "No, go back", "YES": "Yes", "SURE_REASSIGN_CENTER": "Are you sure you want to re-assign Center to this user?", @@ -21,7 +21,9 @@ "SORT": "Sort", "EDIT_COHORT_NAME": "Edit Cohort", "NAME": "Name", - "UPDATE_COHORT": "Update Cohort" + "UPDATE_COHORT": "Update Cohort", + "EDIT": "Edit", + "DELETE": "Delete" }, "LOGIN_PAGE": { "USERNAME": "Username", diff --git a/public/locales/hi/common.json b/public/locales/hi/common.json index 52efd6bb..52b8fc4c 100644 --- a/public/locales/hi/common.json +++ b/public/locales/hi/common.json @@ -1,7 +1,9 @@ { "COMMON": { "LANGUAGE": "भाषा", - "LOADING": "लोडिंग" + "LOADING": "लोडिंग", + "EDIT": "संपादित करें", + "DELETE": "हटाएं" }, "LOGIN_PAGE": { "USERNAME": "उपयोगकर्ता नाम", @@ -18,8 +20,6 @@ "SORT": "क्रमबद्ध करें", "EDIT_COHORT_NAME": "समूह संपादित करें", "UPDATE_COHORT": "अद्यतन समूह" - - }, "COHORTS": { "SEARCHBAR_PLACEHOLDER": "कोहॉर्ट्स खोजें.." diff --git a/public/locales/mr/common.json b/public/locales/mr/common.json index e6b807a9..098aad14 100644 --- a/public/locales/mr/common.json +++ b/public/locales/mr/common.json @@ -6,7 +6,9 @@ "SORT": "क्रमवारी लावा", "EDIT_COHORT_NAME": "समूह संपादित करा", "NAME": "नाव", - "UPDATE_COHORT": "कोहॉर्ट अपडेट करा" + "UPDATE_COHORT": "कोहॉर्ट अपडेट करा", + "EDIT": "संपादित करा", + "DELETE": "हटवा" }, "LOGIN_PAGE": { "USERNAME": "वापरकर्तानाव", diff --git a/public/locales/or/common.json b/public/locales/or/common.json index e7ec4048..34468b70 100644 --- a/public/locales/or/common.json +++ b/public/locales/or/common.json @@ -5,7 +5,9 @@ "UPDATE_COHORT": "କୋହୋର୍ଟ୍ ଅଦ୍ୟତନ କରନ୍ତୁ", "SORT": "ସର୍ଟ", "OTHER": "ଅନ୍ୟ", - "NAME": "ନାମ" + "NAME": "ନାମ", + "EDIT": "ସଂପାଦନା", + "DELETE": "ବିଲୋପ" }, "LOGIN_PAGE": { "USERNAME": "ଉପଯୋଗକର୍ତା ନାମ", diff --git a/src/components/ActionIcon.tsx b/src/components/ActionIcon.tsx index d3ac9839..fba33dd0 100644 --- a/src/components/ActionIcon.tsx +++ b/src/components/ActionIcon.tsx @@ -9,6 +9,7 @@ import { ListItemText, Menu, MenuItem, + Tooltip, } from "@mui/material"; // import EditIcon from '@mui/icons-material/ModeEditOutlineOutlined'; // import DeleteIcon from '@mui/icons-material/DeleteOutlined'; @@ -28,6 +29,7 @@ const ActionIcon: React.FC = ({ onEdit, onDelete, }) => { + const { t } = useTranslation(); return ( = ({ gap: "20px", }} > - { onEdit(rowData); }} @@ -46,18 +48,20 @@ const ActionIcon: React.FC = ({ pointerEvents: "auto", // Enable pointer events to allow click }} > - + + + - { onDelete(rowData); }} style={{ cursor: "pointer" }} > - + + + - - ); }; diff --git a/src/components/HeaderComponent.tsx b/src/components/HeaderComponent.tsx index b2bff244..dcc95c6c 100644 --- a/src/components/HeaderComponent.tsx +++ b/src/components/HeaderComponent.tsx @@ -9,6 +9,7 @@ import { Grid, Button, InputLabel, + Tooltip, } from "@mui/material"; import Select, { SelectChangeEvent } from "@mui/material/Select"; import AddIcon from "@mui/icons-material/Add"; @@ -85,7 +86,6 @@ const HeaderComponent = ({ // handleDistrictChange([], []); // handleBlockChange([], []); // } - } try { const response = await getDistrictList(selectedCodes); @@ -215,46 +215,50 @@ const HeaderComponent = ({ /> - - + + All - ))} - - - - - + {Filter?.map((filter, index) => ( + + {filter} + + ))} + + + + + + + + - + + + {children} diff --git a/src/components/layouts/sidebar/Sidebar.tsx b/src/components/layouts/sidebar/Sidebar.tsx index e2f8613b..da6d70a1 100644 --- a/src/components/layouts/sidebar/Sidebar.tsx +++ b/src/components/layouts/sidebar/Sidebar.tsx @@ -10,7 +10,8 @@ import { ListItemIcon, ListItemText, Collapse, - Typography + Typography, + Tooltip, } from "@mui/material"; import FeatherIcon from "feather-icons-react"; import LogoIcon from "../logo/LogoIcon"; @@ -42,65 +43,73 @@ const Sidebar = ({ - {Menuitems.map((item, index) => ( + {Menuitems?.map((item, index) => ( - { - if (item.subOptions) { - handleClick(index); - } else { - router.push(item.href); - onSidebarClose(); - } - }} - selected={location === item.href} - sx={{ - mb: 1, - ...(location === item.href && { - color: "white", - backgroundColor: (theme) => - `${theme.palette.primary.main}!important`, - }), - }} - > - - - - - - {t(item.title)} - - - {item.subOptions ? ( - open === index ? : - ) : null} - + + { + if (item.subOptions) { + handleClick(index); + } else { + router.push(item.href); + onSidebarClose(); + } + }} + selected={location === item.href} + sx={{ + mb: 1, + ...(location === item.href && { + color: "white", + backgroundColor: (theme) => + `${theme.palette.primary.main}!important`, + }), + }} + > + + + + + + {t(item.title)} + + + {item.subOptions ? ( + open === index ? ( + + ) : ( + + ) + ) : null} + + {item.subOptions && ( {item.subOptions.map((subItem) => ( - { - router.push(subItem.href); - onSidebarClose(); - }} - selected={location === subItem.href} - sx={{ - pl: 8, - mb: 1, - ...(location === subItem.href && { - color: "white", - backgroundColor: (theme) => - `${theme.palette.primary.main}!important`, - }), - }} - > - {t(subItem.title)} - + + { + router.push(subItem.href); + onSidebarClose(); + }} + selected={location === subItem.href} + sx={{ + pl: 8, + mb: 1, + ...(location === subItem.href && { + color: "white", + backgroundColor: (theme) => + `${theme.palette.primary.main}!important`, + }), + }} + > + {t(subItem.title)} + + ))}