From 407a8e135bf612207972c0eaceca4ad54a7d6ddf Mon Sep 17 00:00:00 2001 From: Elmehdi Aitbrahim Date: Sat, 22 Aug 2026 02:45:31 -0400 Subject: [PATCH] feat(ux): plain-language TL;DR badge and copy-to-clipboard (#45) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two reader-facing improvements for non-technical visitors: - Honest Box TL;DR: the badge copy is now a single plain sentence per locale (EN/AR/FR), derived strictly from what the box states — none of the shipped rules is profitable after the fees actually paid, none beats DCA, at best break-even inside the fee-free allowance. No spin, FR-9 posture intact. HomePage picks the badge per locale explicitly instead of the old cross-locale fallback chain. - Copy-to-clipboard on command blocks: new CodeBlock component (Copy button + pre) on the Install page's platform steps, verify command and from-source block, and on guide code steps. One delegated inline listener in BaseHead (same pattern as the theme toggle) uses navigator.clipboard.writeText with a hidden-textarea + execCommand fallback for older Safari; the button shows a transient localized "Copied" state for 1.5s. Labels and aria-labels live in the i18n layer (ui.ts code group), carried to the script via data attributes. Verified at 390px with puppeteer: badge visible on en/ar/fr homepages, copy buttons on /en/install/ and guide pages, clipboard round-trip matches the command text, zero horizontal overflow. --- src/components/BaseHead.astro | 45 ++++++++++++++++++++++++++ src/components/CodeBlock.astro | 34 +++++++++++++++++++ src/components/pages/GuidePage.astro | 7 ++-- src/components/pages/HomePage.astro | 4 ++- src/components/pages/InstallPage.astro | 25 +++++++++----- src/i18n/pages/home.ts | 8 +++-- src/i18n/ui.ts | 15 +++++++++ src/styles/global.css | 12 +++++++ 8 files changed, 133 insertions(+), 17 deletions(-) create mode 100644 src/components/CodeBlock.astro diff --git a/src/components/BaseHead.astro b/src/components/BaseHead.astro index d7e11d1..e01c449 100644 --- a/src/components/BaseHead.astro +++ b/src/components/BaseHead.astro @@ -106,6 +106,51 @@ const gscVerification = import.meta.env.PUBLIC_GSC_VERIFICATION_TOKEN; }); +{/* Copy-to-clipboard for command blocks (#45): one delegated listener per + page, same pattern as the theme toggle. Each button carries its locale's + labels as data attributes, so this script stays locale-agnostic. Falls + back to a hidden textarea + execCommand for older Safari. */} + + { analyticsToken && (