aboutsummaryrefslogtreecommitdiff
path: root/src/frontend/app/components/StopAlert.tsx
diff options
context:
space:
mode:
authorCopilot <198982749+Copilot@users.noreply.github.com>2025-11-06 20:34:36 +0100
committerGitHub <noreply@github.com>2025-11-06 20:34:36 +0100
commita24639e17b63c5ebb9b2bb26af18e17302e9360b (patch)
tree3301a4f8f278cab61696b2cd0212cb71e0676363 /src/frontend/app/components/StopAlert.tsx
parent9a2e46b6e8f0decbd1995c14d34b0b8c0d663b49 (diff)
Add manual stop creation and override alerts with alternate stop codes (#74)
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: arielcostas <94913521+arielcostas@users.noreply.github.com> Co-authored-by: Ariel Costas Guerrero <ariel@costas.dev>
Diffstat (limited to 'src/frontend/app/components/StopAlert.tsx')
-rw-r--r--src/frontend/app/components/StopAlert.tsx36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/frontend/app/components/StopAlert.tsx b/src/frontend/app/components/StopAlert.tsx
new file mode 100644
index 0000000..69ecc22
--- /dev/null
+++ b/src/frontend/app/components/StopAlert.tsx
@@ -0,0 +1,36 @@
+import React from "react";
+import { AlertCircle, Info } from "lucide-react";
+import type { Stop } from "~/data/StopDataProvider";
+import "./StopAlert.css";
+
+interface StopAlertProps {
+ stop: Stop;
+ compact?: boolean;
+}
+
+export const StopAlert: React.FC<StopAlertProps> = ({ stop, compact = false }) => {
+ // Don't render anything if there's no alert content
+ const hasContent = stop.title || stop.message;
+ if (!hasContent) {
+ return null;
+ }
+
+ const isError = stop.cancelled === true;
+
+ return (
+ <div className={`stop-alert ${isError ? 'stop-alert-error' : 'stop-alert-info'} ${compact ? 'stop-alert-compact' : ''}`}>
+ <div className="stop-alert-icon">
+ {isError ? <AlertCircle /> : <Info />}
+ </div>
+ <div className="stop-alert-content">
+ {stop.title && <div className="stop-alert-title">{stop.title}</div>}
+ {stop.message && <div className="stop-alert-message">{stop.message}</div>}
+ {stop.alternateCodes && stop.alternateCodes.length > 0 && (
+ <div className="stop-alert-alternate-codes">
+ Alternative stops: {stop.alternateCodes.join(", ")}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+};