Skip to content

Commit f59b56c

Browse files
authored
Add banner for HyperVue Miles program (#1694)
1 parent 3282350 commit f59b56c

File tree

6 files changed

+72
-3
lines changed

6 files changed

+72
-3
lines changed

apps/hyperdrive-trading/src/ui/app/Navbar/DevtoolsMenu.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ export function DevtoolsMenu(): ReactElement {
2323
<FeatureFlagMenuItem flagName="points-markets">
2424
Points markets
2525
</FeatureFlagMenuItem>
26+
<MenuItem
27+
onClick={() => {
28+
window.localStorage.clear();
29+
location.reload();
30+
}}
31+
title={"Clear prefs"}
32+
/>
2633
<MenuItem
2734
onClick={() => {
2835
throw new Error(

apps/hyperdrive-trading/src/ui/app/Page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Navbar } from "src/ui/app/Navbar/Navbar";
66
import { TermsOfUseAndPrivacyPolicyModal } from "src/ui/compliance/TermsOfUseAndPrivacyPolicyModal";
77
import { useAddressScreen } from "src/ui/compliance/hooks/useAddressScreen";
88
import { useVpnScreen } from "src/ui/compliance/hooks/useVpnScreen";
9+
import { MilesBanner } from "src/ui/rewards/MilesBanner";
910

1011
export function Page({ children }: PropsWithChildren): ReactElement {
1112
// compliance
@@ -16,6 +17,7 @@ export function Page({ children }: PropsWithChildren): ReactElement {
1617
<div className="flex min-h-screen flex-col items-center justify-between gap-9">
1718
<div className="flex w-full grow flex-col items-center gap-9">
1819
<Navbar />
20+
<MilesBanner />
1921

2022
{/* compliance */}
2123
<TermsOfUseAndPrivacyPolicyModal />
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
1+
import classNames from "classnames";
12
import { ReactNode } from "react";
23

34
export default function CustomBanner({
45
icon,
56
description,
7+
className,
68
}: {
79
icon?: ReactNode;
8-
description: string;
10+
description: ReactNode;
11+
className?: string;
912
}): JSX.Element {
1013
return (
11-
<div className="daisy-alert">
14+
<div className={classNames("daisy-alert", className)}>
1215
{icon}
13-
<span>{description}</span>
16+
{description}
1417
</div>
1518
);
1619
}

apps/hyperdrive-trading/src/ui/globals.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,7 @@ div[data-rk] {
5555
.gradient-text {
5656
@apply bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent;
5757
}
58+
.gradient-hypervue {
59+
@apply from-hypervue-red to-hypervue-pink bg-gradient-to-r;
60+
}
5861
}
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { XMarkIcon } from "@heroicons/react/24/outline";
2+
import { ReactElement } from "react";
3+
import { useLocalStorage } from "react-use";
4+
import { ExternalLink } from "src/ui/analytics/ExternalLink";
5+
import CustomBanner from "src/ui/base/components/CustomBanner";
6+
7+
export function MilesBanner(): ReactElement | null {
8+
const { isBannerDismissed, setIsBannerDismissed } = useMilesBannerDismissed();
9+
if (isBannerDismissed) {
10+
return null;
11+
}
12+
return (
13+
<CustomBanner
14+
className="gradient-hypervue rounded-none"
15+
icon={<img src="/hyperdrive-solo-logo-white.svg" className="size-8" />}
16+
description={
17+
<div className="flex w-full justify-between">
18+
<span className="text-base-content">
19+
You can now earn Miles by providing liquidity on Hyperdrive! Learn
20+
more about the{" "}
21+
<ExternalLink
22+
newTab
23+
href="https://mirror.xyz/0xdB081d7cedeDB2cFb4fff2330D9a31f54A025E38/qVENDIYTfUiZw6QZroXBpNxF8UjTGV8YkVq0lOaTznU"
24+
className="daisy-link font-medium text-white"
25+
>
26+
HyperVue Foundation points program
27+
</ExternalLink>
28+
.
29+
</span>
30+
<button onClick={() => setIsBannerDismissed(true)}>
31+
<XMarkIcon className="h-6 cursor-pointer" />
32+
</button>
33+
</div>
34+
}
35+
/>
36+
);
37+
}
38+
function useMilesBannerDismissed(): {
39+
isBannerDismissed: boolean;
40+
setIsBannerDismissed: (isDismissed: boolean) => void;
41+
} {
42+
const [isBannerDismissed, setIsBannerDismissed] = useLocalStorage(
43+
"miles-banner-dismissed",
44+
false,
45+
);
46+
return {
47+
// safe to case because default value is set to false
48+
isBannerDismissed: isBannerDismissed as boolean,
49+
setIsBannerDismissed,
50+
};
51+
}

apps/hyperdrive-trading/tailwind.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ module.exports = {
4848
"warpcast-purple": "#472b92",
4949
"farcaster-purple": "#8A63D2",
5050

51+
"hypervue-red": "#E26360",
52+
"hypervue-pink": "#DC70D4",
53+
5154
gray: {
5255
50: "#EFF4F6",
5356
100: "#BDD2DB",

0 commit comments

Comments
 (0)