From fc9026a8d8a0b4907617d6a44a3ceecff8e13e12 Mon Sep 17 00:00:00 2001 From: Nawaz Dhandala Date: Fri, 13 Feb 2026 17:11:00 +0000 Subject: [PATCH] refactor: Clean up component code and improve formatting across multiple files --- MobileApp/src/components/AlertCard.tsx | 132 ++++++++-------- MobileApp/src/components/EmptyState.tsx | 4 +- MobileApp/src/components/EpisodeCard.tsx | 125 +++++++-------- MobileApp/src/components/IncidentCard.tsx | 142 +++++++++--------- MobileApp/src/components/Logo.tsx | 12 +- MobileApp/src/navigation/MainTabNavigator.tsx | 6 +- MobileApp/src/screens/AlertDetailScreen.tsx | 2 +- .../src/screens/AlertEpisodeDetailScreen.tsx | 2 +- MobileApp/src/screens/BiometricLockScreen.tsx | 1 - .../src/screens/IncidentDetailScreen.tsx | 7 +- .../screens/IncidentEpisodeDetailScreen.tsx | 2 +- 11 files changed, 214 insertions(+), 221 deletions(-) diff --git a/MobileApp/src/components/AlertCard.tsx b/MobileApp/src/components/AlertCard.tsx index b7d6cfd0e8..7fac90e065 100644 --- a/MobileApp/src/components/AlertCard.tsx +++ b/MobileApp/src/components/AlertCard.tsx @@ -54,80 +54,82 @@ export default function AlertCard({ style={{ width: 3 }} /> - {projectName ? ( - - + {projectName ? ( + + + + ) : null} + + + + {alert.alertNumberWithPrefix || `#${alert.alertNumber}`} + + + + {timeString} + - ) : null} - - - - {alert.alertNumberWithPrefix || `#${alert.alertNumber}`} - - - {timeString} - + {alert.title} + - - {alert.title} - - - - {alert.currentAlertState ? ( - + + {alert.currentAlertState ? ( - - {alert.currentAlertState.name} - - - ) : null} - - {alert.alertSeverity ? ( - - - {alert.alertSeverity.name} + + + {alert.currentAlertState.name} + + + ) : null} + + {alert.alertSeverity ? ( + + + {alert.alertSeverity.name} + + + ) : null} + + + {alert.monitor ? ( + + + + {alert.monitor.name} ) : null} - - {alert.monitor ? ( - - - - {alert.monitor.name} - - - ) : null} - diff --git a/MobileApp/src/components/EmptyState.tsx b/MobileApp/src/components/EmptyState.tsx index 231f98bcf8..4243b87b82 100644 --- a/MobileApp/src/components/EmptyState.tsx +++ b/MobileApp/src/components/EmptyState.tsx @@ -34,9 +34,7 @@ export default function EmptyState({ return ( {/* Outer gradient glow ring */} - + - {projectName ? ( - - - - ) : null} - - - - {episode.episodeNumberWithPrefix || `#${episode.episodeNumber}`} - - - {timeString} - - - - {episode.title} - - - - {state ? ( - - - - {state.name} - + {projectName ? ( + + ) : null} - - {severity ? ( + - - {severity.name} - - - ) : null} - - {childCount > 0 ? ( - - - {childCount} {type === "incident" ? "incident" : "alert"} - {childCount !== 1 ? "s" : ""} + + {episode.episodeNumberWithPrefix || + `#${episode.episodeNumber}`} - ) : null} + + {timeString} + + + + + {episode.title} + + + + {state ? ( + + + + {state.name} + + + ) : null} + + {severity ? ( + + + {severity.name} + + + ) : null} + + {childCount > 0 ? ( + + + {childCount} {type === "incident" ? "incident" : "alert"} + {childCount !== 1 ? "s" : ""} + + + ) : null} + - ); diff --git a/MobileApp/src/components/IncidentCard.tsx b/MobileApp/src/components/IncidentCard.tsx index d5d63025c3..1fe3dfa508 100644 --- a/MobileApp/src/components/IncidentCard.tsx +++ b/MobileApp/src/components/IncidentCard.tsx @@ -57,85 +57,87 @@ export default function IncidentCard({ style={{ width: 3 }} /> - {projectName ? ( - - + {projectName ? ( + + + + ) : null} + + + + {incident.incidentNumberWithPrefix || + `#${incident.incidentNumber}`} + + + + {timeString} + - ) : null} - - - - {incident.incidentNumberWithPrefix || - `#${incident.incidentNumber}`} - - - {timeString} - + {incident.title} + - - {incident.title} - - - - {incident.currentIncidentState ? ( - + + {incident.currentIncidentState ? ( - - {incident.currentIncidentState.name} - - - ) : null} - - {incident.incidentSeverity ? ( - - - {incident.incidentSeverity.name} + + + {incident.currentIncidentState.name} + + + ) : null} + + {incident.incidentSeverity ? ( + + + {incident.incidentSeverity.name} + + + ) : null} + + + {monitorCount > 0 ? ( + + + + {incident.monitors + .map((m: NamedEntity) => { + return m.name; + }) + .join(", ")} ) : null} - - {monitorCount > 0 ? ( - - - - {incident.monitors - .map((m: NamedEntity) => { - return m.name; - }) - .join(", ")} - - - ) : null} - diff --git a/MobileApp/src/components/Logo.tsx b/MobileApp/src/components/Logo.tsx index 838e24e5b2..46083c815f 100644 --- a/MobileApp/src/components/Logo.tsx +++ b/MobileApp/src/components/Logo.tsx @@ -7,14 +7,12 @@ interface LogoProps { style?: ViewStyle; } -export default function Logo({ size = 32, style }: LogoProps): React.JSX.Element { +export default function Logo({ + size = 32, + style, +}: LogoProps): React.JSX.Element { return ( - + - + {focused ? ( ; diff --git a/MobileApp/src/screens/IncidentEpisodeDetailScreen.tsx b/MobileApp/src/screens/IncidentEpisodeDetailScreen.tsx index 04688d3ed0..a95f54c3d5 100644 --- a/MobileApp/src/screens/IncidentEpisodeDetailScreen.tsx +++ b/MobileApp/src/screens/IncidentEpisodeDetailScreen.tsx @@ -26,7 +26,7 @@ import { import { rgbToHex } from "../utils/color"; import { formatDateTime } from "../utils/date"; import type { IncidentsStackParamList } from "../navigation/types"; -import type { IncidentState, NoteItem } from "../api/types"; +import type { IncidentState } from "../api/types"; import { useQueryClient } from "@tanstack/react-query"; import AddNoteModal from "../components/AddNoteModal"; import FeedTimeline from "../components/FeedTimeline";