error modals are so on

This commit is contained in:
2026-01-26 12:39:37 +11:00
parent eccab815ae
commit ad6b00e722
19 changed files with 195 additions and 605 deletions

View File

@@ -29,7 +29,7 @@ templ ErrorWithDetails(code int, err string, message string, details string) {
<pre id="details" class="text-xs text-subtext0 font-mono whitespace-pre-wrap break-all bg-mantle p-4 rounded overflow-x-auto">{ details }</pre>
</div>
<button
onclick="copyToClipboard('details')"
onclick="copyToClipboard('details', 'copyButton')"
id="copyButton"
class="mt-2 bg-mauve text-crust px-3 py-1 rounded text-xs hover:bg-mauve/75 transition hover:cursor-pointer"
title="Copy to clipboard"
@@ -45,24 +45,7 @@ templ ErrorWithDetails(code int, err string, message string, details string) {
</div>
</div>
if details != "" {
<script>
function copyToClipboard(id) {
var details = document.getElementById(id).innerText;
var button = document.getElementById("copyButton");
navigator.clipboard
.writeText(details)
.then(function () {
button.innerText = "Copied!";
setTimeout(function () {
button.innerText = "Copy";
}, 2000);
})
.catch(function (err) {
console.error("Failed to copy:", err);
button.innerText = "Failed";
});
}
</script>
<script src="/static/js/copytoclipboard.js"></script>
}
}
}

View File

@@ -13,7 +13,7 @@ templ Test() {
</h1>
<!-- Form Card -->
<div class="bg-surface0 rounded-lg shadow-lg p-6 border border-overlay0">
<form hx-post="/test" hx-swap="none" class="flex flex-col gap-4">
<form hx-post="/notification-tester" hx-swap="none" class="flex flex-col gap-4">
<!-- Notification Type -->
<div class="flex flex-col gap-2">
<label for="type" class="text-sm font-semibold text-subtext1">
@@ -27,15 +27,16 @@ templ Test() {
<option value="success">Success Toast</option>
<option value="info">Info Toast</option>
<option value="warn">Warning Toast</option>
<!-- <option value="error">Error Modal</option> -->
<option value="error">Error Modal</option>
</select>
</div>
<!-- Target Input -->
<div class="flex flex-col gap-2">
<label for="target" class="text-sm font-semibold text-subtext1">
Title
Target
</label>
<input
required
type="text"
name="target"
id="target"