Feature/update profile sidebar

This commit is contained in:
AmirHossein Mahmoodi
2024-09-16 07:59:19 +00:00
parent 3e8abb7580
commit 9387f85cf7
19 changed files with 230 additions and 203 deletions

View File

@@ -1,22 +1,19 @@
import { getValueByPath } from "@/core/utils/getValueByPath";
import { useSidebarBadge } from "@/lib/hooks/useSidebarBadge"
import { Chip } from "@mui/material"
import { useSidebarBadge } from "@/lib/hooks/useSidebarBadge";
import { Chip } from "@mui/material";
import { useEffect, useState } from "react";
const SidebarBadge = ({ badge, chipProps = {} }) => {
const { data } = useSidebarBadge()
const [value, setValue] = useState()
const { data } = useSidebarBadge();
const [value, setValue] = useState();
useEffect(() => {
setValue(getValueByPath(data, badge))
}, [data, badge])
setValue(getValueByPath(data, badge));
}, [data, badge]);
if (!data) return null;
if (!value) return null;
if (!data) return null
if (!value) return null
return (
<Chip label={(value).toLocaleString("fa-IR")} size="small" {...chipProps} />
)
}
export default SidebarBadge
return <Chip label={value.toLocaleString("fa-IR")} size="small" {...chipProps} />;
};
export default SidebarBadge;