Skip to content

Commit 20aae0e

Browse files
authored
Content width setting (alexjustesen#442)
1 parent ef71ce3 commit 20aae0e

File tree

12 files changed

+94
-3
lines changed

12 files changed

+94
-3
lines changed

app/Filament/Pages/Dashboard.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,13 @@ public function render(): View
4141
->layout(static::$layout, $this->getLayoutData());
4242
}
4343

44+
protected function getMaxContentWidth(): string
45+
{
46+
$settings = new GeneralSettings();
47+
48+
return $settings->content_width;
49+
}
50+
4451
protected function getActions(): array
4552
{
4653
return [

app/Filament/Pages/Settings/GeneralPage.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,13 @@ class GeneralPage extends SettingsPage
2626

2727
protected static string $settings = GeneralSettings::class;
2828

29+
protected function getMaxContentWidth(): string
30+
{
31+
$settings = new GeneralSettings();
32+
33+
return $settings->content_width;
34+
}
35+
2936
protected function getFormSchema(): array
3037
{
3138
return [
@@ -53,6 +60,11 @@ protected function getFormSchema(): array
5360
->placeholder('M j, Y G:i:s')
5461
->maxLength(25)
5562
->required(),
63+
Select::make('content_width')
64+
->options([
65+
'7xl' => 'Default width',
66+
'full' => 'Full width',
67+
]),
5668
])
5769
->compact()
5870
->columns([

app/Filament/Pages/Settings/InfluxDbPage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace App\Filament\Pages\Settings;
44

5+
use App\Settings\GeneralSettings;
56
use App\Settings\InfluxDbSettings;
67
use Closure;
78
use Filament\Forms\Components\Grid;
@@ -24,6 +25,13 @@ class InfluxDbPage extends SettingsPage
2425

2526
protected static string $settings = InfluxDbSettings::class;
2627

28+
protected function getMaxContentWidth(): string
29+
{
30+
$settings = new GeneralSettings();
31+
32+
return $settings->content_width;
33+
}
34+
2735
protected function getFormSchema(): array
2836
{
2937
return [

app/Filament/Pages/Settings/NotificationPage.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
use App\Forms\Components\TestMailNotification;
77
use App\Forms\Components\TestTelegramNotification;
88
use App\Mail\Test;
9+
use App\Settings\GeneralSettings;
910
use App\Settings\NotificationSettings;
1011
use App\Telegram\TelegramNotification;
1112
use Closure;
@@ -35,6 +36,13 @@ class NotificationPage extends SettingsPage
3536

3637
protected static string $settings = NotificationSettings::class;
3738

39+
protected function getMaxContentWidth(): string
40+
{
41+
$settings = new GeneralSettings();
42+
43+
return $settings->content_width;
44+
}
45+
3846
protected function getFormSchema(): array
3947
{
4048
return [

app/Filament/Pages/Settings/ThresholdsPage.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ class ThresholdsPage extends SettingsPage
2727

2828
protected static string $settings = ThresholdSettings::class;
2929

30+
protected function getMaxContentWidth(): string
31+
{
32+
$settings = new GeneralSettings();
33+
34+
return $settings->content_width;
35+
}
36+
3037
protected function getFormSchema(): array
3138
{
3239
return [

app/Filament/Resources/ResultResource/Pages/ListResults.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Filament\Resources\ResultResource\Pages;
44

55
use App\Filament\Resources\ResultResource;
6+
use App\Settings\GeneralSettings;
67
use Filament\Resources\Pages\ListRecords;
78

89
class ListResults extends ListRecords
@@ -14,6 +15,13 @@ protected function getTablePollingInterval(): ?string
1415
return '5s';
1516
}
1617

18+
protected function getMaxContentWidth(): string
19+
{
20+
$settings = new GeneralSettings();
21+
22+
return $settings->content_width;
23+
}
24+
1725
protected function getHeaderWidgets(): array
1826
{
1927
return ResultResource::getWidgets();

app/Filament/Resources/UserResource/Pages/CreateUser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@
33
namespace App\Filament\Resources\UserResource\Pages;
44

55
use App\Filament\Resources\UserResource;
6+
use App\Settings\GeneralSettings;
67
use Filament\Resources\Pages\CreateRecord;
78

89
class CreateUser extends CreateRecord
910
{
1011
protected static string $resource = UserResource::class;
12+
13+
protected function getMaxContentWidth(): string
14+
{
15+
$settings = new GeneralSettings();
16+
17+
return $settings->content_width;
18+
}
1119
}

app/Filament/Resources/UserResource/Pages/EditUser.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace App\Filament\Resources\UserResource\Pages;
44

55
use App\Filament\Resources\UserResource;
6+
use App\Settings\GeneralSettings;
67
use Filament\Pages\Actions;
78
use Filament\Resources\Pages\EditRecord;
89
use Illuminate\Support\Facades\Hash;
@@ -11,6 +12,13 @@ class EditUser extends EditRecord
1112
{
1213
protected static string $resource = UserResource::class;
1314

15+
protected function getMaxContentWidth(): string
16+
{
17+
$settings = new GeneralSettings();
18+
19+
return $settings->content_width;
20+
}
21+
1422
protected function getActions(): array
1523
{
1624
return [

app/Filament/Resources/UserResource/Pages/ListUsers.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@
33
namespace App\Filament\Resources\UserResource\Pages;
44

55
use App\Filament\Resources\UserResource;
6+
use App\Settings\GeneralSettings;
67
use Filament\Pages\Actions;
78
use Filament\Resources\Pages\ListRecords;
89

910
class ListUsers extends ListRecords
1011
{
1112
protected static string $resource = UserResource::class;
1213

14+
protected function getMaxContentWidth(): string
15+
{
16+
$settings = new GeneralSettings();
17+
18+
return $settings->content_width;
19+
}
20+
1321
protected function getActions(): array
1422
{
1523
return [

app/Settings/GeneralSettings.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ class GeneralSettings extends Settings
88
{
99
public bool $auth_enabled;
1010

11+
public string $content_width;
12+
1113
public ?string $speedtest_schedule;
1214

1315
/** @var string[] */

0 commit comments

Comments
 (0)