diff --git a/assets/styles/app.css b/assets/styles/app.css
index c40e758..22d38c3 100644
--- a/assets/styles/app.css
+++ b/assets/styles/app.css
@@ -15,6 +15,18 @@
}
}
+@layer components {
+ .alert {
+ @apply text-white text-sm min-w-[250px] border px-4 py-3 rounded-md
+ }
+ .alert-success {
+ @apply bg-green-950 hover:bg-green-900 border-green-500
+ }
+ .alert-warning {
+ @apply bg-yellow-500/70 hover:bg-yellow-600 border-yellow-400 text-black
+ }
+}
+
/* Prevent scrolling while dialog is open */
body:has(dialog[data-dialog-target="dialog"][open]) {
overflow: hidden;
diff --git a/src/Controller/TorrentioController.php b/src/Controller/TorrentioController.php
index 817c047..c5ea21b 100644
--- a/src/Controller/TorrentioController.php
+++ b/src/Controller/TorrentioController.php
@@ -62,6 +62,7 @@ final class TorrentioController extends AbstractController
]);
});
} catch (TorrentioRateLimitException $exception) {
+ $this->broadcaster->alert('Warning', 'Torrentio has rate limited your requests. Please wait a few minutes before trying again.', 'warning');
return $this->render('bare.html.twig',
[],
new Response('Too many requests',
diff --git a/src/Util/Broadcaster.php b/src/Util/Broadcaster.php
index 600b701..d4f7d7a 100644
--- a/src/Util/Broadcaster.php
+++ b/src/Util/Broadcaster.php
@@ -17,7 +17,7 @@ readonly class Broadcaster
private RequestStack $requestStack,
) {}
- public function alert(string $title, string $message): void
+ public function alert(string $title, string $message, string $type = "success"): void
{
$userAlertTopic = $this->requestStack->getCurrentRequest()->getSession()->get('mercure_alert_topic');
$update = new Update(
@@ -26,6 +26,7 @@ readonly class Broadcaster
'alert_id' => uniqid(),
'title' => $title,
'message' => $message,
+ 'type' => $type,
])
);
$this->hub->publish($update);
diff --git a/tailwind.config.js b/tailwind.config.js
index 407663c..2e9d5f3 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -13,6 +13,8 @@ module.exports = {
"bg-orange-400",
"bg-blue-600",
"bg-rose-600",
+ "alert-success",
+ "alert-warning",
"min-w-64",
"rotate-180",
"-rotate-180",
diff --git a/templates/broadcast/Alert.stream.html.twig b/templates/broadcast/Alert.stream.html.twig
index 161e39c..c0c3da4 100644
--- a/templates/broadcast/Alert.stream.html.twig
+++ b/templates/broadcast/Alert.stream.html.twig
@@ -1,5 +1,5 @@