Skip to content

Commit d72dd03

Browse files
committed
Don't show confetti on Safari
1 parent 79ddedc commit d72dd03

File tree

3 files changed

+48
-6
lines changed

3 files changed

+48
-6
lines changed

frontend/src/components/layouts/Event/Event.module.scss

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,5 @@
520520
background-color: #f9fafc;
521521

522522
@include mixins.scrollbar;
523-
524-
@include mixins.respond-below(md) {
525-
height: calc(100vh - 114px);
526-
}
527523
}
528524
}

frontend/src/components/routes/event/GettingStarted/index.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ import {showError, showSuccess} from "../../../../utilites/notifications.tsx";
1414
import {getProductsFromEvent} from "../../../../utilites/helpers.ts";
1515
import {useEffect, useState} from 'react';
1616
import ConfettiAnimation from "./ConfettiAnimaiton";
17+
import {Browser, useBrowser} from "../../../../hooks/useGetBrowser.ts";
1718

1819
const GettingStarted = () => {
1920
const {eventId} = useParams();
2021
const location = useLocation();
2122
const navigate = useNavigate();
2223
const [showConfetti, setShowConfetti] = useState(false);
24+
const browser = useBrowser();
2325

2426
useEffect(() => {
2527
const searchParams = new URLSearchParams(location.search);
26-
if (searchParams.get('new_event') === 'true') {
28+
const isChromeOrFirefox = browser === Browser.Chrome || browser === Browser.Firefox;
29+
30+
if (searchParams.get('new_event') === 'true' && isChromeOrFirefox) {
2731
setShowConfetti(true);
2832

2933
setTimeout(() => {
@@ -73,7 +77,7 @@ const GettingStarted = () => {
7377

7478
return (
7579
<>
76-
{showConfetti && <ConfettiAnimation duration={2000}/>}
80+
{showConfetti && <ConfettiAnimation duration={1000}/>}
7781
<PageBody>
7882
<Card className={classes.headerCard}>
7983
<div className={classes.headerContent}>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {useMemo} from "react";
2+
3+
export enum Browser {
4+
Chrome = "Chrome",
5+
Firefox = "Firefox",
6+
Edge = "Edge",
7+
Brave = "Brave",
8+
Opera = "Opera",
9+
Chromium = "Chromium",
10+
Safari = "Safari",
11+
Unknown = "Unknown",
12+
}
13+
14+
export const useBrowser = (): Browser => {
15+
return useMemo(() => {
16+
const ua = navigator.userAgent;
17+
18+
if (/Firefox/.test(ua)) {
19+
return Browser.Firefox;
20+
}
21+
if (/Edg\//.test(ua)) {
22+
return Browser.Edge;
23+
}
24+
if (/OPR\//.test(ua)) {
25+
return Browser.Opera;
26+
}
27+
if (/Brave/.test(ua)) {
28+
return Browser.Brave;
29+
}
30+
if (/Chrome/.test(ua)) {
31+
if (navigator.userAgentData?.brands?.some(b => b.brand === "Chromium")) {
32+
return Browser.Chromium;
33+
}
34+
return Browser.Chrome;
35+
}
36+
if (/Safari/.test(ua)) {
37+
return Browser.Safari;
38+
}
39+
40+
return Browser.Unknown;
41+
}, []);
42+
};

0 commit comments

Comments
 (0)