diff --git a/.prettierignore b/.prettierignore index 3ee0f051..450d88fa 100644 --- a/.prettierignore +++ b/.prettierignore @@ -2,5 +2,4 @@ build coverage -data/ -*.html \ No newline at end of file +data/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index ec5d5be1..4e43de8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -24,6 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Refactor config to be a json object instead of separate exported constants - Changed config key names to remove the word `VITE` (leftover from when they were .env vars) - Refactor `default.js` to remove dead code and rename vars +- Conditionally render E84 FilmDrop Logo based on config var for `SHOW_BRAND_LOGO`` ### Fixed @@ -40,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Reusable System Message component for showing app alerts - Load `config.json` into redux on app load once instead of direct imports - Add pre-initialization page to handle and show error (and not render app) if config is missing +- Add `SHOW_BRAND_LOGO` config option to optionally hide brand logo ### Removed diff --git a/README.md b/README.md index 96d8df94..02aa096e 100644 --- a/README.md +++ b/README.md @@ -90,6 +90,7 @@ The files `.env.example` and `./public/config/config.example.json` are included | BASEMAP_HTML_ATTRIBUTION | String of HTML markup used to set the attribution for the basemap provider used by the leaflet map. Markup is sanitized prior to render with `DOMPurify` and only is retricted to only allow `html`, `'a' tags`, and `'href'` and `'target'` attributes. Custom attribution will not render if `BASEMAP_URL` is not also set. If not set, the default attribution will be `© OpenStreetMap`. (Note: Raw HTML was used here since attribution is non-standardized.) | Optional | | ADVANCED_SEARCH_ENABLED | If set to `true` advanced search options will render and allow users to draw or upload a geojson file to use as search bounds. | Optional | | CART_ENABLED | If set to `true` cart features will be enabled. These include: rendering cart button in search controls bar, adding cart management buttons to popup results, render buttons in messages to quickly add some or all scenes to cart after search completes. | Optional | +| SHOW_BRAND_LOGO | If set to `true` filmdrop brand logo and clickable hyperlink are rendered at the top right of the UI. If not set or `false`, the logo will not be visible. | Optional | ### Links diff --git a/index.html b/index.html index bf88e1a2..532e480b 100644 --- a/index.html +++ b/index.html @@ -1,4 +1,4 @@ - +
diff --git a/package-lock.json b/package-lock.json index a7864fa5..879bc641 100644 --- a/package-lock.json +++ b/package-lock.json @@ -55,7 +55,7 @@ "eslint-plugin-testing-library": "^5.11.0", "jsdom": "^22.0.0", "pre-commit": "^1.2.2", - "prettier": "3.0.0", + "prettier": "^3.0.0", "prettier-eslint": "^15.0.1", "prettier-eslint-cli": "^7.1.0", "remark-cli": "^11.0.0", @@ -6329,23 +6329,23 @@ } }, "node_modules/istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "dependencies": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" }, "engines": { - "node": ">=8" + "node": ">=10" } }, "node_modules/istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "dependencies": { "html-escaper": "^2.0.0", @@ -6938,15 +6938,15 @@ } }, "node_modules/make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "dependencies": { - "semver": "^6.0.0" + "semver": "^7.5.3" }, "engines": { - "node": ">=8" + "node": ">=10" }, "funding": { "url": "https://github.com/sponsors/sindresorhus" @@ -16924,20 +16924,20 @@ "dev": true }, "istanbul-lib-report": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.0.tgz", - "integrity": "sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", "dev": true, "requires": { "istanbul-lib-coverage": "^3.0.0", - "make-dir": "^3.0.0", + "make-dir": "^4.0.0", "supports-color": "^7.1.0" } }, "istanbul-reports": { - "version": "3.1.5", - "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.5.tgz", - "integrity": "sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==", + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", "dev": true, "requires": { "html-escaper": "^2.0.0", @@ -17393,9 +17393,9 @@ } }, "make-dir": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz", - "integrity": "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", "dev": true, "requires": { "semver": "^7.5.3" diff --git a/package.json b/package.json index f97cd8e8..6ddf55ff 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "eslint-plugin-testing-library": "^5.11.0", "jsdom": "^22.0.0", "pre-commit": "^1.2.2", - "prettier": "3.0.0", + "prettier": "^3.0.0", "prettier-eslint": "^15.0.1", "prettier-eslint-cli": "^7.1.0", "remark-cli": "^11.0.0", diff --git a/public/config/config.example.json b/public/config/config.example.json index 59e7d74e..be250932 100644 --- a/public/config/config.example.json +++ b/public/config/config.example.json @@ -100,5 +100,6 @@ "BASEMAP_URL": "https://tile-provider.example.com/{z}/{x}/{y}.png", "BASEMAP_HTML_ATTRIBUTION": "© TileProvider", "ADVANCED_SEARCH_ENABLED": false, - "CART_ENABLED": false + "CART_ENABLED": false, + "SHOW_BRAND_LOGO": true } diff --git a/src/components/Layout/PageHeader/PageHeader.jsx b/src/components/Layout/PageHeader/PageHeader.jsx index d3f07ff2..7d38112e 100644 --- a/src/components/Layout/PageHeader/PageHeader.jsx +++ b/src/components/Layout/PageHeader/PageHeader.jsx @@ -38,16 +38,18 @@ const PageHeader = () => { )} - - - + {_appConfig.SHOW_BRAND_LOGO && ( + + + + )} ) diff --git a/src/components/Layout/PageHeader/PageHeader.test.jsx b/src/components/Layout/PageHeader/PageHeader.test.jsx index c62df132..3a845cf7 100644 --- a/src/components/Layout/PageHeader/PageHeader.test.jsx +++ b/src/components/Layout/PageHeader/PageHeader.test.jsx @@ -18,13 +18,26 @@ describe('PageHeader', () => { store.dispatch(setappConfig(mockAppConfig)) }) describe('on app render', () => { - it('should load the filmdrop logo into the document', () => { + it('should load the filmdrop logo into the document if SHOW_BRAND_LOGO set to true in config', () => { setup() expect( - screen.getByRole('img', { + screen.queryByRole('img', { name: /filmdrop by element 84/i }) ).toBeInTheDocument() }) + it('should not load the filmdrop logo into the document if SHOW_BRAND_LOGO set to false in config', () => { + const mockAppConfigSearchEnabled = { + ...mockAppConfig, + SHOW_BRAND_LOGO: false + } + store.dispatch(setappConfig(mockAppConfigSearchEnabled)) + setup() + expect( + screen.queryByRole('img', { + name: /filmdrop by element 84/i + }) + ).not.toBeInTheDocument() + }) }) }) diff --git a/src/testing/shared-mocks.js b/src/testing/shared-mocks.js index b5270f0a..3d151b57 100644 --- a/src/testing/shared-mocks.js +++ b/src/testing/shared-mocks.js @@ -3546,5 +3546,6 @@ export const mockAppConfig = { BASEMAP_HTML_ATTRIBUTION: '© TileProvider', ADVANCED_SEARCH_ENABLED: false, - CART_ENABLED: false + CART_ENABLED: false, + SHOW_BRAND_LOGO: true }