66use App \Traits \EnvironmentWriterTrait ;
77use Filament \Contracts \Plugin ;
88use Filament \Forms \Components \Slider ;
9- use Filament \Forms \Components \Toggle ;
109use Filament \Notifications \Notification ;
1110use Filament \Panel ;
1211use Filament \Schemas \Components \Group ;
@@ -27,60 +26,50 @@ public function boot(Panel $panel): void {}
2726 public function getSettingsForm (): array
2827 {
2928 $ schema = [
30- Toggle::make ('SNOWFLAKES_ENABLED ' )
31- ->label ('Enable Snowflakes ' )
32- ->columnSpanFull ()
33- ->live ()
34- ->default (fn () => config ('snowflakes.enabled ' )),
3529 Slider::make ('SNOWFLAKES_SIZE ' )
30+ ->label (trans ('snowflakes::strings.size ' ))
3631 ->range (minValue: 0.5 , maxValue: 4 )
3732 ->decimalPlaces (1 )
3833 ->step (0.1 )
39- ->label ('Size ' )
4034 ->tooltips ()
4135 ->hintIcon ('tabler-question-mark ' )
42- ->hintIconTooltip ('Size of the snowflakes. ' )
43- ->disabled (fn ($ get ) => !$ get ('SNOWFLAKES_ENABLED ' ))
36+ ->hintIconTooltip (trans ('snowflakes::strings.size_help ' ))
4437 ->default (fn () => config ('snowflakes.size ' )),
4538 Slider::make ('SNOWFLAKES_SPEED ' )
46- ->label (' Speed ' )
39+ ->label (trans ( ' snowflakes::strings.speed ' ) )
4740 ->range (minValue: 0.5 , maxValue: 3 )
4841 ->decimalPlaces (1 )
4942 ->step (0.1 )
5043 ->tooltips ()
5144 ->hintIcon ('tabler-question-mark ' )
52- ->hintIconTooltip ('Speed of the snowflakes falling. ' )
53- ->disabled (fn ($ get ) => !$ get ('SNOWFLAKES_ENABLED ' ))
45+ ->hintIconTooltip (trans ('snowflakes::strings.speed_help ' ))
5446 ->default (fn () => config ('snowflakes.speed ' )),
5547 Slider::make ('SNOWFLAKES_OPACITY ' )
56- ->label (' Opacity ' )
48+ ->label (trans ( ' snowflakes::strings.opacity ' ) )
5749 ->range (minValue: 0.1 , maxValue: 1 )
5850 ->decimalPlaces (1 )
5951 ->step (0.1 )
6052 ->tooltips ()
6153 ->hintIcon ('tabler-question-mark ' )
62- ->hintIconTooltip ('How well can you see through the snowflakes. ' )
63- ->disabled (fn ($ get ) => !$ get ('SNOWFLAKES_ENABLED ' ))
54+ ->hintIconTooltip (trans ('snowflakes::strings.opacity_help ' ))
6455 ->default (fn () => config ('snowflakes.opacity ' )),
6556 Slider::make ('SNOWFLAKES_DENSITY ' )
66- ->label (' Density ' )
57+ ->label (trans ( ' snowflakes::strings.density ' ) )
6758 ->range (minValue: 0.5 , maxValue: 10 )
6859 ->decimalPlaces (1 )
6960 ->step (0.1 )
7061 ->tooltips ()
7162 ->hintIcon ('tabler-question-mark ' )
72- ->hintIconTooltip ('Page density of the snowflakes. More density, more snowflakes. ' )
73- ->disabled (fn ($ get ) => !$ get ('SNOWFLAKES_ENABLED ' ))
63+ ->hintIconTooltip (trans ('snowflakes::strings.density_help ' ))
7464 ->default (fn () => config ('snowflakes.density ' )),
7565 Slider::make ('SNOWFLAKES_QUALITY ' )
76- ->label (' Quality ' )
66+ ->label (trans ( ' snowflakes::strings.quality ' ) )
7767 ->range (minValue: 0.1 , maxValue: 1 )
7868 ->decimalPlaces (1 )
7969 ->step (0.1 )
8070 ->tooltips ()
8171 ->hintIcon ('tabler-question-mark ' )
82- ->hintIconTooltip ('Higher quality may impact performance on some devices. ' )
83- ->disabled (fn ($ get ) => !$ get ('SNOWFLAKES_ENABLED ' ))
72+ ->hintIconTooltip (trans ('snowflakes::strings.quality_help ' ))
8473 ->default (fn () => config ('snowflakes.quality ' )),
8574 ];
8675
@@ -93,11 +82,10 @@ public function getSettingsForm(): array
9382
9483 public function saveSettings (array $ data ): void
9584 {
96- $ data ['SNOWFLAKES_ENABLED ' ] = $ data ['SNOWFLAKES_ENABLED ' ] ? 'true ' : 'false ' ;
9785 $ this ->writeToEnvironment ($ data );
9886
9987 Notification::make ()
100- ->title (' Settings saved ' )
88+ ->title (trans ( ' admin/setting.save_success ' ) )
10189 ->success ()
10290 ->send ();
10391 }
0 commit comments