feat(ux): plain-language TL;DR badge and copy-to-clipboard (#45) - #76
Merged
Conversation
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.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Closes #45.
What
Two reader-facing improvements for non-technical visitors:
1. Plain-language TL;DR badge (Honest Box)
The badge under the Honest Box title is now a single sentence per locale, derived strictly from what the box states in that locale's copy (no euphemisms, FR-9 intact):
HomePagenow selects the badge explicitly per locale (the olda || b || cfallback could have leaked one locale's badge into another). Styling reuses the existing.honest-badgenotice tokens — no new design language.2. Copy-to-clipboard on command blocks
New
CodeBlock.astro(Copy button +<pre><code>) used by:InstallPage.astro— both platform-step blocks, the verify command, and the from-source block (all locales)GuidePage.astro— every guide code stepBehavior:
<script is:inline>inBaseHead.astro(~40 lines, same pattern as the merged theme toggle from style(ui): enlarge mobile theme toggle touch target and optimize script directives #46/style(ui): 40px theme toggle, FR nav breathing room, explicit script directives #68) — no framework, still zero-client-JS in spirit.navigator.clipboard.writeText, falling back to a hiddentextarea+execCommand("copy")for older Safari..copiedaccent border) for ~1.5 s, then reverts.<button type="button">(keyboard-focusable) with localizedaria-labels (Copy the command to the clipboard/انسخ الأمر إلى الحافظة/Copier la commande dans le presse-papiers).src/i18n/ui.ts→codegroup), carried to the shared script viadata-*attributes so the script stays locale-agnostic; SonarCloud'ssrc/i18n/**duplication exclusion covers the dictionaries.Verification
npx astro check— 0 errors (95 files).npm run build— 56 pages, clean..honest-badgepresent and visible on/en/,/ar/,/fr/homepages, text matches the copy above./en/install/(4) and/en/guides/first-run/(3); localized labels confirmed on/ar/install/and/fr/install/.navigator.clipboard.readText()returns exactly the block's command text (verified on both install and guide pages).Copied ✓+.copiedclass 250 ms after click; reverted toCopyby 1.75 s.scrollWidth - clientWidth <= 0) on all seven pages checked.