fix(blog): highlight in-article links and trigger support chat from smart advisor button
Deploy Canina / deploy (push) Successful in 2m44s

This commit is contained in:
devops committed 2026-10-19 06:24:22 +00:00
1 parent ff6f04fe46
commit 0b5f2a88cc
4 files changed
+34 -8

No files matched your search

@@ -399,13 +399,18 @@ export default function BlogPostClient({ blog, publishedDate, authorName, saniti
<p className="text-xs text-white/80 leading-relaxed">
مشاوران علمی و دامپزشکان داروسازی کنینا آماده پاسخگویی به سوالات شما در مورد وضعیت سلامت پت شما هستند.
</p>
<Link
href="/smart-advisor"
className="inline-flex items-center justify-center gap-2 w-full py-3 rounded-2xl bg-canina-gold text-canina-dark text-xs font-black hover:bg-white transition-all shadow-lg"
<button
type="button"
onClick={() => {
if (typeof window !== 'undefined') {
window.dispatchEvent(new CustomEvent('canina:open-support-chat'));
}
}}
className="inline-flex items-center justify-center gap-2 w-full py-3 rounded-2xl bg-canina-gold text-canina-dark text-xs font-black hover:bg-white transition-all shadow-lg cursor-pointer"
>
<span>مشاوره هوشمند دارویی</span>
<ArrowLeft className="w-4 h-4" />
</Link>
</button>
</div>
</aside>
</div>
@@ -43,6 +43,12 @@ export default function SupportChat() {
return () => { active = false; clearInterval(timer); window.removeEventListener('focus', refresh); };
}, []);
const chatScrollRef = useRef<HTMLDivElement | null>(null);
useEffect(() => {
const handleOpenSupport = () => setOpen(true);
window.addEventListener('canina:open-support-chat', handleOpenSupport);
return () => window.removeEventListener('canina:open-support-chat', handleOpenSupport);
}, []);
const historyKey = useRef('');
const pathname = usePathname();
const isPdpPage = pathname?.startsWith('/shop/') && pathname !== '/shop';
@@ -153,10 +153,7 @@ describe("BlogPostClient Component", () => {
// Scientific Consultation CTA
expect(screen.getByText("نیاز به راهنمایی و دوز درمانی دارید؟")).toBeInTheDocument();
expect(screen.getByRole("link", { name: /مشاوره هوشمند دارویی/ })).toHaveAttribute(
"href",
"/smart-advisor"
);
expect(screen.getByRole("button", { name: /مشاوره هوشمند دارویی/ })).toBeInTheDocument();
});
it("renders existing comments and handles new comment submission successfully", async () => {