mirror of
https://github.com/StarFleetCPTN/GoMFT.git
synced 2026-09-08 15:41:20 +02:00
- Added a new build script using esbuild to bundle JavaScript and CSS assets, including Tailwind CSS and Font Awesome. - Updated the Dockerfile to include a multi-stage build process for frontend assets, ensuring efficient image creation. - Enhanced GitHub workflows to automate the installation of Node.js dependencies and build frontend assets during CI/CD. - Introduced a .gitignore entry for the dist directory to prevent unnecessary files from being tracked. - Improved caching and content type handling for static files served by the application.
53 lines
1.8 KiB
JavaScript
53 lines
1.8 KiB
JavaScript
// Import HTMX
|
|
import 'htmx.org';
|
|
|
|
// Import Alpine.js
|
|
import Alpine from 'alpinejs';
|
|
window.Alpine = Alpine;
|
|
|
|
// Import Flowbite
|
|
import 'flowbite';
|
|
import 'flowbite/dist/flowbite.css';
|
|
|
|
// Initialize Flowbite components
|
|
document.addEventListener('DOMContentLoaded', () => {
|
|
// Initialize Alpine.js
|
|
Alpine.start();
|
|
|
|
// Initialize Flowbite modals
|
|
const modalTriggers = document.querySelectorAll('[data-modal-target]');
|
|
modalTriggers.forEach(trigger => {
|
|
const targetId = trigger.getAttribute('data-modal-target');
|
|
const targetModal = document.getElementById(targetId);
|
|
if (targetModal) {
|
|
// Show modal
|
|
trigger.addEventListener('click', () => {
|
|
targetModal.classList.remove('hidden');
|
|
targetModal.classList.add('flex');
|
|
// Add backdrop
|
|
document.body.style.overflow = 'hidden';
|
|
});
|
|
|
|
// Handle modal hide buttons
|
|
const hideButtons = targetModal.querySelectorAll('[data-modal-hide]');
|
|
hideButtons.forEach(button => {
|
|
button.addEventListener('click', () => {
|
|
targetModal.classList.add('hidden');
|
|
targetModal.classList.remove('flex');
|
|
// Remove backdrop
|
|
document.body.style.overflow = '';
|
|
});
|
|
});
|
|
|
|
// Handle clicking outside the modal
|
|
targetModal.addEventListener('click', (event) => {
|
|
if (event.target === targetModal || event.target.classList.contains('fixed')) {
|
|
targetModal.classList.add('hidden');
|
|
targetModal.classList.remove('flex');
|
|
// Remove backdrop
|
|
document.body.style.overflow = '';
|
|
}
|
|
});
|
|
}
|
|
});
|
|
});
|