Skip to content

Commit 0abd8f4

Browse files
committed
Add Modular contracts banner on dashboard and portal (#4560)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview The focus of this PR is to introduce a new `AnnouncementBanner` component in the dashboard and portal pages. ### Detailed summary - Added `AnnouncementBanner` component to display announcements in dashboard and portal - Updated announcement content and link in `AnnouncementBanner` - Updated `Banner` component in portal - Reorganized imports in `layout.tsx` and made minor changes in layout components > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 5fe9476 commit 0abd8f4

File tree

4 files changed

+19
-17
lines changed

4 files changed

+19
-17
lines changed

apps/dashboard/src/components/notices/AnnouncementBanner.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Heading, TrackedLink } from "tw-components";
55

66
export const AnnouncementBanner = () => {
77
const [hasDismissedAnnouncement, setHasDismissedAnnouncement] =
8-
useLocalStorage("dismissed-blocktorch-announcement", false, true);
8+
useLocalStorage("dismissed-modular-contracts-announcement", false, true);
99

1010
if (hasDismissedAnnouncement) {
1111
return null;
@@ -27,7 +27,7 @@ export const AnnouncementBanner = () => {
2727
>
2828
<Box display={{ base: "none", md: "block" }} />
2929
<TrackedLink
30-
href="https://onchainolympics.com"
30+
href="https://thirdweb.com/explore/modular-contracts"
3131
category="announcement"
3232
label="onchain-olympics"
3333
isExternal
@@ -47,8 +47,8 @@ export const AnnouncementBanner = () => {
4747
color="white"
4848
fontWeight={500}
4949
>
50-
The Onchain Olympics ⛓️🏅 — Mint an NFT on your preferred chain
51-
to unlock builder perks on thirdweb
50+
Modular Contracts Beta: Secure, Customizable, and Easy to
51+
Integrate contracts
5252
</Heading>
5353
<Icon display={{ base: "none", md: "block" }} as={FiArrowRight} />
5454
</Flex>

apps/dashboard/src/pages/_app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import type { ThirdwebNextPage } from "utils/types";
2323
import chakraTheme from "../theme";
2424
import "@/styles/globals.css";
2525
import { DashboardRouterTopProgressBar } from "@/lib/DashboardRouter";
26+
import { AnnouncementBanner } from "../components/notices/AnnouncementBanner";
2627

2728
const inter = interConstructor({
2829
subsets: ["latin"],
@@ -273,7 +274,7 @@ const ConsoleApp = memo(function ConsoleApp({
273274

274275
<TailwindTheme>
275276
<ChakraProvider theme={chakraThemeWithFonts}>
276-
{/* <AnnouncementBanner /> */}
277+
<AnnouncementBanner />
277278
{isFallback && Component.fallback
278279
? Component.fallback
279280
: getLayout(<Component {...pageProps} />, pageProps)}

apps/portal/src/app/layout.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import "./globals.css";
2-
import { Inter, Fira_Code } from "next/font/google";
3-
import { Header } from "./Header";
4-
import NextTopLoader from "nextjs-toploader";
2+
import { createMetadata } from "@/components/Document";
53
import { PosthogHeadSetup, PosthogPageView } from "@/lib/posthog/Posthog";
4+
import { Fira_Code, Inter } from "next/font/google";
65
import Script from "next/script";
7-
import { createMetadata } from "@/components/Document";
8-
import { SetStoredTheme } from "../components/others/theme/theme";
9-
import { Banner } from "../components/others/Banner";
6+
import NextTopLoader from "nextjs-toploader";
107
import { StickyTopContainer } from "../components/Document/StickyTopContainer";
8+
import { Banner } from "../components/others/Banner";
119
import { EnableSmoothScroll } from "../components/others/SmoothScroll";
10+
import { SetStoredTheme } from "../components/others/theme/theme";
11+
import { Header } from "./Header";
1212

1313
const sansFont = Inter({
1414
subsets: ["latin"],
@@ -65,9 +65,9 @@ export default function RootLayout({
6565
<StickyTopContainer>
6666
{/* Note: Please change id as well when changing text or href so that new banner is shown to user even if user dismissed the older one */}
6767
<Banner
68-
id="v5-stable"
69-
text="Connect SDK v5 has been released. See documentation."
70-
href="https://portal.thirdweb.com/typescript/v5"
68+
id="modular-contracts"
69+
text="Modular Contracts Beta: Secure, Customizable, and Easy to Integrate contracts"
70+
href="https://thirdweb.com/explore/modular-contracts"
7171
/>
7272
<Header />
7373
</StickyTopContainer>

apps/portal/src/components/others/Banner.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use client";
2-
import Link from "next/link";
32
import { XIcon } from "lucide-react";
4-
import { Button } from "../ui/button";
3+
import Link from "next/link";
54
import { useEffect, useState } from "react";
5+
import { Button } from "../ui/button";
66

77
export function Banner(props: { text: string; href: string; id: string }) {
88
const [showBanner, setShowBanner] = useState(false);
@@ -21,13 +21,14 @@ export function Banner(props: { text: string; href: string; id: string }) {
2121

2222
return (
2323
<div
24-
className="flex items-center justify-center gap-2 p-3 pr-20 transition-opacity duration-700 animate-in fade-in-0"
24+
className="animate-in fade-in-0 flex items-center justify-center gap-2 p-3 pr-20 transition-opacity duration-700"
2525
style={{
2626
background: `linear-gradient(145.96deg, rgb(65, 10, 182) 5.07%, rgb(60 132 246) 100%)`,
2727
}}
2828
>
2929
<Link
3030
href={props.href}
31+
target={props.href.startsWith("http") ? "_blank" : undefined}
3132
className="font-bold hover:underline"
3233
style={{
3334
color: "white",

0 commit comments

Comments
 (0)