Skip to content

Commit a612855

Browse files
committed
refactor: new supported browsers and warning message
1 parent 143ea68 commit a612855

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

vis/js/HeadstartRunner.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,17 +69,20 @@ class HeadstartRunner {
6969
const SUPPORTED = ["Chrome", "Firefox", "Safari", "Edge", "Opera"] as const;
7070

7171
const browser = Bowser.getParser(window.navigator.userAgent);
72-
// TODO use proper browser filtering https://www.npmjs.com/package/bowser#filtering-browsers
73-
if (
74-
!SUPPORTED.map((browserName) => browserName.toLocaleLowerCase()).includes(
75-
browser.getBrowserName(true)
76-
)
77-
) {
78-
alert(
72+
const browserName = browser.getBrowserName(true);
73+
74+
const isSupportedBrowser = SUPPORTED.map((browserName) =>
75+
browserName.toLowerCase()
76+
).includes(browserName);
77+
78+
if (!isSupportedBrowser || !browserName) {
79+
const warningMessage =
7980
"You are using an unsupported browser. " +
80-
"This visualization was successfully tested " +
81-
"with the latest versions of Chrome, Firefox and Safari."
82-
);
81+
"This visualization was successfully tested " +
82+
"with the latest versions of " +
83+
`${SUPPORTED.slice(0, -1).join(", ")} and ${SUPPORTED.at(-1)}.`;
84+
85+
alert(warningMessage);
8386
}
8487
}
8588

0 commit comments

Comments
 (0)