From d5cf93dc149173a3103881a6399fa77c42b10d67 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:01:00 +0000 Subject: [PATCH 1/3] Even out the reply bar's spacing and lighten its glass The reply field sat 20pt under the fade and only 8pt above the row of tools. The reply row drops its 8pt top padding and the field row gains 8pt underneath, so the field is 12pt under the fade and 16pt above the tools. The bar is the same height as before. On iOS the bar now asks mobile-air for its glass at 0.8 opacity (glass-opacity on native:bottom-bar, NativePHP/mobile-air#735), so a little more of the page shows through. Android draws no glass and is unchanged. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 15 +++++++++++ .../views/native/commit-detail.blade.php | 5 ++-- .../native/partials/composer-box.blade.php | 6 +++-- tests/Feature/Screens/CommitDetailTest.php | 27 +++++++++++++++++++ 4 files changed, 49 insertions(+), 4 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index a6aeb0bb..8e736203 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -44,6 +44,12 @@ final class Display */ public const int ComposerGlassTint = 40; + /** + * How opaque the glass under the reply bar gets on iOS once it has faded in, from 0 to 1 (see + * replyBarGlassOpacity()). mobile-air's own default is 1, which over a dark page reads as a heavy slab. + */ + public const float ReplyBarGlassOpacity = 0.8; + /** * About how many characters fit on a line of the box's field, which runs the width of the box. */ @@ -308,6 +314,15 @@ public static function composerBarGlass(): string return self::fadesInBar() ? 'glass' : ''; } + /** + * The reply bar's glass-opacity: how opaque mobile-air's glass behind the bar gets on iOS once it has faded in, + * so a little more of the page shows through. Null on Android, which draws no glass behind a bottom bar. + */ + public static function replyBarGlassOpacity(): ?float + { + return self::fadesInBar() ? self::ReplyBarGlassOpacity : null; + } + /** * The composer bar's own classes. On Android it's the surface. On iOS it has no background at all: mobile-air * paints a bar's background colour behind the whole bar, which would cover the fade at its top, so the bar's diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index bf62a9b4..ce9a027f 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -151,7 +151,7 @@ --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @@ -173,12 +173,13 @@ @include('native.partials.composer-photos', ['photos' => $replyImages, 'photoRef' => 'reply-photo']) @endif - + @php($hasDraft = trim($reply) !== '' || $replyImages !== []) @php($photosFull = count($replyImages) >= \App\Devnull\DraftImages::MaxImages) @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', + 'fieldPadding' => 'pt-1 pb-2', 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28, 'inset' => 'pl-3']]] : [], 'tools' => [ ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index 5cb53133..c036c99c 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -11,12 +11,14 @@ row, ahead of the tools, and for the end, left of the send button, such as the count of a long draft. $send is send-button's: its ref, label, method, and whether it can send yet. - The field's text lines up with the tools' icons under it. + The field's text lines up with the tools' icons under it. $fieldPadding is the field row's padding above and below + the field (pt-1 by default), for a bar that wants more room between the field and the row under it. --}} @php($lead ??= []) +@php($fieldPadding ??= 'pt-1') @php($trail ??= []) - + @include($field) diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 8b692e51..7e0360c4 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -7,6 +7,7 @@ use App\Models\PendingWrite; use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; +use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; @@ -901,6 +902,32 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): } })->with(['ios', 'android']); +it('keeps the reply field closer to the fade than to the row of tools under it', function (string $platform) { + fakeThread(); + + $screen = Native::visit('/log/commits/c2', platform: $platform); + + // [top, right, bottom, left]. The row has no top padding, so the field starts 4pt under the fade, and the field + // row leaves 8pt between the field and the tools. + expect(nodeByRef($screen, 'reply-row')['layout']['padding'])->toEqual([0, 16, 8, 16]) + ->and(nodeByRef($screen, 'reply-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); +})->with(['ios', 'android']); + +it('asks mobile-air for a lighter glass under the reply bar on iOS only', function (string $platform, ?float $opacity) { + fakeThread(); + + $screen = Native::visit('/log/commits/c2', platform: $platform); + $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); + + expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($opacity); +})->with([ + 'ios' => ['ios', Display::ReplyBarGlassOpacity], + 'android' => ['android', null], +])->skip( + ! method_exists(BottomBar::class, 'glassOpacity'), + 'Needs a mobile-air with glass-opacity on native:bottom-bar (NativePHP/mobile-air#735)', +); + it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); From 4f0ed672b28477313e499f69886907a66cc9a47d Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:31:16 +0000 Subject: [PATCH 2/3] Use glass/80 for both composer bars and even out the Messages bar The lighter glass is now mobile-air's glass/N suffix rather than a separate attribute, and it's on Display::composerBarGlass(), so the Messages composer gets it too. Messages had the same uneven gaps as the reply bar, so the spacing moves into composer-box for both: no top padding on the row around the box, and 8pt between the field and the row of tools. Both bars keep their height. Co-Authored-By: Claude Opus 5.5 --- app/Devnull/Display.php | 22 ++++++------------- .../views/native/commit-detail.blade.php | 3 +-- resources/views/native/conversation.blade.php | 2 +- .../native/partials/composer-box.blade.php | 7 +++--- tests/Feature/Screens/CommitDetailTest.php | 18 +++++++-------- tests/Feature/Screens/RemotesComposerTest.php | 17 ++++++++++++++ tests/Pest.php | 12 ++++++++++ 7 files changed, 49 insertions(+), 32 deletions(-) diff --git a/app/Devnull/Display.php b/app/Devnull/Display.php index 8e736203..6648e4e7 100644 --- a/app/Devnull/Display.php +++ b/app/Devnull/Display.php @@ -45,10 +45,10 @@ final class Display public const int ComposerGlassTint = 40; /** - * How opaque the glass under the reply bar gets on iOS once it has faded in, from 0 to 1 (see - * replyBarGlassOpacity()). mobile-air's own default is 1, which over a dark page reads as a heavy slab. + * How opaque, in percent, the glass under a composer bar gets on iOS once it has faded in (glass/N, see + * composerBarGlass()). Full glass over a dark screen reads as a heavy slab. */ - public const float ReplyBarGlassOpacity = 0.8; + public const int ComposerGlassOpacity = 80; /** * About how many characters fit on a line of the box's field, which runs the width of the box. @@ -306,21 +306,13 @@ public static function fadesInBar(): bool * The classes for a composer's native:bottom-bar. On iOS that's Liquid Glass: what scrolls under the bar shows * through it, blurred. A patched mobile-air draws the glass behind the whole bar, under the home indicator too, * and fades it in over the bar's top ComposerFadeHeight points, so it has no hard top edge. EDGE's own glass on - * an element can't be faded, and stops short of the home indicator. Android has no glass, so the bar stays the - * surface there. + * an element can't be faded, and stops short of the home indicator. The glass stops at ComposerGlassOpacity + * percent (glass/N), so a little of the screen under the bar shows through. Android has no glass, so the bar + * stays the surface there. */ public static function composerBarGlass(): string { - return self::fadesInBar() ? 'glass' : ''; - } - - /** - * The reply bar's glass-opacity: how opaque mobile-air's glass behind the bar gets on iOS once it has faded in, - * so a little more of the page shows through. Null on Android, which draws no glass behind a bottom bar. - */ - public static function replyBarGlassOpacity(): ?float - { - return self::fadesInBar() ? self::ReplyBarGlassOpacity : null; + return self::fadesInBar() ? 'glass/'.self::ComposerGlassOpacity : ''; } /** diff --git a/resources/views/native/commit-detail.blade.php b/resources/views/native/commit-detail.blade.php index ce9a027f..5d26c304 100644 --- a/resources/views/native/commit-detail.blade.php +++ b/resources/views/native/commit-detail.blade.php @@ -151,7 +151,7 @@ --}} @php($replyPostingMe = app(\App\Devnull\Account::class)->user()) @php($replyPostsAs = $replyPostingMe !== null && \App\Devnull\PostAs::offered($replyAuthor)) - + @if (\App\Devnull\Display::fadesInBar()) @include('native.partials.composer-fade', ['ref' => 'reply-fade', 'inBar' => true]) @@ -179,7 +179,6 @@ @include('native.partials.composer-box', [ 'ref' => 'reply', 'field' => $replyPreviewing ? 'native.partials.reply-preview' : 'native.partials.reply-field', - 'fieldPadding' => 'pt-1 pb-2', 'lead' => $replyPostsAs ? [['native.partials.post-as', ['ref' => 'reply-post-as', 'me' => $replyPostingMe, 'picked' => $replyAuthor, 'method' => 'postAsInReply', 'size' => 28, 'inset' => 'pl-3']]] : [], 'tools' => [ ['ref' => 'reply-add-photos', 'icon' => \App\Icons\Lucide::ImagePlus, 'label' => $photosFull ? 'A reply can have up to 3 photos' : 'Add photos', 'menu' => $photosFull ? null : \App\Devnull\ComposerMenu::photoItems(), 'disabled' => $photosFull], diff --git a/resources/views/native/conversation.blade.php b/resources/views/native/conversation.blade.php index e5642545..5191385f 100644 --- a/resources/views/native/conversation.blade.php +++ b/resources/views/native/conversation.blade.php @@ -124,7 +124,7 @@ The box keeps its row, and the row its place among the bar's, so the field inside never moves. A voice note takes the field's place, and the +'s, while it's recorded and waits to be pushed. --}} - + @include('native.partials.composer-box', [ 'ref' => 'message', 'field' => $recorder === null ? 'native.partials.message-field' : 'native.partials.voice-recorder', diff --git a/resources/views/native/partials/composer-box.blade.php b/resources/views/native/partials/composer-box.blade.php index c036c99c..c706afc0 100644 --- a/resources/views/native/partials/composer-box.blade.php +++ b/resources/views/native/partials/composer-box.blade.php @@ -11,14 +11,13 @@ row, ahead of the tools, and for the end, left of the send button, such as the count of a long draft. $send is send-button's: its ref, label, method, and whether it can send yet. - The field's text lines up with the tools' icons under it. $fieldPadding is the field row's padding above and below - the field (pt-1 by default), for a bar that wants more room between the field and the row under it. + The field's text lines up with the tools' icons under it. The field sits a little nearer the fade above it than + the row under it: the row around the box has no top padding, and the field row leaves 8pt under the field. --}} @php($lead ??= []) -@php($fieldPadding ??= 'pt-1') @php($trail ??= []) - + @include($field) diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 7e0360c4..5e7d4c55 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -7,7 +7,6 @@ use App\Models\PendingWrite; use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; -use Native\Mobile\Edge\Elements\BottomBar; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; @@ -869,6 +868,10 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): it('puts the reply bar on glass on iOS and the surface on Android, with no line, and fades the page out above it', function (string $platform) { fakeThread(); + if ($platform === 'ios') { + skipWithoutGlassOpacity(); + } + $screen = Native::visit('/log/commits/c2', platform: $platform); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); $bar = $bottomBar['children'][0]; @@ -913,20 +916,15 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): ->and(nodeByRef($screen, 'reply-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); })->with(['ios', 'android']); -it('asks mobile-air for a lighter glass under the reply bar on iOS only', function (string $platform, ?float $opacity) { +it('fades the glass under the reply bar to 80% on iOS only', function (string $platform) { + skipWithoutGlassOpacity(); fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); $bottomBar = findNode($screen->tree(), fn (array $node): bool => ($node['type'] ?? null) === 'bottom_bar'); - expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($opacity); -})->with([ - 'ios' => ['ios', Display::ReplyBarGlassOpacity], - 'android' => ['android', null], -])->skip( - ! method_exists(BottomBar::class, 'glassOpacity'), - 'Needs a mobile-air with glass-opacity on native:bottom-bar (NativePHP/mobile-air#735)', -); + expect($bottomBar['props']['glass_opacity'] ?? null)->toBe($platform === 'ios' ? Display::ComposerGlassOpacity / 100 : null); +})->with(['ios', 'android']); it('ends the page above the reply bar, and further as the draft grows', function () { fakeThread(replies: [replyJson(['id' => 'r1', 'parent_id' => 'c2', 'body' => 'The last reply'])]); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index 637ed790..a6c567cb 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -285,7 +285,22 @@ function threadWithAda(string $platform = 'ios'): TestableComponent ->and(nodeByRef($screen, 'push')['props']['a11y_label'] ?? nodeByRef($screen, 'push')['a11y_label'] ?? null)->toBe('Push'); })->with(['ios', 'android']); +it('keeps the field closer to the fade than to the + and Push under it', function (string $platform) { + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); + + $screen = threadWithAda($platform); + + // [top, right, bottom, left]. As on a commit's reply bar: no top padding on the row, so the field starts 4pt + // under the fade, and 8pt between the field and the row under it. + expect(nodeByRef($screen, 'message-row')['layout']['padding'])->toEqual([0, 16, 8, 16]) + ->and(nodeByRef($screen, 'message-field-row')['layout']['padding'])->toEqual([4, 12, 8, 16]); +})->with(['ios', 'android']); + it('puts the bar on glass on iOS and the surface on Android, with no box or line, and fades the thread out above it', function (string $platform) { + if ($platform === 'ios') { + skipWithoutGlassOpacity(); + } + serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); $screen = threadWithAda($platform); @@ -306,6 +321,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent // top, ending at the glass's tint, and its rows carry the tint, in either appearance. The bar itself has no // background, which iOS would paint behind the fade. expect($bottomBar['props']['glass'] ?? null)->toBe(1) + ->and($bottomBar['props']['glass_opacity'] ?? null)->toBe(Display::ComposerGlassOpacity / 100) ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-fade', 'composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBeNull() ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe('#66'.$surface) @@ -315,6 +331,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent } else { // No glass on Android. The thread stops at the bar, so the fade lies over its foot, and the bar is the surface. expect($bottomBar['props']['glass'] ?? null)->toBeNull() + ->and($bottomBar['props']['glass_opacity'] ?? null)->toBeNull() ->and(childRefs($screen, 'composer-bar'))->toBe(['composer-rows']) ->and($bar['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) ->and(nodeByRef($screen, 'composer-rows')['style']['bg_color'] ?? null)->toBe(config('native-ui.theme.light.surface')) diff --git a/tests/Pest.php b/tests/Pest.php index d1bf556c..4fd27341 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -15,6 +15,7 @@ use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; use Native\Mobile\AsyncTask; +use Native\Mobile\Edge\TailwindParser; use Native\Mobile\Events\Async\AsyncTaskFailed; use Native\Mobile\Events\Async\AsyncTaskFinished; use Native\Mobile\Events\Gallery\MediaSelected; @@ -1124,3 +1125,14 @@ function skipWithoutSkia(): void test()->markTestSkipped('needs the Skia plugin installed'); } } + +/** + * Skips the test unless the installed mobile-air reads an opacity suffix on the glass class (glass/80, from + * NativePHP/mobile-air#735). Without it the composer bars' glass/N isn't parsed at all. + */ +function skipWithoutGlassOpacity(): void +{ + if (! array_key_exists('glassOpacity', TailwindParser::parse('glass/80'))) { + test()->markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); + } +} From c5180c652338026861e3b61026827b1010e45cd5 Mon Sep 17 00:00:00 2001 From: Simon Hamp Date: Sat, 21 Nov 2026 01:33:24 +0000 Subject: [PATCH 3/3] Move the glass/N test guard out of Pest.php It sat at the end of tests/Pest.php, where the build branch's partial frames helpers also land, so the two clashed on merge. It's a small class in tests/Support now. Co-Authored-By: Claude Opus 5.5 --- tests/Feature/Screens/CommitDetailTest.php | 5 ++-- tests/Feature/Screens/RemotesComposerTest.php | 3 ++- tests/Pest.php | 12 ---------- tests/Support/GlassOpacity.php | 24 +++++++++++++++++++ 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 tests/Support/GlassOpacity.php diff --git a/tests/Feature/Screens/CommitDetailTest.php b/tests/Feature/Screens/CommitDetailTest.php index 5e7d4c55..591eb7f1 100644 --- a/tests/Feature/Screens/CommitDetailTest.php +++ b/tests/Feature/Screens/CommitDetailTest.php @@ -9,6 +9,7 @@ use Illuminate\Support\Facades\Http; use Native\Mobile\Events\Alert\ButtonPressed; use Native\Mobile\Testing\Native; +use Tests\Support\GlassOpacity; beforeEach(function () { config(['devnull.url' => 'http://devnull.test']); @@ -869,7 +870,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): fakeThread(); if ($platform === 'ios') { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); } $screen = Native::visit('/log/commits/c2', platform: $platform); @@ -917,7 +918,7 @@ function fakeThread(array $commit = [], array $replies = [], array $extra = []): })->with(['ios', 'android']); it('fades the glass under the reply bar to 80% on iOS only', function (string $platform) { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); fakeThread(); $screen = Native::visit('/log/commits/c2', platform: $platform); diff --git a/tests/Feature/Screens/RemotesComposerTest.php b/tests/Feature/Screens/RemotesComposerTest.php index a6c567cb..6e3e0079 100644 --- a/tests/Feature/Screens/RemotesComposerTest.php +++ b/tests/Feature/Screens/RemotesComposerTest.php @@ -10,6 +10,7 @@ use Native\Mobile\Facades\System; use Native\Mobile\Testing\Native; use Native\Mobile\Testing\TestableComponent; +use Tests\Support\GlassOpacity; const ComposerViewerId = '0199e5c4-0000-7000-8000-000000000001'; @@ -298,7 +299,7 @@ function threadWithAda(string $platform = 'ios'): TestableComponent it('puts the bar on glass on iOS and the surface on Android, with no box or line, and fades the thread out above it', function (string $platform) { if ($platform === 'ios') { - skipWithoutGlassOpacity(); + GlassOpacity::skipUnlessSupported(); } serveThreadWithAda([remoteMessageJson(['id' => 1])], ['read_through_id' => 1]); diff --git a/tests/Pest.php b/tests/Pest.php index 4fd27341..d1bf556c 100644 --- a/tests/Pest.php +++ b/tests/Pest.php @@ -15,7 +15,6 @@ use Illuminate\Http\Client\Request; use Illuminate\Support\Facades\Http; use Native\Mobile\AsyncTask; -use Native\Mobile\Edge\TailwindParser; use Native\Mobile\Events\Async\AsyncTaskFailed; use Native\Mobile\Events\Async\AsyncTaskFinished; use Native\Mobile\Events\Gallery\MediaSelected; @@ -1125,14 +1124,3 @@ function skipWithoutSkia(): void test()->markTestSkipped('needs the Skia plugin installed'); } } - -/** - * Skips the test unless the installed mobile-air reads an opacity suffix on the glass class (glass/80, from - * NativePHP/mobile-air#735). Without it the composer bars' glass/N isn't parsed at all. - */ -function skipWithoutGlassOpacity(): void -{ - if (! array_key_exists('glassOpacity', TailwindParser::parse('glass/80'))) { - test()->markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); - } -} diff --git a/tests/Support/GlassOpacity.php b/tests/Support/GlassOpacity.php new file mode 100644 index 00000000..4acf0dac --- /dev/null +++ b/tests/Support/GlassOpacity.php @@ -0,0 +1,24 @@ +markTestSkipped('Needs a mobile-air that reads glass/N (NativePHP/mobile-air#735)'); + } + } +}