Files
nobat724_front/components/clinic/components/about/TextDetail.js
T
hamedandClaude Sonnet 4.6 59e0a0fe4f fix: resolve critical bugs and security issues across the project
Security:
- Disable SSL verification only in development (lib/req.js)
- Wrap all JSON.parse(cookie) calls in try-catch via safeJsonParse utility
- Sanitize dangerouslySetInnerHTML in blog/clinic with sanitizeHtml utility
- Fix open redirect in payment page — validate URL origin before redirect
- Fix cookie cleanup on 401 — use js-cookie with correct domain scope

Performance:
- Wrap ItemDoctor with React.memo to prevent unnecessary re-renders
- Replace <img> with Next.js <Image> in blog Caption component

Functionality:
- Fix memory leak in Recode.js — store intervals in refs, cleanup on unmount
- Add null guard on retryIcon.current before classList manipulation
- Fix getParsedUserInfo in helper to handle malformed cookie gracefully

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-07 09:19:20 +03:30

41 lines
1.4 KiB
JavaScript

import { useState } from "react";
import { Button } from "@mui/material";
import MultilineLoading from "@/app/component/loading/Multiline";
import { sanitizeHtml } from "@/lib/sanitize";
function TextDetail({ data }) {
const [isMore, setIsMore] = useState(false);
return (
<div className="flex flex-col items-center justify-center">
<MultilineLoading line={10} width="full" height={18}>
<p
className={`
text-[#525252] text-[16px] font-normal leading-[32px] overflow-hidden relative
after:right-0 after:bottom-0 after:h-[80px]
after:shadow-xl after:w-full transition-all duration-500 w-full
${
data?.caption?.length > 180 && isMore
? "after:bg-transparent max-h-screen after:absolute"
: data?.caption?.length > 180 &&
"after:bg-[linear-gradient(transparent,#FAFAFA)] max-h-[200px] after:absolute"
}
`}
dangerouslySetInnerHTML={{ __html: sanitizeHtml(data?.caption) }}
></p>
</MultilineLoading>
{data?.caption?.length > 180 && (
<Button
className="!text-[#F17732] !text-[14px] !font-light !p-2"
onClick={() => setIsMore(!isMore)}
variant="text"
>
{isMore ? "مطالعه کمتر" : "مطالعه بیشتر"}
</Button>
)}
</div>
);
}
export default TextDetail;