diff --git a/website/app/globals.css b/website/app/globals.css index a5968aa..cc794a7 100644 --- a/website/app/globals.css +++ b/website/app/globals.css @@ -347,11 +347,18 @@ section { /* Footer */ .site-footer { border-top: 1px solid var(--hairline); - padding: 32px 0 40px; + /* The bottom leaves room for the chat bubble (84 px; 64 px on narrow screens), so the last lines are never under it. */ + padding: 32px 0 112px; color: var(--muted); font-size: 0.95rem; } +@media (max-width: 480px) { + .site-footer { + padding-bottom: 88px; + } +} + .footer-links { display: flex; flex-wrap: wrap; @@ -396,3 +403,127 @@ section { padding: 80px 0; } } + +/* Chat bubble (components/ChatBubble.tsx), as on showrecorder.app: our own launcher on every page, in the spot and at + the size of Chatwoot's (64 px, 20 px from the right and bottom; 48 px and 16 px on narrow screens), in the site's + button green. It loads the chat only when pressed, then hides for Chatwoot's own. */ +.chat-bubble { + position: fixed; + right: 20px; + bottom: 20px; + z-index: 60; + display: flex; + flex-direction: column; + align-items: flex-end; + gap: 12px; +} + +.chat-bubble-button { + display: grid; + place-items: center; + width: 64px; + height: 64px; + border: 0; + border-radius: 50%; + background: var(--button-bg); + color: var(--button-ink); + box-shadow: var(--shadow); + cursor: pointer; +} + +/* Narrow screens: a smaller bubble (still well over the 44 px tap target) that covers less text. */ +@media (max-width: 480px) { + .chat-bubble { + right: 16px; + bottom: 16px; + } + + .chat-bubble-button { + width: 48px; + height: 48px; + } + + .chat-bubble-button svg { + width: 22px; + height: 22px; + } + + .chat-bubble-note { + max-width: calc(100vw - 32px); + } +} + +.chat-bubble-button[aria-busy="true"] { + cursor: progress; + /* A cue that needs no motion: the spinner only turns when motion is allowed. */ + opacity: 0.8; +} + +.chat-bubble-button:focus-visible { + outline: 3px solid var(--focus); + outline-offset: 3px; +} + +@media (prefers-reduced-motion: no-preference) { + .chat-bubble-button { + transition: transform 150ms ease; + } + + .chat-bubble-button:hover { + transform: scale(1.05); + } + + .chat-bubble-spinner { + animation: chat-bubble-spin 0.9s linear infinite; + } +} + +@keyframes chat-bubble-spin { + to { + transform: rotate(360deg); + } +} + +.chat-bubble-note { + display: flex; + align-items: flex-start; + gap: 8px; + max-width: min(320px, calc(100vw - 40px)); + padding: 12px 12px 12px 16px; + border: 1px solid var(--hairline); + border-radius: 12px; + background: var(--bg-raised); + color: var(--ink); + font-size: 0.9375rem; + line-height: 1.4; +} + +.chat-bubble-note a { + color: var(--link); + text-decoration: underline; + overflow-wrap: anywhere; +} + +.chat-bubble-dismiss { + flex: none; + display: grid; + place-items: center; + width: 28px; + height: 28px; + border: 0; + border-radius: 6px; + background: transparent; + color: var(--muted); + cursor: pointer; +} + +.chat-bubble-dismiss:focus-visible { + outline: 3px solid var(--focus); + outline-offset: 1px; +} + +@media print { + .chat-bubble { + display: none; + } +} diff --git a/website/app/layout.tsx b/website/app/layout.tsx index a89b477..150562c 100644 --- a/website/app/layout.tsx +++ b/website/app/layout.tsx @@ -1,5 +1,6 @@ import type { Metadata, Viewport } from "next"; import Script from "next/script"; +import { ChatBubble } from "@/components/ChatBubble"; import { posthogInitScript } from "@/lib/analytics"; import { OG_IMAGE } from "@/lib/metadata"; import { SITE_DESCRIPTION, SITE_NAME, SITE_URL } from "@/lib/site"; @@ -47,6 +48,8 @@ export default function RootLayout({ children }: { children: React.ReactNode }) Skip to content {children} + {/* Click-to-load support chat on every page; nothing loads from the chat server until it is pressed. */} + {/* Cookieless visit counts; see lib/analytics.ts and the privacy section. */}