Skip to content

Commit 8d6e342

Browse files
committed
conditional banner
1 parent 008fb72 commit 8d6e342

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

src/components/banner/PromoBanner.tsx

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,40 @@
1+
import React, { useState, useEffect } from "react";
2+
import { museHubReleases, audacityReleases } from "../../assets/js/releaseData";
13
import "../../styles/icons.css";
4+
import DownloadMuseHubButton from "../button/DownloadMuseHubButton";
5+
import platform from "platform";
26
declare interface Props {
37
url: string;
48
}
59

610
function PromoBanner({ url }: Props) {
711
//no promo running
812
//return null;
13+
const [showBanner, setShowBanner] = useState(true);
14+
15+
function getHref() {
16+
switch(platform.os.family){
17+
case "OS X":
18+
return museHubReleases.mac[0].browser_download_url;
19+
case "Windows":
20+
return museHubReleases.win[0].browser_download_url;
21+
default:
22+
setShowBanner(false); return "#";
23+
}
24+
}
925

1026
function handleButtonClick() {
1127
if (typeof _paq !== "undefined") {
1228
_paq.push([
1329
"trackEvent",
1430
"Promo CTA",
1531
"Promo CTA button",
16-
"Go to Survey",
32+
"Muse hub promo CTA",
1733
]);
1834
}
1935
}
2036

21-
return (
37+
return ( <> { showBanner &&
2238
<div
2339
id="promo-banner"
2440
className="flex items-center justify-center min-h-24 bg-yellow-300 gap-4 flex-wrap"
@@ -29,15 +45,17 @@ function PromoBanner({ url }: Props) {
2945
Polyspectral MBC Multiband Compressor! Now $9.99🔥
3046
</p>
3147
</div>
48+
3249
<a
33-
href="https://musehub.com/?mtm_campaign=audacityteam&mtm_content=bannerad"
50+
href={getHref()}
3451
id="promo-button"
3552
onClick={handleButtonClick}
3653
className="flex text-lg font-bold h-12 my-4 justify-center items-center px-4 border-2 border-gray-900 rounded-md hover:bg-gray-900 hover:text-white"
3754
>
3855
Get it on the Muse Hub
3956
</a>
4057
</div>
58+
} </>
4159
);
4260
}
4361

0 commit comments

Comments
 (0)