diff --git a/docs/rebuild/design/design-system.md b/docs/rebuild/design/design-system.md index 34e04499..45889494 100644 --- a/docs/rebuild/design/design-system.md +++ b/docs/rebuild/design/design-system.md @@ -1535,8 +1535,8 @@ Hero #top app icon (64, 80 from 768) · H1 "TablePro 0.85" (Home's size) · " - **After the click.** The DMG action, in the hero or the Mac band, gives way in place to "Your download has started. If it didn't, download again." (the same link, `download-retry`) and three numbered steps, and takes focus. Only when a release source answered; with none the button opens GitHub's latest release and nothing claims a download. -- **Commands** wrap at spaces with a hanging indent, and a long URL after a slash, so nothing scrolls on a phone. The - copy button says Copy and Copied. +- **Commands** keep one line each and the block scrolls sideways, as a terminal does (owner, 2026-11-08). The copy + button says Copy and Copied. - **QR code** of the App Store URL, drawn on the server by `lib/qr.ts` (byte mode, level M), black on white in both themes with its quiet zone. Hidden below 640px and on an iPhone or iPad. `tests/js/qr.test.ts` decodes it. - **Ids.** `#mac`, `#linux`, `#ios` are the bands; `#updates` (Security's "Download and updates") lands on the Mac diff --git a/resources/js/components/download/command-block.tsx b/resources/js/components/download/command-block.tsx index 48b6ee71..58760a86 100644 --- a/resources/js/components/download/command-block.tsx +++ b/resources/js/components/download/command-block.tsx @@ -1,9 +1,6 @@ -import { Fragment } from 'react'; import { CodeBlock } from '@/components/ui/code'; import { useI18n } from '@/i18n'; -const WHOLE_TOKEN = 32; - interface CommandBlockProps { // One command per line, exactly as copied: no prompt. lines: string[]; @@ -13,32 +10,15 @@ interface CommandBlockProps { className?: string; } -// One copy button takes every line. A line wraps at a space, its continuation indented so it never reads as the next -// command. Tokens are kept whole, since a browser would break one after a hyphen; a long one (a URL) may also break -// after a slash, so it wraps on a phone instead of scrolling. +// One copy button takes every line. A command keeps its line and the block scrolls sideways, as a terminal would, so +// a wrapped URL never reads as two commands (owner, 2026-11-08). export default function CommandBlock({ lines, title, label, onCopied, className }: CommandBlockProps) { const { m } = useI18n(); return ( -
-                
-                    {lines.map((line, index) => (
-                        
-                            {line.split(' ').map((token, position) => (
-                                
-                                    {position > 0 && ' '}
-                                    {(token.length > WHOLE_TOKEN ? token.split(/(?<=\/)(?!\/)/) : [token]).map((part, at) => (
-                                        
-                                            {at > 0 && }
-                                            {part}
-                                        
-                                    ))}
-                                
-                            ))}
-                        
-                    ))}
-                
+            
+                {lines.join('\n')}
             
); diff --git a/tests/Feature/Pages/DownloadTest.php b/tests/Feature/Pages/DownloadTest.php index 82d61f79..2a4039ad 100644 --- a/tests/Feature/Pages/DownloadTest.php +++ b/tests/Feature/Pages/DownloadTest.php @@ -318,11 +318,17 @@ function downloadHeroFor(Dom\HTMLDocument $document, string $device): array $expected = collect($linux['destinations'])->filter(fn(array $destination): bool => isset($destination['commands']))->map(fn(array $destination): array => $destination['commands'])->values()->all(); $blocks = array_map( - fn(Dom\Element $block): array => array_map(fn(Dom\Element $line): string => (string) $line->textContent, iterator_to_array($block->querySelectorAll('pre code > span'))), + fn(Dom\Element $block): array => explode("\n", (string) $block->querySelector('pre code')?->textContent), iterator_to_array($document->querySelectorAll('#linux [role="region"]')), ); $headings = array_map(fn(Dom\Element $heading): string => downloadText($heading), iterator_to_array($document->querySelectorAll('#linux h3'))); + // A command keeps its line and the block scrolls sideways (owner, 2026-11-08). + foreach ($document->querySelectorAll('#linux pre') as $pre) { + expect(in_array('whitespace-pre', explode(' ', (string) $pre->getAttribute('class')), true))->toBeTrue('a command block wraps its lines') + ->and($pre->querySelectorAll('wbr'))->toHaveCount(0); + } + expect($blocks)->toBe($expected) ->and($headings)->toBe(['Ubuntu 26.04 and 26.10', 'Fedora 44 and 45', 'Other distributions, with Flatpak']) ->and(downloadText($document->querySelector('#linux h2 + span')))->toBe('Beta')