From 71b7b1cba0c0d2ed6def74bb302d4ecf1377aa6d Mon Sep 17 00:00:00 2001 From: jeremy lee Date: Tue, 20 Aug 2024 12:15:04 -0500 Subject: [PATCH] test --- scripts/inject-smartbanner.js | 31 +++++++++++++------------------ src/index.css | 5 +++++ src/styles/constants.css | 6 ------ 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/scripts/inject-smartbanner.js b/scripts/inject-smartbanner.js index f8bfa18e1..7998433ce 100644 --- a/scripts/inject-smartbanner.js +++ b/scripts/inject-smartbanner.js @@ -3,11 +3,11 @@ import fs from 'fs/promises'; import path from 'path'; import { fileURLToPath } from 'url'; -const SMARTBANNER_APP_NAME = 'some fake thing'; -const SMARTBANNER_ORG_NAME = 'some fake thing'; -const SMARTBANNER_ICON_URL = 'some fake thing'; -const SMARTBANNER_APPSTORE_URL = 'some fake thing'; -const SMARTBANNER_GOOGLEPLAY_URL = 'some fake thing'; +const SMARTBANNER_APP_NAME = process.env.SMARTBANNER_APP_NAME; +const SMARTBANNER_ORG_NAME = process.env.SMARTBANNER_ORG_NAME; +const SMARTBANNER_ICON_URL = process.env.SMARTBANNER_ICON_URL; +const SMARTBANNER_APPSTORE_URL = process.env.SMARTBANNER_APPSTORE_URL; +const SMARTBANNER_GOOGLEPLAY_URL = process.env.SMARTBANNER_GOOGLEPLAY_URL; const currentPath = fileURLToPath(import.meta.url); const projectRoot = path.dirname(currentPath); @@ -17,10 +17,11 @@ if ( SMARTBANNER_APP_NAME && SMARTBANNER_ORG_NAME && SMARTBANNER_ICON_URL && - (SMARTBANNER_APPSTORE_URL || SMARTBANNER_GOOGLEPLAY_URL) + (SMARTBANNER_APPSTORE_URL ?? SMARTBANNER_GOOGLEPLAY_URL) ) { try { const files = await fs.readdir('entry-points'); + // eslint-disable-next-line no-restricted-syntax for (const file of files) { inject(file); } @@ -42,32 +43,26 @@ async function inject(fileName) { /* hardcoded injection depending on whether the app is available on App Store and/or Google Play */ if (SMARTBANNER_APPSTORE_URL) { - smartbanner = - `\t\n` + - smartbanner; + smartbanner = `\t\n${smartbanner}`; } if (SMARTBANNER_GOOGLEPLAY_URL) { - smartbanner = - `\t\n` + - smartbanner; + smartbanner = `\t\n${smartbanner}`; } if (SMARTBANNER_APPSTORE_URL) { if (SMARTBANNER_GOOGLEPLAY_URL) { - smartbanner = - `\t\n` + smartbanner; + smartbanner = `\t\n${smartbanner}`; } else { - smartbanner = `\t\n` + smartbanner; + smartbanner = `\t\n${smartbanner}`; } } else { if (SMARTBANNER_GOOGLEPLAY_URL) { - smartbanner = - `\t\n` + smartbanner; + smartbanner = `\t\n${smartbanner}`; } } const injectedHtml = html.replace('', `${smartbanner}\n`); await fs.writeFile(htmlFilePath, injectedHtml, 'utf-8'); - console.log(htmlFilePath, injectedHtml); + console.log(`Smartbanner scripts successfully injected (${fileName}).`); } diff --git a/src/index.css b/src/index.css index b6db95a87..b41db242c 100644 --- a/src/index.css +++ b/src/index.css @@ -96,3 +96,8 @@ strong, b { font-weight: 700; } + +/* Fixes the smart banner being unclickable. We want this to rise above all app banners */ +.smartbanner--ios { + z-index: 999; +} diff --git a/src/styles/constants.css b/src/styles/constants.css index b8588c30a..4d25c497c 100644 --- a/src/styles/constants.css +++ b/src/styles/constants.css @@ -51,9 +51,3 @@ --form-input-paddingY: 0.25rem; --form-input-paddingX: 0.625rem; } - -.smartbanner--ios { - font-size: 18px; - color: #007aff; - z-index: 10; -}