حسین معصومی پور 2024-04-24 00:27:06 +03:30
parent e4b91a557f
commit 564ab216c7
1 changed files with 23 additions and 17 deletions

View File

@ -15,6 +15,7 @@ import { Doughnut, Pie } from "react-chartjs-2";
import BottomSheetChangeRole from "plugins/BottomSheet/BottomSheetChangeRole";
import HasPermission from "plugins/HasPermission/page";
import Avatar from "boring-avatars";
import moment from "jalali-moment";
ChartJS.register(ArcElement, Tooltip, Legend);
@ -25,16 +26,6 @@ const Home = (props) => {
const profile = CTX.state.profile;
// useEffect(() => {
// if (!HasPermission("ViewDashboard")) {
// // You can customize the redirect path as needed
// router.replace("/activity");
// return null; // Prevent rendering the rest of the component
// );
// }
// }, [profile]);
console.log(profile);
useEffect(() => {
@ -81,12 +72,25 @@ const Home = (props) => {
CTX.setBottomSheetReportOpen(true);
};
console.log(
new Intl.DateTimeFormat("fa-IR-u-nu-latn", {
dateStyle: "full",
timeStyle: "long",
}).format(new Date())
);
const formatJalaliDate = (date) => {
const jalaliDateDay = moment(date).locale("fa").format("jD");
const jalaliDateYear = moment(date).locale("fa").format("jYYYY");
// Extract day name
const dayName = moment(date).locale("fa").format("dddd");
// Map English day names to Persian
// Get the Persian day name
// Extract month name
const monthName = moment(date).locale("fa").format("jMMMM");
return `${dayName} ${jalaliDateDay} ${monthName} ${jalaliDateYear}`;
};
const today = new Date();
const formattedDate = formatJalaliDate(today);
return (
<div className="pb-20">
@ -144,7 +148,9 @@ const Home = (props) => {
</div>
)}
<div className="mt-5">
<h3 className="text-right p-3 font-medium">شنبه 20 فروردین 1403</h3>
<h3 className="text-right p-3 text-sm font-bold">
<PersianNumber number={formattedDate} />
</h3>
<div className="grid xs:grid-cols-2 gap-4 rtl">
<div>
<div className="bg-dahs-chart rounded-2xl p-2 h-[195px]">