adding multi filter support

This commit is contained in:
2025-12-07 09:44:02 +00:00
parent 72b4fdbe7c
commit 7717350b94
13 changed files with 1674 additions and 116 deletions
+88 -33
View File
@@ -1,36 +1,4 @@
{{ define "notifications" }}
{{ if .Notification }}
<div id="notification-container" class="fixed top-4 right-4 max-w-md z-50">
<div id="notification-toast" class="rounded-lg shadow-lg p-4 flex items-start gap-3 {{ if eq .NotificationType "error" }}bg-red-900 border-l-4 border-red-500{{ else if eq .NotificationType "success" }}bg-green-900 border-l-4 border-green-500{{ else }}bg-blue-900 border-l-4 border-blue-500{{ end }}" onmouseenter="pauseNotification()" onmouseleave="resumeNotification()">
<div class="flex-shrink-0">
{{ if eq .NotificationType "error" }}
<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
{{ else if eq .NotificationType "success" }}
<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
</svg>
{{ else }}
<svg class="h-5 w-5 text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
</svg>
{{ end }}
</div>
<div class="flex-1">
<p class="font-medium {{ if eq .NotificationType "error" }}text-red-200{{ else if eq .NotificationType "success" }}text-green-200{{ else }}text-blue-200{{ end }}">
{{ .Notification }}
</p>
</div>
<button onclick="closeNotification()" class="flex-shrink-0 text-gray-400 hover:text-white transition">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div id="notification-progress" class="mt-2 h-1 bg-gray-700 rounded" style="animation: shrink 5s linear forwards;"></div>
</div>
<style>
@keyframes shrink {
from {
@@ -81,7 +49,94 @@ function resumeNotification() {
}
}
// Auto-close after 5 seconds
// Show notification dynamically
function showNotification(message, type = 'success') {
// Close existing notification if any
var existing = document.getElementById('notification-container');
if (existing) {
existing.remove();
}
var container = document.createElement('div');
container.id = 'notification-container';
container.className = 'fixed top-4 right-4 max-w-md z-50';
var bgClass = type === 'error' ? 'bg-red-900 border-l-4 border-red-500' :
type === 'success' ? 'bg-green-900 border-l-4 border-green-500' :
'bg-blue-900 border-l-4 border-blue-500';
var iconColor = type === 'error' ? 'text-red-400' :
type === 'success' ? 'text-green-400' :
'text-blue-400';
var textColor = type === 'error' ? 'text-red-200' :
type === 'success' ? 'text-green-200' :
'text-blue-200';
var icon = type === 'error' ? '<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" /></svg>' :
type === 'success' ? '<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" /></svg>' :
'<svg class="h-5 w-5 text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20"><path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" /></svg>';
container.innerHTML = `
<div id="notification-toast" class="rounded-lg shadow-lg p-4 flex items-start gap-3 ${bgClass}" onmouseenter="pauseNotification()" onmouseleave="resumeNotification()">
<div class="flex-shrink-0">
${icon}
</div>
<div class="flex-1">
<p class="font-medium ${textColor}">
${message}
</p>
</div>
<button onclick="closeNotification()" class="flex-shrink-0 text-gray-400 hover:text-white transition">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div id="notification-progress" class="mt-2 h-1 bg-gray-700 rounded" style="animation: shrink 5s linear forwards;"></div>
`;
document.body.appendChild(container);
// Auto-close after 5 seconds
notificationTimeout = setTimeout(closeNotification, 5000);
}
</script>
{{ if .Notification }}
<div id="notification-container" class="fixed top-4 right-4 max-w-md z-50">
<div id="notification-toast" class="rounded-lg shadow-lg p-4 flex items-start gap-3 {{ if eq .NotificationType "error" }}bg-red-900 border-l-4 border-red-500{{ else if eq .NotificationType "success" }}bg-green-900 border-l-4 border-green-500{{ else }}bg-blue-900 border-l-4 border-blue-500{{ end }}" onmouseenter="pauseNotification()" onmouseleave="resumeNotification()">
<div class="flex-shrink-0">
{{ if eq .NotificationType "error" }}
<svg class="h-5 w-5 text-red-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z" clip-rule="evenodd" />
</svg>
{{ else if eq .NotificationType "success" }}
<svg class="h-5 w-5 text-green-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zm3.707-9.293a1 1 0 00-1.414-1.414L9 10.586 7.707 9.293a1 1 0 00-1.414 1.414l2 2a1 1 0 001.414 0l4-4z" clip-rule="evenodd" />
</svg>
{{ else }}
<svg class="h-5 w-5 text-blue-400" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path fill-rule="evenodd" d="M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z" clip-rule="evenodd" />
</svg>
{{ end }}
</div>
<div class="flex-1">
<p class="font-medium {{ if eq .NotificationType "error" }}text-red-200{{ else if eq .NotificationType "success" }}text-green-200{{ else }}text-blue-200{{ end }}">
{{ .Notification }}
</p>
</div>
<button onclick="closeNotification()" class="flex-shrink-0 text-gray-400 hover:text-white transition">
<svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
</svg>
</button>
</div>
<div id="notification-progress" class="mt-2 h-1 bg-gray-700 rounded" style="animation: shrink 5s linear forwards;"></div>
</div>
<script>
// Auto-close after 5 seconds (for page-loaded notifications)
notificationTimeout = setTimeout(closeNotification, 5000);
</script>
{{ end }}