mirror of
https://github.com/pelican-dev/panel.git
synced 2025-09-09 22:58:41 +02:00
fix sections on customization tab
This commit is contained in:
parent
4e1980c051
commit
a26b7f1c04
@ -400,51 +400,52 @@ class EditProfile extends BaseEditProfile
|
|||||||
'grid' => trans('profile.grid'),
|
'grid' => trans('profile.grid'),
|
||||||
'table' => trans('profile.table'),
|
'table' => trans('profile.table'),
|
||||||
]),
|
]),
|
||||||
Section::make(trans('profile.console'))
|
]),
|
||||||
->collapsible()
|
Section::make(trans('profile.console'))
|
||||||
->icon('tabler-brand-tabler')
|
->collapsible()
|
||||||
->columns(4)
|
->icon('tabler-brand-tabler')
|
||||||
->schema([
|
->columns(4)
|
||||||
TextInput::make('console_font_size')
|
->schema([
|
||||||
->label(trans('profile.font_size'))
|
TextInput::make('console_font_size')
|
||||||
->columnSpan(1)
|
->label(trans('profile.font_size'))
|
||||||
->minValue(1)
|
->columnSpan(1)
|
||||||
->numeric()
|
->minValue(1)
|
||||||
->required()
|
->numeric()
|
||||||
->default(14),
|
->required()
|
||||||
Select::make('console_font')
|
->default(14),
|
||||||
->label(trans('profile.font'))
|
Select::make('console_font')
|
||||||
->required()
|
->label(trans('profile.font'))
|
||||||
->options(function () {
|
->required()
|
||||||
$fonts = [
|
->options(function () {
|
||||||
'monospace' => 'monospace', //default
|
$fonts = [
|
||||||
];
|
'monospace' => 'monospace', //default
|
||||||
|
];
|
||||||
|
|
||||||
if (!Storage::disk('public')->exists('fonts')) {
|
if (!Storage::disk('public')->exists('fonts')) {
|
||||||
Storage::disk('public')->makeDirectory('fonts');
|
Storage::disk('public')->makeDirectory('fonts');
|
||||||
$this->fillForm();
|
$this->fillForm();
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (Storage::disk('public')->allFiles('fonts') as $file) {
|
foreach (Storage::disk('public')->allFiles('fonts') as $file) {
|
||||||
$fileInfo = pathinfo($file);
|
$fileInfo = pathinfo($file);
|
||||||
|
|
||||||
if ($fileInfo['extension'] === 'ttf') {
|
if ($fileInfo['extension'] === 'ttf') {
|
||||||
$fonts[$fileInfo['filename']] = $fileInfo['filename'];
|
$fonts[$fileInfo['filename']] = $fileInfo['filename'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $fonts;
|
return $fonts;
|
||||||
})
|
})
|
||||||
->reactive()
|
->reactive()
|
||||||
->default('monospace')
|
->default('monospace')
|
||||||
->afterStateUpdated(fn ($state, Set $set) => $set('font_preview', $state)),
|
->afterStateUpdated(fn ($state, Set $set) => $set('font_preview', $state)),
|
||||||
TextEntry::make('font_preview')
|
TextEntry::make('font_preview')
|
||||||
->label(trans('profile.font_preview'))
|
->label(trans('profile.font_preview'))
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->state(function (Get $get) {
|
->state(function (Get $get) {
|
||||||
$fontName = $get('console_font') ?? 'monospace';
|
$fontName = $get('console_font') ?? 'monospace';
|
||||||
$fontSize = $get('console_font_size') . 'px';
|
$fontSize = $get('console_font_size') . 'px';
|
||||||
$style = <<<CSS
|
$style = <<<CSS
|
||||||
.preview-text {
|
.preview-text {
|
||||||
font-family: $fontName;
|
font-family: $fontName;
|
||||||
font-size: $fontSize;
|
font-size: $fontSize;
|
||||||
@ -452,43 +453,42 @@ class EditProfile extends BaseEditProfile
|
|||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
CSS;
|
CSS;
|
||||||
if ($fontName !== 'monospace') {
|
if ($fontName !== 'monospace') {
|
||||||
$fontUrl = asset("storage/fonts/$fontName.ttf");
|
$fontUrl = asset("storage/fonts/$fontName.ttf");
|
||||||
$style = <<<CSS
|
$style = <<<CSS
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: $fontName;
|
font-family: $fontName;
|
||||||
src: url("$fontUrl");
|
src: url("$fontUrl");
|
||||||
}
|
}
|
||||||
$style
|
$style
|
||||||
CSS;
|
CSS;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HtmlString(<<<HTML
|
return new HtmlString(<<<HTML
|
||||||
<style>
|
<style>
|
||||||
{$style}
|
{$style}
|
||||||
</style>
|
</style>
|
||||||
<span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span>
|
<span class="preview-text">The quick blue pelican jumps over the lazy pterodactyl. :)</span>
|
||||||
HTML);
|
HTML);
|
||||||
}),
|
}),
|
||||||
TextInput::make('console_graph_period')
|
TextInput::make('console_graph_period')
|
||||||
->label(trans('profile.graph_period'))
|
->label(trans('profile.graph_period'))
|
||||||
->suffix(trans('profile.seconds'))
|
->suffix(trans('profile.seconds'))
|
||||||
->hintIcon('tabler-question-mark')
|
->hintIcon('tabler-question-mark')
|
||||||
->hintIconTooltip(trans('profile.graph_period_helper'))
|
->hintIconTooltip(trans('profile.graph_period_helper'))
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->numeric()
|
->numeric()
|
||||||
->default(30)
|
->default(30)
|
||||||
->minValue(10)
|
->minValue(10)
|
||||||
->maxValue(120)
|
->maxValue(120)
|
||||||
->required(),
|
->required(),
|
||||||
TextInput::make('console_rows')
|
TextInput::make('console_rows')
|
||||||
->label(trans('profile.rows'))
|
->label(trans('profile.rows'))
|
||||||
->minValue(1)
|
->minValue(1)
|
||||||
->numeric()
|
->numeric()
|
||||||
->required()
|
->required()
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->default(30),
|
->default(30),
|
||||||
]),
|
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
]),
|
]),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user