mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 06:56:52 +01:00 
			
		
		
		
	Fix missing font (#1404)
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									bd2a00760d
								
							
						
					
					
						commit
						af609994b6
					
				| @ -32,6 +32,7 @@ use Filament\Forms\Components\Textarea; | ||||
| use Filament\Forms\Components\TextInput; | ||||
| use Filament\Forms\Components\ToggleButtons; | ||||
| use Filament\Forms\Get; | ||||
| use Filament\Forms\Set; | ||||
| use Filament\Notifications\Notification; | ||||
| use Filament\Pages\Auth\EditProfile as BaseEditProfile; | ||||
| use Filament\Support\Colors\Color; | ||||
| @ -402,30 +403,38 @@ class EditProfile extends BaseEditProfile | ||||
|                                                     }) | ||||
|                                                     ->reactive() | ||||
|                                                     ->default('monospace') | ||||
|                                                     ->afterStateUpdated(fn ($state, callable $set) => $set('font_preview', $state)), | ||||
|                                                     ->afterStateUpdated(fn ($state, Set $set) => $set('font_preview', $state)), | ||||
|                                                 Placeholder::make('font_preview') | ||||
|                                                     ->label(trans('profile.font_preview')) | ||||
|                                                     ->columnSpan(2) | ||||
|                                                     ->content(function (Get $get) { | ||||
|                                                         $fontName = $get('console_font') ?? 'monospace'; | ||||
|                                                         $fontSize = $get('console_font_size') . 'px'; | ||||
|                                                         $fontUrl = asset("storage/fonts/{$fontName}.ttf"); | ||||
|                                                         $style = <<<CSS | ||||
|                                                             .preview-text { | ||||
|                                                                 font-family: $fontName; | ||||
|                                                                 font-size: $fontSize; | ||||
|                                                                 margin-top: 10px; | ||||
|                                                                 display: block; | ||||
|                                                             } | ||||
|                                                         CSS; | ||||
|                                                         if ($fontName !== 'monospace') { | ||||
|                                                             $fontUrl = asset("storage/fonts/$fontName.ttf"); | ||||
|                                                             $style = <<<CSS | ||||
|                                                                 @font-face { | ||||
|                                                                     font-family: $fontName; | ||||
|                                                                     src: url("$fontUrl"); | ||||
|                                                                 } | ||||
|                                                                 $style | ||||
|                                                             CSS; | ||||
|                                                         } | ||||
| 
 | ||||
|                                                         return new HtmlString(<<<HTML | ||||
|                                                                     <style> | ||||
|                                                                         @font-face { | ||||
|                                                                             font-family: "CustomPreviewFont"; | ||||
|                                                                             src: url("$fontUrl"); | ||||
|                                                                         } | ||||
|                                                                         .preview-text { | ||||
|                                                                             font-family: "CustomPreviewFont"; | ||||
|                                                                             font-size: $fontSize; | ||||
|                                                                             margin-top: 10px; | ||||
|                                                                             display: block; | ||||
|                                                                         } | ||||
|                                                                     </style> | ||||
|                                                                     <span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span> | ||||
|                                                                 HTML); | ||||
|                                                             <style> | ||||
|                                                             {$style}   | ||||
|                                                             </style> | ||||
|                                                             <span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span> | ||||
|                                                         HTML); | ||||
|                                                     }), | ||||
|                                                 TextInput::make('console_graph_period') | ||||
|                                                     ->label(trans('profile.graph_period')) | ||||
|  | ||||
| @ -5,7 +5,7 @@ | ||||
|         $userFontSize = auth()->user()->getCustomization()['console_font_size'] ?? 14; | ||||
|         $userRows =  auth()->user()->getCustomization()['console_rows'] ?? 30; | ||||
|     @endphp | ||||
|     @if($userFont) | ||||
|     @if($userFont !== "monospace") | ||||
|         <link rel="preload" href="{{ asset("storage/fonts/{$userFont}.ttf") }}" as="font" crossorigin> | ||||
|         <style> | ||||
|             @font-face { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 JoanFo
						JoanFo