From 24ddd2a5c0ff353206263a4d539644cb4ad5c229 Mon Sep 17 00:00:00 2001 From: Anthony Shull Date: Wed, 13 Nov 2024 09:59:37 -0600 Subject: [PATCH] remove mobile app banner (#2222) --- assets/js/app.js | 4 -- assets/js/mobile-app-banner.js | 52 ------------------- lib/dotcom_web/templates/layout/root.html.eex | 5 -- 3 files changed, 61 deletions(-) delete mode 100644 assets/js/mobile-app-banner.js diff --git a/assets/js/app.js b/assets/js/app.js index 2133f56e66..cd5be24330 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -46,8 +46,6 @@ import { accordionInit } from "../ts/ui/accordion"; import initializeSentry from "../ts/sentry"; import DotcomHooks from "../ts/phoenix-hooks/index.ts"; -import mobileAppBanner from "./mobile-app-banner.js"; - // Establish Phoenix Socket and LiveView configuration. import { Socket } from "phoenix"; import { LiveSocket } from "phoenix_live_view"; @@ -158,5 +156,3 @@ eventPageSetup(); previousEventsButton(); pslPageSetup(); accordionInit(); - -mobileAppBanner(); diff --git a/assets/js/mobile-app-banner.js b/assets/js/mobile-app-banner.js deleted file mode 100644 index 620397d7a0..0000000000 --- a/assets/js/mobile-app-banner.js +++ /dev/null @@ -1,52 +0,0 @@ -const isNotAndroid = () => { - return !/Android/.test(navigator.userAgent); -}; - -const isNotCommuterRail = url => { - return !/\/schedules\/CR-/.test(url); -}; - -const isNotFerry = url => { - return !/\/schedules\/Boat-/.test(url); -}; - -const isAlertsPage = url => { - return isNotCommuterRail(url) && isNotFerry(url) && /\/alerts/.test(url); -}; - -const isSchedulePage = url => { - return ( - isNotCommuterRail(url) && - isNotFerry(url) && - /\/schedules\/[\w.-]+\//.test(url) - ); -}; - -const isStopPage = url => { - return /\/stops\/[\w.-]+/.test(url); -}; - -const isTransitNearMePage = url => { - return /\/transit-near-me/.test(url); -}; - -const isIncludedPage = () => { - const url = window.location.href; - - return [isAlertsPage, isSchedulePage, isStopPage, isTransitNearMePage].some( - fn => { - return fn(url); - } - ); -}; - -/** - * If the page is one of the pages we want to show the banner on - * And the user is not on an Android device - * Show the banner - */ -export default function mobileAppBanner() { - if (isIncludedPage() && isNotAndroid()) { - document.querySelector("#mobile-app-banner").style.display = "block"; - } -} diff --git a/lib/dotcom_web/templates/layout/root.html.eex b/lib/dotcom_web/templates/layout/root.html.eex index 33f31924ff..cbd1103ce8 100644 --- a/lib/dotcom_web/templates/layout/root.html.eex +++ b/lib/dotcom_web/templates/layout/root.html.eex @@ -75,11 +75,6 @@ <% end %> - <%= if assigns[:search_header?] do %> <%= render "_searchbar.html", assigns %> <% end %>