Add toast notification system
Django CI/CD / test (push) Successful in 35s
Django CI/CD / build-and-push (push) Successful in 54s

Add more toast types
This commit is contained in:
2026-05-11 13:22:42 +02:00
parent 4e3b0ddb08
commit f82c61ef1e
18 changed files with 1026 additions and 109 deletions
+23
View File
@@ -291,3 +291,26 @@ def PurchasePrice(purchase) -> str:
wrapped_content=f"{floatformat(purchase.converted_price)} {purchase.converted_currency}",
wrapped_classes="underline decoration-dotted",
)
def Toast(
message: str = "",
type: str = "info",
attributes: list = [],
):
valid_types = ["success", "error", "info"]
if type not in valid_types:
type = "info"
safe_message = message.replace("\\", "\\\\").replace("`", "\\`")
safe_type = type.replace("\\", "\\\\").replace("`", "\\`")
return Component(
tag_name="div",
attributes=[
("class", "hidden"),
("x-data", "toastStore"),
("x-init", f"addToast(`{safe_message}`, `{safe_type}`)"),
]
+ attributes,
children=[message],
)
+6
View File
@@ -225,3 +225,9 @@ textarea:disabled {
justify-content: space-between;
}
}
@layer utilities {
.toast-container {
@apply fixed z-50 flex flex-col items-end bottom-0 right-0 p-4;
}
}