mirror of
https://github.com/lrnselfreliance/wrolpi.git
synced 2026-11-26 01:46:18 -05:00
app: only show extension install banner on Chromium/Firefox
The dashboard nudge is useless on Safari and other browsers that cannot run the WROLPi extension. Share detectBrowser and gate the banner with isExtensionSupportedBrowser.
This commit is contained in:
parent
46ba804a1b
commit
db7603012e
4 changed files with 54 additions and 12 deletions
|
|
@ -3,10 +3,13 @@ import {Link} from "react-router";
|
|||
import {Button, Icon, Message} from "semantic-ui-react";
|
||||
import {useLocalStorage} from "../Common";
|
||||
import {useExtensionInstalled} from "../../hooks/customHooks";
|
||||
import {isExtensionSupportedBrowser} from "./browserDetect";
|
||||
|
||||
// Top-of-dashboard nudge for users who don't yet have the WROLPi browser
|
||||
// extension installed (or installed but haven't added this WROLPi as a
|
||||
// destination). Hidden once the user installs+configures, or dismisses it.
|
||||
// Only shown on Chromium / Firefox — Safari and other browsers cannot run
|
||||
// the extension.
|
||||
//
|
||||
// Detection is via a meta tag injected by the extension's content script.
|
||||
// The extension only injects on configured destination origins, so seeing
|
||||
|
|
@ -19,7 +22,8 @@ export function ExtensionInstallSuggestion() {
|
|||
|
||||
// installed === null means "still checking" — render nothing rather
|
||||
// than flashing the banner before the content-script race resolves.
|
||||
if (installed !== false || dismissed) return null;
|
||||
// Also skip on browsers that cannot install the extension (e.g. Safari).
|
||||
if (installed !== false || dismissed || !isExtensionSupportedBrowser()) return null;
|
||||
|
||||
return <Message info icon onDismiss={() => setDismissed(true)}>
|
||||
<Icon name='puzzle piece'/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue