feat/reverb (#20)
Co-authored-by: jon brookes <marshyon@gmail.com> Reviewed-on: https://codeberg.org/headshed/share-lt/pulls/20
This commit is contained in:
parent
74bc17d019
commit
21147af908
30 changed files with 1948 additions and 29 deletions
|
|
@ -71,5 +71,155 @@ class AdminPanelProvider extends PanelProvider
|
|||
PanelsRenderHook::BODY_END,
|
||||
fn(): string => \Illuminate\Support\Facades\Blade::render('@vite("resources/js/app.js")'),
|
||||
);
|
||||
|
||||
FilamentView::registerRenderHook(
|
||||
PanelsRenderHook::BODY_END,
|
||||
function (): string {
|
||||
return '
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
if (window.Echo) {
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 4143902e603c7e3e25de5e5f49c1116dd5a5743b
|
||||
console.log("Setting up Filament Reverb notifications...");
|
||||
console.log("Available globals:", {
|
||||
FilamentNotification: typeof FilamentNotification,
|
||||
Livewire: typeof window.Livewire,
|
||||
filament: typeof window.filament
|
||||
});
|
||||
|
||||
<<<<<<< HEAD
|
||||
|
||||
=======
|
||||
>>>>>>> 4143902e603c7e3e25de5e5f49c1116dd5a5743b
|
||||
// Listen for preview site built events
|
||||
window.Echo.channel("filament-notifications")
|
||||
.listen("preview-site.built", function(event) {
|
||||
console.log("🎉 Received preview site built event:", event);
|
||||
|
||||
// Use Filament v4 notification system
|
||||
if (typeof FilamentNotification !== "undefined") {
|
||||
new FilamentNotification()
|
||||
.title(event.message)
|
||||
.success()
|
||||
.duration(5000)
|
||||
.send();
|
||||
console.log("✅ Sent via FilamentNotification v4");
|
||||
} else {
|
||||
console.warn("FilamentNotification not available");
|
||||
// Fallback notification
|
||||
const notification = document.createElement("div");
|
||||
notification.style.cssText = `
|
||||
position: fixed !important;
|
||||
top: 20px !important;
|
||||
right: 20px !important;
|
||||
z-index: 999999 !important;
|
||||
background: #10b981 !important;
|
||||
color: white !important;
|
||||
padding: 16px 20px !important;
|
||||
border-radius: 8px !important;
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
|
||||
font-family: system-ui, -apple-system, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
font-weight: 500 !important;
|
||||
max-width: 350px !important;
|
||||
display: block !important;
|
||||
opacity: 1 !important;
|
||||
`;
|
||||
|
||||
notification.innerHTML = `
|
||||
<div style="display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="margin-right: 15px;">
|
||||
✓ ${event.message}
|
||||
</div>
|
||||
<button onclick="this.parentElement.parentElement.remove()"
|
||||
style="background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0;">
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(notification);
|
||||
console.log("✅ Created fallback notification");
|
||||
|
||||
// Auto-remove after 5 seconds
|
||||
setTimeout(() => {
|
||||
if (notification.parentNode) {
|
||||
notification.remove();
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
})
|
||||
.listen(".preview-site.built", function(event) {
|
||||
console.log("🔄 Also listening with dot prefix (the working one):", event);
|
||||
<<<<<<< HEAD
|
||||
console.log("message:", event.message);
|
||||
=======
|
||||
>>>>>>> 4143902e603c7e3e25de5e5f49c1116dd5a5743b
|
||||
|
||||
// Use Filament v4 notification system
|
||||
if (typeof FilamentNotification !== "undefined") {
|
||||
new FilamentNotification()
|
||||
.title(event.message)
|
||||
.success()
|
||||
.duration(5000)
|
||||
.send();
|
||||
console.log("✅ Sent via FilamentNotification v4 (from dot prefix)");
|
||||
} else {
|
||||
console.warn("FilamentNotification not available, creating fallback");
|
||||
// Fallback notification
|
||||
const notification = document.createElement("div");
|
||||
notification.style.cssText = `
|
||||
position: fixed !important;
|
||||
top: 20px !important;
|
||||
right: 20px !important;
|
||||
z-index: 999999 !important;
|
||||
background: #3b82f6 !important;
|
||||
color: white !important;
|
||||
padding: 16px 20px !important;
|
||||
border-radius: 8px !important;
|
||||
box-shadow: 0 10px 25px rgba(0,0,0,0.3) !important;
|
||||
font-family: system-ui, -apple-system, sans-serif !important;
|
||||
font-size: 14px !important;
|
||||
font-weight: 500 !important;
|
||||
max-width: 350px !important;
|
||||
display: block !important;
|
||||
opacity: 1 !important;
|
||||
`;
|
||||
|
||||
notification.innerHTML = `
|
||||
<div style="display: flex; align-items: center; justify-content: space-between;">
|
||||
<div style="margin-right: 15px;">
|
||||
🔄 ${event.message}
|
||||
</div>
|
||||
<button onclick="this.parentElement.parentElement.remove()"
|
||||
style="background: none; border: none; color: white; font-size: 18px; cursor: pointer; padding: 0;">
|
||||
×
|
||||
</button>
|
||||
</div>
|
||||
`;
|
||||
|
||||
document.body.appendChild(notification);
|
||||
console.log("✅ Created dot prefix fallback notification");
|
||||
|
||||
// Auto-remove after 5 seconds
|
||||
setTimeout(() => {
|
||||
if (notification.parentNode) {
|
||||
notification.remove();
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
});
|
||||
|
||||
console.log("✅ Event listeners set up for filament-notifications channel");
|
||||
} else {
|
||||
console.error("❌ Echo is not available for Filament notifications");
|
||||
}
|
||||
});
|
||||
</script>';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue