From cfc8fab25f12d8014824a18321c18b17e2c7ca1d Mon Sep 17 00:00:00 2001 From: Danny Delott Date: Wed, 18 Dec 2024 13:05:33 -0800 Subject: [PATCH] Add banner for miles program --- .../src/ui/app/Navbar/DevtoolsMenu.tsx | 7 +++ apps/hyperdrive-trading/src/ui/app/Page.tsx | 2 + .../src/ui/base/components/CustomBanner.tsx | 9 ++-- apps/hyperdrive-trading/src/ui/globals.css | 3 ++ .../src/ui/rewards/MilesBanner.tsx | 51 +++++++++++++++++++ apps/hyperdrive-trading/tailwind.config.js | 3 ++ 6 files changed, 72 insertions(+), 3 deletions(-) create mode 100644 apps/hyperdrive-trading/src/ui/rewards/MilesBanner.tsx diff --git a/apps/hyperdrive-trading/src/ui/app/Navbar/DevtoolsMenu.tsx b/apps/hyperdrive-trading/src/ui/app/Navbar/DevtoolsMenu.tsx index c7258edd1..21fda47d7 100644 --- a/apps/hyperdrive-trading/src/ui/app/Navbar/DevtoolsMenu.tsx +++ b/apps/hyperdrive-trading/src/ui/app/Navbar/DevtoolsMenu.tsx @@ -23,6 +23,13 @@ export function DevtoolsMenu(): ReactElement { Points markets + { + window.localStorage.clear(); + location.reload(); + }} + title={"Clear prefs"} + /> { throw new Error( diff --git a/apps/hyperdrive-trading/src/ui/app/Page.tsx b/apps/hyperdrive-trading/src/ui/app/Page.tsx index 879f8a0f3..4a57a6f3c 100644 --- a/apps/hyperdrive-trading/src/ui/app/Page.tsx +++ b/apps/hyperdrive-trading/src/ui/app/Page.tsx @@ -6,6 +6,7 @@ import { Navbar } from "src/ui/app/Navbar/Navbar"; import { TermsOfUseAndPrivacyPolicyModal } from "src/ui/compliance/TermsOfUseAndPrivacyPolicyModal"; import { useAddressScreen } from "src/ui/compliance/hooks/useAddressScreen"; import { useVpnScreen } from "src/ui/compliance/hooks/useVpnScreen"; +import { MilesBanner } from "src/ui/rewards/MilesBanner"; export function Page({ children }: PropsWithChildren): ReactElement { // compliance @@ -16,6 +17,7 @@ export function Page({ children }: PropsWithChildren): ReactElement {
+ {/* compliance */} diff --git a/apps/hyperdrive-trading/src/ui/base/components/CustomBanner.tsx b/apps/hyperdrive-trading/src/ui/base/components/CustomBanner.tsx index 3877f7b61..0fa6dab97 100644 --- a/apps/hyperdrive-trading/src/ui/base/components/CustomBanner.tsx +++ b/apps/hyperdrive-trading/src/ui/base/components/CustomBanner.tsx @@ -1,16 +1,19 @@ +import classNames from "classnames"; import { ReactNode } from "react"; export default function CustomBanner({ icon, description, + className, }: { icon?: ReactNode; - description: string; + description: ReactNode; + className?: string; }): JSX.Element { return ( -
+
{icon} - {description} + {description}
); } diff --git a/apps/hyperdrive-trading/src/ui/globals.css b/apps/hyperdrive-trading/src/ui/globals.css index f10e230b0..b2e2151a2 100644 --- a/apps/hyperdrive-trading/src/ui/globals.css +++ b/apps/hyperdrive-trading/src/ui/globals.css @@ -55,4 +55,7 @@ div[data-rk] { .gradient-text { @apply bg-gradient-to-r from-primary to-accent bg-clip-text text-transparent; } + .gradient-hypervue { + @apply from-hypervue-red to-hypervue-pink bg-gradient-to-r; + } } diff --git a/apps/hyperdrive-trading/src/ui/rewards/MilesBanner.tsx b/apps/hyperdrive-trading/src/ui/rewards/MilesBanner.tsx new file mode 100644 index 000000000..820665c8a --- /dev/null +++ b/apps/hyperdrive-trading/src/ui/rewards/MilesBanner.tsx @@ -0,0 +1,51 @@ +import { XMarkIcon } from "@heroicons/react/24/outline"; +import { ReactElement } from "react"; +import { useLocalStorage } from "react-use"; +import { ExternalLink } from "src/ui/analytics/ExternalLink"; +import CustomBanner from "src/ui/base/components/CustomBanner"; + +export function MilesBanner(): ReactElement | null { + const { isBannerDismissed, setIsBannerDismissed } = useMilesBannerDismissed(); + if (isBannerDismissed) { + return null; + } + return ( + } + description={ +
+ + You can now earn Miles by providing liquidity on Hyperdrive! Learn + more about the{" "} + + HyperVue Foundation points program + + . + + +
+ } + /> + ); +} +function useMilesBannerDismissed(): { + isBannerDismissed: boolean; + setIsBannerDismissed: (isDismissed: boolean) => void; +} { + const [isBannerDismissed, setIsBannerDismissed] = useLocalStorage( + "miles-banner-dismissed", + false, + ); + return { + // safe to case because default value is set to false + isBannerDismissed: isBannerDismissed as boolean, + setIsBannerDismissed, + }; +} diff --git a/apps/hyperdrive-trading/tailwind.config.js b/apps/hyperdrive-trading/tailwind.config.js index c225d4135..3127ff1fe 100644 --- a/apps/hyperdrive-trading/tailwind.config.js +++ b/apps/hyperdrive-trading/tailwind.config.js @@ -48,6 +48,9 @@ module.exports = { "warpcast-purple": "#472b92", "farcaster-purple": "#8A63D2", + "hypervue-red": "#E26360", + "hypervue-pink": "#DC70D4", + gray: { 50: "#EFF4F6", 100: "#BDD2DB",