From 8a53a07e0e9b48118da0a10c4d5f500a9e12ff7f Mon Sep 17 00:00:00 2001 From: chenhang Date: Fri, 17 Jul 2026 16:29:37 +0800 Subject: [PATCH] feat(chat-header): update guest chat layout and link to character splash --- .../__tests__/tailwind-components.test.tsx | 22 +++++++- src/app/chat/components/chat-header.tsx | 54 +++++++++++-------- 2 files changed, 51 insertions(+), 25 deletions(-) diff --git a/src/app/chat/components/__tests__/tailwind-components.test.tsx b/src/app/chat/components/__tests__/tailwind-components.test.tsx index d9711ff6..2854b8d1 100644 --- a/src/app/chat/components/__tests__/tailwind-components.test.tsx +++ b/src/app/chat/components/__tests__/tailwind-components.test.tsx @@ -184,8 +184,9 @@ describe("chat Tailwind components", () => { expect(guestHtml).toContain('aria-label="Sign up to unlock more features"'); expect(guestHtml).toContain("bg-accent"); expect(guestHtml).toContain("size-(--icon-size-sm,16px)"); - expect(guestHtml).not.toContain('href="/splash"'); - expect(guestHtml).not.toContain('aria-label="Back to home"'); + expect(guestHtml).toContain('href="/characters/elio/splash"'); + expect(guestHtml).toContain('aria-label="Back to home"'); + expect(guestHtml).toContain('data-analytics-key="chat.back_to_home"'); expect(guestHtml).not.toContain('aria-label="Menu"'); expect(memberHtml).toContain("Offer"); expect(memberHtml).toContain('href="/characters/elio/splash"'); @@ -216,6 +217,23 @@ describe("chat Tailwind components", () => { ); }); + it("links guest chat back to the active character splash", () => { + const maya = getCharacterBySlug("maya"); + if (!maya) throw new Error("Missing Maya character fixture"); + + const html = renderToStaticMarkup( + + + , + ); + + expect(html).toContain('href="/characters/maya/splash"'); + expect(html).not.toContain('aria-label="Menu"'); + expect(html).not.toContain( + 'data-analytics-key="chat.external_browser_hint"', + ); + }); + it("renders ChatInputTextField with textarea utilities", () => { const html = renderToStaticMarkup( - +
+ -
- {showBrowserHint ? : null} -
+ {!isGuest ? ( + <> +
+ {showBrowserHint ? : null} +
- -
- ) : null} + + + ) : null} + ); }