fix panel
Some checks failed
Tests / lint (push) Has been cancelled
Tests / test (push) Has been cancelled
Tests / test-postgres (push) Has been cancelled

This commit is contained in:
2026-08-22 22:48:56 +02:00
parent 2cca79cf04
commit c30863ab9b
6 changed files with 0 additions and 113 deletions

View File

@@ -86,14 +86,6 @@ class AdminPanelProvider extends PanelProvider
]) ])
// Language switcher, rendered next to the user menu. // Language switcher, rendered next to the user menu.
// First render hook to fire on every page, panel and login alike:
// the one place that has to be true regardless of which screen
// somebody lands on first.
->renderHook(
PanelsRenderHook::BODY_START,
fn (): string => view('filament.partials.environment-banner')->render(),
)
->renderHook( ->renderHook(
PanelsRenderHook::USER_MENU_BEFORE, PanelsRenderHook::USER_MENU_BEFORE,
fn (): string => view('filament.partials.language-switcher')->render(), fn (): string => view('filament.partials.language-switcher')->render(),

View File

@@ -30,11 +30,6 @@ return [
], ],
], ],
'environment' => [
'production' => 'Producció — això és real',
'other' => 'Entorn de :name',
],
'concurrency' => [ 'concurrency' => [
'title' => 'No s\'ha desat', 'title' => 'No s\'ha desat',
'body' => 'Algú altre ha canviat això mentre ho editaves. Recarrega la pàgina per veure la versió actual: si ho deses ara, perdries aquest canvi.', 'body' => 'Algú altre ha canviat això mentre ho editaves. Recarrega la pàgina per veure la versió actual: si ho deses ara, perdries aquest canvi.',

View File

@@ -30,11 +30,6 @@ return [
], ],
], ],
'environment' => [
'production' => 'Production — this is real',
'other' => ':name environment',
],
'concurrency' => [ 'concurrency' => [
'title' => 'Not saved', 'title' => 'Not saved',
'body' => 'Somebody else changed this while you were editing it. Reload the page to see the current version — saving now would overwrite that change.', 'body' => 'Somebody else changed this while you were editing it. Reload the page to see the current version — saving now would overwrite that change.',

View File

@@ -30,11 +30,6 @@ return [
], ],
], ],
'environment' => [
'production' => 'Producción — esto es real',
'other' => 'Entorno de :name',
],
'concurrency' => [ 'concurrency' => [
'title' => 'No se ha guardado', 'title' => 'No se ha guardado',
'body' => 'Alguien más ha cambiado esto mientras lo editabas. Recarga la página para ver la versión actual: si guardas ahora, perderías ese cambio.', 'body' => 'Alguien más ha cambiado esto mientras lo editabas. Recarga la página para ver la versión actual: si guardas ahora, perderías ese cambio.',

View File

@@ -1,22 +0,0 @@
{{-- Rendered at the very top of every page in the panel, on every install.
The failure this exists for runs in one direction only: mistaking a real
deployment for a throwaway copy, not the other way round. Nobody edits a
local clone carefully because they think it is production — the mistake
that costs something is the reverse. So `local` stays silent, and
anything else says so, loudly in the one case that matters. --}}
@unless (app()->environment('local'))
<div
role="status"
@class([
'w-full py-1 text-center text-xs font-semibold tracking-wide text-white uppercase',
'bg-danger-600' => app()->environment('production'),
'bg-warning-600' => ! app()->environment('production'),
])
>
{{ app()->environment('production')
? __('panel.environment.production')
: __('panel.environment.other', ['name' => app()->environment()]) }}
</div>
@endunless

View File

@@ -1,68 +0,0 @@
<?php
declare(strict_types=1);
namespace Tests\Feature\Panel;
use Database\Seeders\RolePermissionSeeder;
use Illuminate\Foundation\Testing\RefreshDatabase;
use PHPUnit\Framework\Attributes\Test;
use Tests\FakesPireon;
use Tests\TestCase;
/**
* The one banner that has to be right in the one direction that matters.
*
* Nobody edits a local clone carefully because they mistake it for
* production — the expensive mistake runs the other way. So the only
* environment that stays silent is `local`; every other one says so, and
* production says so the loudest.
*/
class EnvironmentBannerTest extends TestCase
{
use FakesPireon, RefreshDatabase;
protected function setUp(): void
{
parent::setUp();
$this->seed(RolePermissionSeeder::class);
$this->actingAs($this->userWithRoles('admin'));
}
protected function setEnvironment(string $environment): void
{
$this->app['env'] = $environment;
}
#[Test]
public function nothing_is_shown_in_a_local_install(): void
{
$this->setEnvironment('local');
$this->get('/admin')
->assertOk()
->assertDontSee(__('panel.environment.production'))
->assertDontSeeText('bg-danger-600', escape: false);
}
#[Test]
public function production_says_so_in_the_loudest_colour(): void
{
$this->setEnvironment('production');
$this->get('/admin')
->assertOk()
->assertSee(__('panel.environment.production'));
}
#[Test]
public function anything_else_names_itself(): void
{
$this->setEnvironment('staging');
$this->get('/admin')
->assertOk()
->assertSee(__('panel.environment.other', ['name' => 'staging']));
}
}