From dd67581062d84b86a0dbe3e4daf0d6fb19fba248 Mon Sep 17 00:00:00 2001 From: amitamrutiya2210 Date: Thu, 2 May 2024 18:05:43 +0530 Subject: [PATCH] fix(dashboard): inconsistent interaction for profile menu options Signed-off-by: amitamrutiya2210 --- apps/dashboard/components/color-toggle.tsx | 52 +++++----------------- apps/dashboard/components/header.tsx | 14 +----- 2 files changed, 14 insertions(+), 52 deletions(-) diff --git a/apps/dashboard/components/color-toggle.tsx b/apps/dashboard/components/color-toggle.tsx index f311e74c6b..1640e0706a 100644 --- a/apps/dashboard/components/color-toggle.tsx +++ b/apps/dashboard/components/color-toggle.tsx @@ -1,58 +1,30 @@ "use client" import * as React from "react" import { useColorScheme } from "@mui/joy/styles" -import IconButton, { IconButtonProps } from "@mui/joy/IconButton" import DarkModeRoundedIcon from "@mui/icons-material/DarkModeRounded" import LightModeIcon from "@mui/icons-material/LightMode" +import { MenuItem } from "@mui/joy" -export default function ColorSchemeToggle({ onClick, sx, ...props }: IconButtonProps) { +export default function ColorSchemeToggle() { const { mode, setMode } = useColorScheme() - const [mounted, setMounted] = React.useState(false) - React.useEffect(() => { - setMounted(true) - }, []) - if (!mounted) { - return ( - - ) - } return ( - { + { if (mode === "light") { setMode("dark") } else { setMode("light") } - onClick?.(event) }} - sx={[ - { - "& > *:first-of-type": { - display: mode === "dark" ? "none" : "initial", - }, - "& > *:last-of-type": { - display: mode === "light" ? "none" : "initial", - }, - }, - ...(Array.isArray(sx) ? sx : [sx]), - ]} + sx={{ + display: "flex", + justifyContent: "space-between", + fontWeight: "500", + }} > - - - + {mode === "light" ? "Dark Mode" : "Light Mode"} + {mode === "light" ? : } + ) } diff --git a/apps/dashboard/components/header.tsx b/apps/dashboard/components/header.tsx index 5bf843e869..ead23f48f1 100644 --- a/apps/dashboard/components/header.tsx +++ b/apps/dashboard/components/header.tsx @@ -84,6 +84,7 @@ export default function Header() { placement="bottom-end" > navigator.clipboard.writeText(userData?.defaultAccount.id)} sx={{ display: "flex", flexDirection: "column", @@ -91,7 +92,6 @@ export default function Header() { }} > navigator.clipboard.writeText(userData?.defaultAccount.id)} sx={{ width: "100%", display: "flex", @@ -128,17 +128,7 @@ export default function Header() { Logout - - - Dark Mode - - +