diff --git a/frontend/src/components/SidebarLayout/const.js b/frontend/src/components/SidebarLayout/const.js index 31153fda..f2f5f9cf 100644 --- a/frontend/src/components/SidebarLayout/const.js +++ b/frontend/src/components/SidebarLayout/const.js @@ -1,18 +1,21 @@ -export const instrumentsItems = [ - { +export const browserExtensions = { + chrome: { color: "green", title: "Instalează-ți extensia de Chrome pentru a depista știri false", ctaText: "Instalează extensia", ctaLink: "https://chrome.google.com/webstore/detail/covid-19-stiri-oficiale/pdcpkplohipjhdfdchpmgekifmcdbnha" }, - { + firefox: { color: "green", title: "Instalează-ți extensia de Firefox pentru a depista știri false", ctaText: "Instalează extensia", ctaLink: "https://addons.mozilla.org/en-US/firefox/addon/covid-19-%C8%99tiri-oficiale/" - }, + } +}; + +export const instrumentsItems = [ { color: "green", title: "Știri oficiale și informații la zi", diff --git a/frontend/src/components/SidebarLayout/index.js b/frontend/src/components/SidebarLayout/index.js index 77e032d0..95900a92 100644 --- a/frontend/src/components/SidebarLayout/index.js +++ b/frontend/src/components/SidebarLayout/index.js @@ -5,24 +5,31 @@ import { InstrumentsItem, Hero } from "@code4ro/taskforce-fe-components"; -import { instrumentsItems } from "./const"; +import { browserExtensions, instrumentsItems } from "./const"; const SidebarLayout = ({ children }) => { + // Browser detection based on this answer: + // https://stackoverflow.com/a/9851769/5723188 + const isChrome = + !!window.chrome && (!!window.chrome.webstore || !!window.chrome.runtime); + const isFirefox = typeof InstallTrigger !== "undefined"; + + let installExtensionItem = null; + if (isChrome) { + installExtensionItem = ; + } else if (isFirefox) { + installExtensionItem = ; + } + return (
{children}