-
-
Notifications
You must be signed in to change notification settings - Fork 155
Alert banner #1002
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Alert banner #1002
Conversation
Installed dependency and other stuff to run panel
This reverts commit 028c0d6.
All contributors have signed the CLA ✍️ ✅ |
Please use tabler icons and not hero icons |
->options([ | ||
'info' => '<span class="text-info-600 dark:text-info-500">Info</span>', | ||
'warning' => '<span class="text-warning-600 dark:text-warning-500">Warning</span>', | ||
'danger' => '<span class="text-danger-600 dark:text-danger-500">Danger</span>', | ||
'success' => '<span class="text-success-600 dark:text-success-500">Success</span>', | ||
]) | ||
->allowHtml() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im figuring out a way to use getOptionLabelUsing
with html insead of hardcoding it in options
so we can use
->getOptionLabelUsing(fn ($value, AlertBanner $alertBanner) => printf('<span class="%s">%s</span>', $alertBanner->getColorClasses($value), $value))
Also requires changing
panel/app/Livewire/AlertBanner.php
Lines 75 to 82 in 1f6b659
public function getColorClasses(): string | |
{ | |
return match ($this->getStatus()) { | |
'success' => 'text-success-600 dark:text-success-500', | |
'warning' => 'text-warning-600 dark:text-warning-500', | |
'danger' => 'text-danger-600 dark:text-danger-500', | |
default => 'text-info-600 dark:text-info-500', | |
}; |
to
public function getColorClasses(?string $status = null): string
{
$status ??= $this->getStatus();
return match ($status) {
'success' => 'text-success-600 dark:text-success-500',
'warning' => 'text-warning-600 dark:text-warning-500',
'danger' => 'text-danger-600 dark:text-danger-500',
default => 'text-info-600 dark:text-info-500',
};
}
https://discord.com/channels/883083792112300104/1338330020111978546/1338330020111978546
->label(fn (Get $get) => trans('admin/setting.alert_banner.title') . " ({$get('alert_banner_title_length')}/32 characters)") | ||
->required() | ||
->maxLength(32) | ||
->visible(fn (Get $get) => $get('ALERT_BANNER_ENABLED')) | ||
->default(env('ALERT_BANNER_TITLE', config('panel.alert_banner.title'))) | ||
->reactive() | ||
->afterStateUpdated(fn ($state, Set $set) => $set('alert_banner_title_length', strlen($state))), | ||
TextArea::make('alert_banner_message') | ||
->label(fn (Get $get) => trans('admin/setting.alert_banner.message') . " ({$get('alert_banner_message_length')}/114 characters)") | ||
->required() | ||
->maxLength(114) | ||
->visible(fn (Get $get) => $get('ALERT_BANNER_ENABLED')) | ||
->default(env('ALERT_BANNER_MESSAGE', config('panel.alert_banner.message'))) | ||
->reactive() | ||
->afterStateUpdated(fn ($state, Set $set) => $set('alert_banner_message_length', strlen($state))), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/pelican-dev/panel/pull/1002/files#r1953058733
use the const in AlertBanner, remove afterStateUpdated() and hardcoded length
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe i should make this a Draft ?
I have read the CLA Document and I hereby sign the CLA |
Co-authored-by: MartinOscar <[email protected]>
Co-authored-by: MartinOscar <[email protected]>
Co-authored-by: MartinOscar <[email protected]>
I like the basic idea of using AlertBanners as kind of global announcements, however, this should be it's own thing. |
I agree with @Boy132 |
Aler Banner feature! 🚨
I ShadowComes ( Git: @ShadowComes Discord: shadowcomes) and Martin Oscar (Git: @rmartinoscar Discord: rmartinoscar) have created a alert banned that we are ready to share. 🔥 🚀
This alert banner is globally applyed, meaning that the users and admins will see the alert!
Discord Threads channel about this project 🧵
And everyone who has crazy ideas, please be wellcome to mention them!!! 😋
New features what we inclouded:
The icon pick library repo:
https://github.com/lukas-frey/filament-icon-picker
Possible updates in upcoming time:
Inspiration reference
#892