Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TOOL-2808] Add back freewallets announcement banner + hide it after 31st Dec 2024 #5814

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/dashboard/src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import PlausibleProvider from "next-plausible";
import { Inter } from "next/font/google";
import NextTopLoader from "nextjs-toploader";
import { Suspense } from "react";
import { UnlimitedWalletsBanner } from "../components/notices/AnnouncementBanner";
import { OpCreditsGrantedModalWrapperServer } from "../components/onboarding/OpCreditsGrantedModalWrapperServer";
import { EnsureValidConnectedWalletLoginServer } from "./components/EnsureValidConnectedWalletLogin/EnsureValidConnectedWalletLoginServer";
import { PostHogProvider } from "./components/root-providers";
Expand Down Expand Up @@ -71,7 +72,7 @@ export default function RootLayout({
fontSans.variable,
)}
>
{/* Banner goes here */}
<UnlimitedWalletsBanner />
<AppRouterProviders>
{children}
<Suspense fallback={null}>
Expand Down
18 changes: 18 additions & 0 deletions apps/dashboard/src/components/notices/AnnouncementBanner.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";
import { Button } from "@/components/ui/button";
import { TrackedLinkTW } from "@/components/ui/tracked-link";
import { isAfter } from "date-fns";
import { useLocalStorage } from "hooks/useLocalStorage";
import { ChevronRightIcon, XIcon } from "lucide-react";
import { useSelectedLayoutSegment } from "next/navigation";
Expand Down Expand Up @@ -56,3 +57,20 @@ export function AnnouncementBanner(props: {
</div>
);
}

export function UnlimitedWalletsBanner() {
// hide banner after 31st December 2024
const shouldHideBanner = isAfter(new Date(), new Date("31 Dec 2024"));

if (shouldHideBanner) {
return null;
}

return (
<AnnouncementBanner
href="/team/~/~/settings/billing?coupon=FREEWALLETS24"
label='Claim 12 months of free in-app wallets. Use code "FREEWALLETS24". Redeem offer by December 31st!'
trackingLabel="unlimited-wallets"
/>
);
}
3 changes: 2 additions & 1 deletion apps/dashboard/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import type { ThirdwebNextPage } from "utils/types";
import chakraTheme from "../theme";
import "@/styles/globals.css";
import { DashboardRouterTopProgressBar } from "@/lib/DashboardRouter";
import { UnlimitedWalletsBanner } from "../components/notices/AnnouncementBanner";

const inter = interConstructor({
subsets: ["latin"],
Expand Down Expand Up @@ -259,7 +260,7 @@ const ConsoleApp = memo(function ConsoleApp({
/>

<DashboardRouterTopProgressBar />
{/* Banner goes here */}
<UnlimitedWalletsBanner />

<TailwindTheme>
<ChakraProvider theme={chakraThemeWithFonts}>
Expand Down
Loading