diff --git a/package.json b/package.json index aca603466..b1452d1d5 100644 --- a/package.json +++ b/package.json @@ -18,11 +18,11 @@ "@mui/x-charts": "^7.5.1", "@mui/x-data-grid": "7.28.3", "@mui/x-date-pickers": "7.28.3", - "@mui/icons-material": "6.4.10", + "@mui/icons-material": "6.4.11", "@mui/lab": "6.0.0-dev.240424162023-9968b4889d", - "@mui/material": "6.4.10", + "@mui/material": "6.4.11", "@reduxjs/toolkit": "2.6.1", - "@solana/wallet-adapter-base": "0.9.23", + "@solana/wallet-adapter-base": "0.9.24", "@solana/wallet-adapter-material-ui": "0.16.35", "@solana/wallet-adapter-react": "0.15.36", "@solana/wallet-adapter-react-ui": "0.9.36", diff --git a/src/App.jsx b/src/App.jsx index feddfb60f..1d5709847 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -25,10 +25,14 @@ function App() { if (authToken) { dispatch(getAppSettings({ authToken })).then((action) => { if (action.payload && action.payload.success) { - const { language } = action.payload.data; - if (language) { + const { language } = action.payload.data; + const availableLanguages = Object.keys(i18n.options.resources || {}); + if (language && availableLanguages.includes(language)) { dispatch(setLanguage(language)); i18n.changeLanguage(language); + } else { + dispatch(setLanguage(availableLanguages[0])); + i18n.changeLanguage(availableLanguages[0]); } } }); diff --git a/src/Components/Charts/ChartBox/index.jsx b/src/Components/Charts/ChartBox/index.jsx index f9f35f4b2..4b72fe16a 100644 --- a/src/Components/Charts/ChartBox/index.jsx +++ b/src/Components/Charts/ChartBox/index.jsx @@ -25,7 +25,7 @@ const ChartBox = ({ flex={1} direction="row" sx={{ - backgroundColor: theme.palette.tertiary.main, + backgroundColor: theme.palette.primary.main, border: 1, borderStyle: "solid", diff --git a/src/Components/FilterHeader/index.jsx b/src/Components/FilterHeader/index.jsx index 73c7d69ac..4bb27646f 100644 --- a/src/Components/FilterHeader/index.jsx +++ b/src/Components/FilterHeader/index.jsx @@ -47,11 +47,25 @@ const FilterHeader = ({ header, options, value, onChange, multiple = true }) => .filter(Boolean) .join(", "); }} + MenuProps={{ + anchorOrigin: { + vertical: "bottom", + horizontal: "left", + }, + transformOrigin: { + vertical: "top", + horizontal: "left", + }, + }} > {options.map((option) => ( { const theme = useTheme(); if (!shouldRender) return ; + if (monitorCount === 1) { + heading = "monitor"; + } + return ( - {heading} - + {monitorCount} {heading} {children} ); diff --git a/src/Components/Sidebar/index.css b/src/Components/Sidebar/index.css index 58805c7f8..ef921acca 100644 --- a/src/Components/Sidebar/index.css +++ b/src/Components/Sidebar/index.css @@ -79,6 +79,17 @@ aside .MuiListSubheader-root { transition: padding 200ms ease; } +.sidebar-delay-fade { + opacity: 0; + visibility: hidden; + transition: opacity 0.3s ease; +} + +aside.expanded.sidebar-ready .sidebar-delay-fade { + opacity: 1; + visibility: visible; +} + @keyframes fadeIn { 0% { opacity: 0; diff --git a/src/Components/Sidebar/index.jsx b/src/Components/Sidebar/index.jsx index 84fe9b33d..81edcd3cc 100644 --- a/src/Components/Sidebar/index.jsx +++ b/src/Components/Sidebar/index.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from "react"; +import React, { useEffect, useState, useRef } from "react"; import { Box, Collapse, @@ -127,6 +127,21 @@ function Sidebar() { const distributedUptimeEnabled = useSelector( (state) => state.ui.distributedUptimeEnabled ); + const sidebarRef = useRef(null); + const [sidebarReady, setSidebarReady] = useState(false); + const TRANSITION_DURATION = 200; + + useEffect(() => { + if (!collapsed) { + setSidebarReady(false); + const timeout = setTimeout(() => { + setSidebarReady(true); + }, TRANSITION_DURATION); + return () => clearTimeout(timeout); + } else { + setSidebarReady(false); + } + }, [collapsed]); const renderAccountMenuItems = () => { let filteredAccountMenuItems = [...accountMenuItems]; @@ -148,7 +163,10 @@ function Sidebar() { return filteredAccountMenuItems.map((item) => ( navigate(item.path)} + onClick={() => { + closePopup() + navigate(item.path) + }} sx={{ gap: theme.spacing(2), borderRadius: theme.shape.borderRadius, @@ -191,12 +209,14 @@ function Sidebar() { }, [location]); const iconColor = theme.palette.primary.contrastTextTertiary; + const sidebarClassName = `${collapsed ? "collapsed" : "expanded"} ${sidebarReady ? "sidebar-ready" : ""}`; /* TODO refactor this, there are a some ternaries and comments in the return */ return ( - Menu - - } sx={{ px: theme.spacing(6), height: "100%", @@ -725,6 +730,7 @@ function Sidebar() { { + const theme = useTheme(); + + return ( + + + {children} + + + ); +}; + +CustomTabList.propTypes = { + value: PropTypes.string, + onChange: PropTypes.func, + children: PropTypes.node, +}; + +export default CustomTabList; diff --git a/src/Components/Table/index.jsx b/src/Components/Table/index.jsx index 93772a712..199e548d7 100644 --- a/src/Components/Table/index.jsx +++ b/src/Components/Table/index.jsx @@ -65,7 +65,7 @@ const DataTable = ({ backgroundColor: theme.palette.secondary.main, color: theme.palette.secondary.contrastText, fontWeight: 600, - fontSize: "12px", + fontSize: "13px", }, "& :is(td)": { backgroundColor: theme.palette.primary.main, diff --git a/src/Pages/Account/index.jsx b/src/Pages/Account/index.jsx index 48b0984f5..c3e2be2f1 100644 --- a/src/Pages/Account/index.jsx +++ b/src/Pages/Account/index.jsx @@ -3,8 +3,8 @@ import PropTypes from "prop-types"; import { useNavigate } from "react-router"; import { useSelector } from "react-redux"; import { Box, Tab, useTheme } from "@mui/material"; +import CustomTabList from "../../Components/Tab"; import TabContext from "@mui/lab/TabContext"; -import TabList from "@mui/lab/TabList"; import ProfilePanel from "../../Components/TabPanels/Account/ProfilePanel"; import PasswordPanel from "../../Components/TabPanels/Account/PasswordPanel"; import TeamPanel from "../../Components/TabPanels/Account/TeamPanel"; @@ -59,29 +59,18 @@ const Account = ({ open = "profile" }) => { py={theme.spacing(12)} > - - - {tabList.map((label, index) => ( - handleFocus(label.toLowerCase())} - tabIndex={index} - /> - ))} - - + + {tabList.map((label, index) => ( + handleFocus(label.toLowerCase())} + tabIndex={index} + /> + ))} + {user.role.includes("superadmin") && } {!hideTeams && } diff --git a/src/Pages/Infrastructure/Monitors/Components/MonitorsTable/index.jsx b/src/Pages/Infrastructure/Monitors/Components/MonitorsTable/index.jsx index 450aee424..817e414b6 100644 --- a/src/Pages/Infrastructure/Monitors/Components/MonitorsTable/index.jsx +++ b/src/Pages/Infrastructure/Monitors/Components/MonitorsTable/index.jsx @@ -68,7 +68,7 @@ const MonitorsTable = ({ shouldRender, monitors, isAdmin, handleActionMenuDelete ), }, { id: "cpu", content: t("cpu"), render: (row) => }, - { id: "mem", content: t("mem"), render: (row) => }, + { id: "memory", content: t("memory"), render: (row) => }, { id: "disk", content: t("disk"), render: (row) => }, { id: "actions", diff --git a/src/Pages/Infrastructure/Monitors/index.jsx b/src/Pages/Infrastructure/Monitors/index.jsx index 1c511fea3..b679e04b7 100644 --- a/src/Pages/Infrastructure/Monitors/index.jsx +++ b/src/Pages/Infrastructure/Monitors/index.jsx @@ -87,7 +87,6 @@ const InfrastructureMonitors = () => { /> { - { + setTab(TAB_LIST.indexOf(selected)); }} + aria-label="status page tabs" > - { - setTab(TAB_LIST.indexOf(tab)); - }} - > - {TAB_LIST.map((tab, idx) => { - return ( - - ); - })} - - + {TAB_LIST.map((tabLabel, idx) => ( + + ))} + {tab === 0 ? ( { const filterLookup = new Map([ [toFilterStatus, "status"], - [toFilterActive, "isActive"] + [toFilterActive, "isActive"], ]); const activeFilter = [...filterLookup].find(([key]) => key !== undefined); @@ -202,7 +202,6 @@ const UptimeMonitors = () => { 0 && !monitorsWithSummaryIsLoading} monitorCount={monitorsSummary?.totalMonitors} - heading={"Uptime monitors"} > ({ root: ({ theme }) => ({ fontSize: theme.typography.fontSize - 1, color: theme.palette.tertiary.contrastText, - backgroundColor: theme.palette.primary.main, height: '34px', minHeight: '34px', borderRadius: 0, @@ -376,21 +375,13 @@ const baseTheme = (palette) => ({ minWidth: "fit-content", padding: `${theme.spacing(6)}px ${theme.spacing(4)}px`, fontWeight: 400, - borderBottom: `${theme.shape.borderThick}px solid transparent`, - borderRight: `${theme.shape.borderRadius / 2}px solid ${theme.palette.primary.lowContrast}`, - "&:first-of-type": { borderTopLeftRadius: theme.shape.borderRadius * 4 }, - "&:last-child": { borderTopRightRadius: theme.shape.borderRadius * 4, borderRight: 0 }, "&:focus-visible": { color: theme.palette.primary.contrastText, borderColor: theme.palette.tertiary.contrastText, borderRightColor: theme.palette.primary.lowContrast, }, "&.Mui-selected": { - backgroundColor: theme.palette.secondary.main, color: theme.palette.secondary.contrastText, - borderColor: theme.palette.secondary.contrastText, - borderRightColor: theme.palette.primary.lowContrast, - borderRadius: 0, }, "&:hover": { borderColor: theme.palette.primary.lowContrast, @@ -442,11 +433,7 @@ const baseTheme = (palette) => ({ styleOverrides: { root: ({ theme }) => ({ display: 'inline-flex', - borderTop: '1px solid', - borderLeft: '1px solid', - borderRight: '1px solid', - borderColor: theme.palette.primary.lowContrast, - borderRadius: `${theme.shape.borderRadius}px ${theme.shape.borderRadius}px 0 0`, + borderRadius: 0, "& .MuiTabs-indicator": { backgroundColor: theme.palette.tertiary.contrastText, },