Refactor: Remove toast notification from Layout component

This commit is contained in:
ALi Josheghani
2024-09-16 12:47:01 +03:30
parent 57d80ee79a
commit 0a1b991eca

View File

@@ -6,7 +6,6 @@ import { Helmet } from "react-helmet-async";
import { useEffect } from "react"; import { useEffect } from "react";
import { useDispatch } from "react-redux"; import { useDispatch } from "react-redux";
import { setConfigId } from "../redux/slices/configId"; import { setConfigId } from "../redux/slices/configId";
import toast from "react-hot-toast";
const Layout = () => { const Layout = () => {
const { configs } = useParams<{ configs: string }>(); const { configs } = useParams<{ configs: string }>();
@@ -26,46 +25,46 @@ const Layout = () => {
}, 100); // Scroll to 100% of the page height }, 100); // Scroll to 100% of the page height
}, [configs, dispatch]); }, [configs, dispatch]);
useEffect(() => { // useEffect(() => {
toast.custom( // toast.custom(
(t) => ( // (t) => (
<div // <div
className="!bg-gray-900 s!hadow-2xl !shadow-gray-700/20 !text-white !p-4 !rounded-lg !relative !flex !flex-col !gap-2 !justify-center !items-center !max-w-[600px] !w-full" // className="!bg-gray-900 s!hadow-2xl !shadow-gray-700/20 !text-white !p-4 !rounded-lg !relative !flex !flex-col !gap-2 !justify-center !items-center !max-w-[600px] !w-full"
> // >
<div> // <div>
کاربر عزیز درودبه اطلاع می‌رسانیم به علت عملیات توسعه و نگهداری شبکه // کاربر عزیز درودبه اطلاع می‌رسانیم به علت عملیات توسعه و نگهداری شبکه
شاپرک از ساعت ۲۳ روز ۲۵ شهریور الی ۶ بامداد مورخ ۲۶ شهریور احتمال // شاپرک از ساعت ۲۳ روز ۲۵ شهریور الی ۶ بامداد مورخ ۲۶ شهریور احتمال
اختلال و قطعی در درگاه پرداخت اینترنتی وجود دارد. خواهشمندیم عملیات // اختلال و قطعی در درگاه پرداخت اینترنتی وجود دارد. خواهشمندیم عملیات
پرداخت را قبل و یا بعد از این زمان انجام دهید یا با مراجعه به // پرداخت را قبل و یا بعد از این زمان انجام دهید یا با مراجعه به
پشتیبانی تلگرام به نشانی{" "} // پشتیبانی تلگرام به نشانی{" "}
<a // <a
href="https://t.me/PersianPingSupport" // href="https://t.me/PersianPingSupport"
target="_blank" // target="_blank"
rel="noopener noreferrer" // rel="noopener noreferrer"
style={{ color: "cyan" }} // style={{ color: "cyan" }}
> // >
PersianPingSupport // PersianPingSupport
</a>{" "} // </a>{" "}
از طریق کارت به کارت سرویس خود را خریداری کنید // از طریق کارت به کارت سرویس خود را خریداری کنید
</div> // </div>
<button // <button
onClick={() => toast.dismiss(t.id)} // بستن توست با کلیک کاربر // onClick={() => toast.dismiss(t.id)} // بستن توست با کلیک کاربر
style={{ // style={{
background: "red", // background: "red",
color: "white", // color: "white",
padding: "8px 12px", // padding: "8px 12px",
borderRadius: "4px", // borderRadius: "4px",
marginLeft: "16px", // marginLeft: "16px",
cursor: "pointer", // cursor: "pointer",
}} // }}
> // >
باشه // باشه
</button> // </button>
</div> // </div>
), // ),
{ position: "bottom-center", duration: Infinity } // { position: "bottom-center", duration: Infinity }
); // );
}, []); // }, []);
return ( return (
<> <>
<Helmet> <Helmet>