Added Create Custom, Random, Gmail Generation

This commit is contained in:
Gitea
2025-04-25 17:43:35 +05:30
parent b799ac3f9a
commit 9aa1b3ab8e
39 changed files with 1867 additions and 136 deletions

69
resources/js/boil.js Normal file
View File

@@ -0,0 +1,69 @@
document.addEventListener('DOMContentLoaded', () => {
if (window.Livewire && typeof window.Livewire.dispatch === 'function') {
setTimeout(() => {
Livewire.dispatch('getEmail');
}, 2000);
document.addEventListener('closeModal', () => {
document.querySelectorAll('dialog[data-modal]').forEach(dialog => {
if (typeof dialog.close === 'function') {
dialog.close();
console.log(`Closed dialog with data-modal="${dialog.getAttribute('data-modal')}"`);
}
});
});
} else {
console.warn('Livewire is not loaded yet.');
}
});
function showToast({ type = 'success', message = '' }) {
const container = document.getElementById('toast-container');
const colors = {
success: {
icon: 'text-green-500 bg-green-100 dark:bg-green-800 dark:text-green-200',
svg: `<path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5Zm3.707 8.207-4 4a1 1 0 0 1-1.414 0l-2-2a1 1 0 0 1 1.414-1.414L9 10.586l3.293-3.293a1 1 0 0 1 1.414 1.414Z" />`,
},
error: {
icon: 'text-red-500 bg-red-100 dark:bg-red-800 dark:text-red-200',
svg: `<path d="M10 0a10 10 0 1 0 10 10A10 10 0 0 0 10 0Zm1 14a1 1 0 0 1-2 0v-2a1 1 0 0 1 2 0Zm0-4a1 1 0 0 1-2 0V6a1 1 0 0 1 2 0Z"/>`,
}
};
const toast = document.createElement('div');
toast.className = `flex items-center w-full max-w-xs p-4 text-gray-500 bg-white rounded-lg shadow dark:text-gray-400 dark:bg-gray-800`;
toast.setAttribute('role', 'alert');
toast.innerHTML = `
<div class="inline-flex items-center justify-center flex-shrink-0 w-8 h-8 ${colors[type].icon} rounded-lg">
<svg class="w-5 h-5" fill="currentColor" viewBox="0 0 20 20">${colors[type].svg}</svg>
</div>
<div class="ml-3 text-sm font-normal">${message}</div>
<div class="absolute inset-x-0 bottom-0 h-1 bg-${type === 'error' ? 'red' : 'green'}-500 animate-progress rounded-bl-md rounded-br-md"></div>
<button type="button" class="ml-auto text-gray-400 hover:text-gray-900 dark:hover:text-white rounded-lg focus:ring-2 focus:ring-gray-300 p-1.5 hover:bg-gray-100 dark:hover:bg-gray-700"
onclick="this.parentElement.remove()">
<svg class="w-3 h-3" fill="none" viewBox="0 0 14 14"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M1 1l6 6m0 0l6 6M7 7l6-6M7 7L1 13"/></svg>
</button>
`;
container.appendChild(toast);
setTimeout(() => {
toast.remove();
}, 4000);
}
function handleDispatches(dispatches) {
dispatches.forEach(dispatch => {
if (dispatch.name === "showAlert") {
const params = dispatch.params[0];
showToast(params);
}
});
}
window.addEventListener("showAlert", (event) => {
const detail = event.detail[0];
showToast(detail);
});