From 0b5f2a88cc2cedadf44858ca75587cc92c7c4a66 Mon Sep 17 00:00:00 2001 From: devops Date: Mon, 19 Oct 2026 06:24:22 +0000 Subject: [PATCH] fix(blog): highlight in-article links and trigger support chat from smart advisor button --- frontend/application/app/globals.css | 18 ++++++++++++++++++ .../application/components/BlogPostClient.tsx | 13 +++++++++---- .../application/components/SupportChat.tsx | 6 ++++++ .../__tests__/BlogPostClient.test.tsx | 5 +---- 4 files changed, 34 insertions(+), 8 deletions(-) diff --git a/frontend/application/app/globals.css b/frontend/application/app/globals.css index 5bf4f021..fd017a9e 100644 --- a/frontend/application/app/globals.css +++ b/frontend/application/app/globals.css @@ -186,3 +186,21 @@ .animate-marquee:hover { animation-play-state: paused; } + +/* Article Links & Provenance Styling */ +.article-html-content a, +.prose a { + color: var(--color-canina-blue) !important; + font-weight: 700 !important; + text-decoration: underline !important; + text-decoration-color: rgba(30, 64, 83, 0.4) !important; + text-underline-offset: 4px !important; + transition: all 0.2s ease-in-out !important; +} + +.article-html-content a:hover, +.prose a:hover { + color: #0052cc !important; + text-decoration-color: #0052cc !important; + opacity: 1 !important; +} diff --git a/frontend/application/components/BlogPostClient.tsx b/frontend/application/components/BlogPostClient.tsx index 9d16fa84..33ed2087 100644 --- a/frontend/application/components/BlogPostClient.tsx +++ b/frontend/application/components/BlogPostClient.tsx @@ -399,13 +399,18 @@ export default function BlogPostClient({ blog, publishedDate, authorName, saniti

مشاوران علمی و دامپزشکان داروسازی کنینا آماده پاسخگویی به سوالات شما در مورد وضعیت سلامت پت شما هستند.

- { + 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" > مشاوره هوشمند دارویی - + diff --git a/frontend/application/components/SupportChat.tsx b/frontend/application/components/SupportChat.tsx index 8308c3b2..17812c54 100644 --- a/frontend/application/components/SupportChat.tsx +++ b/frontend/application/components/SupportChat.tsx @@ -43,6 +43,12 @@ export default function SupportChat() { return () => { active = false; clearInterval(timer); window.removeEventListener('focus', refresh); }; }, []); const chatScrollRef = useRef(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'; diff --git a/frontend/application/components/__tests__/BlogPostClient.test.tsx b/frontend/application/components/__tests__/BlogPostClient.test.tsx index 8d30729c..1541b5cf 100644 --- a/frontend/application/components/__tests__/BlogPostClient.test.tsx +++ b/frontend/application/components/__tests__/BlogPostClient.test.tsx @@ -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 () => {