From 3a636440c24c34d01b7cbfc8d12176f56463145f Mon Sep 17 00:00:00 2001 From: amy-corson-ibigroup <115499534+amy-corson-ibigroup@users.noreply.github.com> Date: Tue, 21 May 2024 15:57:03 -0400 Subject: [PATCH 1/2] fix(route-details): if no route url is available, direct users to agency site --- lib/components/viewers/route-details.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/components/viewers/route-details.tsx b/lib/components/viewers/route-details.tsx index 0c20ea83a..ac08e27ed 100644 --- a/lib/components/viewers/route-details.tsx +++ b/lib/components/viewers/route-details.tsx @@ -82,6 +82,8 @@ class RouteDetails extends Component { const { agency, patterns = {}, shortName, url } = route const pattern = patterns[patternId] + const moreDetailsURL = url || route.agency.url + const routeColor = getRouteColorBasedOnSettings(operator, route) const headsigns = Object.entries(patterns) @@ -180,7 +182,7 @@ class RouteDetails extends Component { /> )} - {url && ( + {moreDetailsURL && ( @@ -188,7 +190,7 @@ class RouteDetails extends Component { style={{ color: getMostReadableTextColor(routeColor, route?.textColor) }} - url={url} + url={moreDetailsURL} /> )} From 0c42fb984d34344012bfbe9ce65e8b96f82d865a Mon Sep 17 00:00:00 2001 From: amy-corson-ibigroup <115499534+amy-corson-ibigroup@users.noreply.github.com> Date: Tue, 21 May 2024 15:58:32 -0400 Subject: [PATCH 2/2] Use conditional chaining --- lib/components/viewers/route-details.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/components/viewers/route-details.tsx b/lib/components/viewers/route-details.tsx index ac08e27ed..aaacb4a42 100644 --- a/lib/components/viewers/route-details.tsx +++ b/lib/components/viewers/route-details.tsx @@ -82,7 +82,7 @@ class RouteDetails extends Component { const { agency, patterns = {}, shortName, url } = route const pattern = patterns[patternId] - const moreDetailsURL = url || route.agency.url + const moreDetailsURL = url || route?.agency?.url const routeColor = getRouteColorBasedOnSettings(operator, route)