feat: add navigation items for Preview and Live sites in AdminPanelProvider (#21)
Co-authored-by: jon brookes <marshyon@gmail.com> Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/21
This commit is contained in:
parent
b6b841391c
commit
64a7d1d2f4
2 changed files with 21 additions and 1 deletions
|
|
@ -25,6 +25,25 @@ class AdminPanelProvider extends PanelProvider
|
||||||
{
|
{
|
||||||
public function panel(Panel $panel): Panel
|
public function panel(Panel $panel): Panel
|
||||||
{
|
{
|
||||||
|
$previewSiteUrl = env('PREVIEW_SITE_URL');
|
||||||
|
$liveSiteUrl = env('LIVE_SITE_URL');
|
||||||
|
|
||||||
|
$navigationItems = [];
|
||||||
|
if ($previewSiteUrl && $liveSiteUrl) {
|
||||||
|
$navigationItems = [
|
||||||
|
\Filament\Navigation\NavigationItem::make('Preview Site')
|
||||||
|
->url($previewSiteUrl, shouldOpenInNewTab: true)
|
||||||
|
->icon('heroicon-o-eye')
|
||||||
|
->group('External Links')
|
||||||
|
->sort(1),
|
||||||
|
\Filament\Navigation\NavigationItem::make('Live Site')
|
||||||
|
->url($liveSiteUrl, shouldOpenInNewTab: true)
|
||||||
|
->icon('heroicon-o-rocket-launch')
|
||||||
|
->group('External Links')
|
||||||
|
->sort(2),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
return $panel
|
return $panel
|
||||||
->default()
|
->default()
|
||||||
->sidebarCollapsibleOnDesktop()
|
->sidebarCollapsibleOnDesktop()
|
||||||
|
|
@ -49,6 +68,7 @@ class AdminPanelProvider extends PanelProvider
|
||||||
AccountWidget::class,
|
AccountWidget::class,
|
||||||
FilamentInfoWidget::class,
|
FilamentInfoWidget::class,
|
||||||
])
|
])
|
||||||
|
->navigationItems($navigationItems)
|
||||||
->middleware([
|
->middleware([
|
||||||
EncryptCookies::class,
|
EncryptCookies::class,
|
||||||
AddQueuedCookiesToResponse::class,
|
AddQueuedCookiesToResponse::class,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
URL='http://127.0.0.1:8000'
|
# URL='http://127.0.0.1:8000'
|
||||||
|
|
||||||
curl -X POST $URL/api/notifications/preview-site-built \
|
curl -X POST $URL/api/notifications/preview-site-built \
|
||||||
-H "Authorization: Bearer $TOKEN" \
|
-H "Authorization: Bearer $TOKEN" \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue