244 lines
5.4 KiB
Text
244 lines
5.4 KiB
Text
package templates
|
|
|
|
import "io"
|
|
import "context"
|
|
|
|
// Render renders a component to an io.Writer
|
|
func Render(w io.Writer, component templ.Component) error {
|
|
return component.Render(context.Background(), w)
|
|
}
|
|
|
|
// RenderMultiple renders multiple components to an io.Writer in sequence
|
|
func RenderMultiple(w io.Writer, components ...templ.Component) error {
|
|
for _, component := range components {
|
|
if err := component.Render(context.Background(), w); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
|
|
// Layout is the base layout for all pages
|
|
templ Layout(title string) {
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8"/>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
|
<title>{ title }</title>
|
|
<script defer src="https://cdn.jsdelivr.net/npm/@imacrayon/alpine-ajax@0.12.2/dist/cdn.min.js"></script>
|
|
<script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.14.1/dist/cdn.min.js"></script>
|
|
<link
|
|
href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css"
|
|
rel="stylesheet"
|
|
/>
|
|
<link
|
|
rel="stylesheet"
|
|
href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css"
|
|
/>
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
|
<style>
|
|
/* Base Styles */
|
|
body {
|
|
padding-top: 20px;
|
|
background-color: #f8f9fa;
|
|
}
|
|
.card {
|
|
margin-bottom: 20px;
|
|
box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
|
|
}
|
|
.config-warning {
|
|
margin-bottom: 20px;
|
|
}
|
|
.toast-container {
|
|
position: fixed;
|
|
top: 20px;
|
|
right: 20px;
|
|
z-index: 1050;
|
|
}
|
|
.update-badge {
|
|
font-size: 0.8em;
|
|
margin-left: 10px;
|
|
}
|
|
.spin {
|
|
animation: spin 1s linear infinite;
|
|
}
|
|
@keyframes spin {
|
|
from { transform: rotate(0deg); }
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
/* Modal Styles */
|
|
dialog {
|
|
border: none !important;
|
|
outline: none !important;
|
|
border-radius: 0;
|
|
padding: 0;
|
|
margin: 0;
|
|
background: transparent;
|
|
box-shadow: none;
|
|
max-width: none;
|
|
max-height: none;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
}
|
|
|
|
dialog[open] {
|
|
border: none !important;
|
|
outline: none !important;
|
|
}
|
|
|
|
dialog::backdrop {
|
|
background: rgba(0, 0, 0, 0.5);
|
|
backdrop-filter: blur(4px);
|
|
animation: fadeIn 0.2s ease-out;
|
|
}
|
|
|
|
.modal-container {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
padding: 1rem;
|
|
animation: modalShow 0.3s ease-out;
|
|
}
|
|
|
|
.modal-content {
|
|
background: white;
|
|
border-radius: 12px;
|
|
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
|
|
width: 100%;
|
|
max-width: 600px;
|
|
max-height: 90vh;
|
|
overflow: hidden;
|
|
transform: scale(1);
|
|
animation: modalSlideIn 0.3s ease-out;
|
|
}
|
|
|
|
.modal-header {
|
|
background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
|
|
border-bottom: 1px solid #dee2e6;
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
}
|
|
|
|
.modal-title {
|
|
margin: 0;
|
|
font-weight: 600;
|
|
color: #495057;
|
|
font-size: 1.25rem;
|
|
}
|
|
|
|
.modal-body {
|
|
padding: 2rem;
|
|
max-height: 60vh;
|
|
overflow-y: auto;
|
|
}
|
|
|
|
.modal-footer {
|
|
background: #f8f9fa;
|
|
border-top: 1px solid #dee2e6;
|
|
padding: 1.5rem;
|
|
display: flex;
|
|
gap: 0.75rem;
|
|
justify-content: flex-end;
|
|
}
|
|
|
|
/* Enhanced form styling within modals */
|
|
.modal-body .form-label {
|
|
color: #495057;
|
|
margin-bottom: 0.75rem;
|
|
}
|
|
|
|
.modal-body .form-control,
|
|
.modal-body .form-select {
|
|
border: 2px solid #e9ecef;
|
|
border-radius: 8px;
|
|
padding: 0.75rem;
|
|
transition: all 0.2s ease;
|
|
}
|
|
|
|
.modal-body .form-control:focus,
|
|
.modal-body .form-select:focus {
|
|
border-color: #0d6efd;
|
|
box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.1);
|
|
}
|
|
|
|
.modal-body .input-group-text {
|
|
border: 2px solid #e9ecef;
|
|
border-left: none;
|
|
background: #f8f9fa;
|
|
font-weight: 500;
|
|
}
|
|
|
|
.modal-body .form-check {
|
|
border: 1px solid #e9ecef;
|
|
}
|
|
|
|
.modal-body .form-text {
|
|
font-size: 0.875rem;
|
|
color: #6c757d;
|
|
margin-top: 0.5rem;
|
|
}
|
|
|
|
/* Animations */
|
|
@keyframes fadeIn {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
|
|
@keyframes modalShow {
|
|
from { opacity: 0; }
|
|
to { opacity: 1; }
|
|
}
|
|
|
|
@keyframes modalSlideIn {
|
|
from {
|
|
transform: scale(0.95) translateY(-20px);
|
|
opacity: 0;
|
|
}
|
|
to {
|
|
transform: scale(1) translateY(0);
|
|
opacity: 1;
|
|
}
|
|
}
|
|
|
|
/* Responsive adjustments */
|
|
@media (max-width: 768px) {
|
|
.modal-container {
|
|
padding: 0.5rem;
|
|
}
|
|
|
|
.modal-content {
|
|
max-height: 95vh;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
.modal-header,
|
|
.modal-body,
|
|
.modal-footer {
|
|
padding: 1rem;
|
|
}
|
|
|
|
.modal-body {
|
|
max-height: 70vh;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body id="body">
|
|
<div class="toast-container position-fixed top-0 end-0 p-3">
|
|
<ul x-sync id="notification_list" x-merge="prepend" role="status" class="list-unstyled"></ul>
|
|
</div>
|
|
{ children... }
|
|
<dialog id="global-dialog" x-init @dialog:open.window="$el.showModal()">
|
|
<div id="contact"></div>
|
|
</dialog>
|
|
</body>
|
|
</html>
|
|
}
|