Skip to content

Commit 3d6b3ce

Browse files
feat(web): add MiniMax Coding Plans announcement banner (#3966)
1 parent ea4ab49 commit 3d6b3ce

2 files changed

Lines changed: 49 additions & 0 deletions

File tree

apps/web/src/app/(app)/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { EventServiceProvider } from '@/contexts/EventServiceContext';
77
import { AdminOmnibox } from '@/components/admin-omnibox';
88
import { PrefetchedOrganizations } from './components/PrefetchedOrganizations';
99
import { PlatformPresenceMount } from './components/PlatformPresenceMount';
10+
import { MiniMaxCodingPlansBanner } from '@/components/shared/MiniMaxCodingPlansBanner';
1011

1112
export default function AppLayout({ children }: { children: React.ReactNode }) {
1213
return (
@@ -20,6 +21,7 @@ export default function AppLayout({ children }: { children: React.ReactNode }) {
2021
<AppSidebar />
2122
<SidebarInset>
2223
<AppTopbar />
24+
<MiniMaxCodingPlansBanner />
2325
<main className="bg-background w-full flex-1">{children}</main>
2426
</SidebarInset>
2527
</div>
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
'use client';
2+
3+
import { useState, useEffect } from 'react';
4+
import { Megaphone, X } from 'lucide-react';
5+
import { Banner } from '@/components/shared/Banner';
6+
import { Button } from '@/components/ui/button';
7+
8+
const DISMISS_KEY = 'minimax-coding-plans-banner-dismissed';
9+
10+
export function MiniMaxCodingPlansBanner() {
11+
// Start as dismissed to avoid a flash before localStorage is read
12+
const [dismissed, setDismissed] = useState(true);
13+
14+
useEffect(() => {
15+
setDismissed(localStorage.getItem(DISMISS_KEY) === 'true');
16+
}, []);
17+
18+
if (dismissed) return null;
19+
20+
function handleDismiss() {
21+
localStorage.setItem(DISMISS_KEY, 'true');
22+
setDismissed(true);
23+
}
24+
25+
return (
26+
<Banner color="blue" role="banner" className="rounded-none border-x-0 border-t-0">
27+
<Banner.Icon>
28+
<Megaphone />
29+
</Banner.Icon>
30+
<Banner.Content>
31+
<Banner.Title>New! Purchase MiniMax token plans with your Kilo Credits.</Banner.Title>
32+
</Banner.Content>
33+
<Banner.Action>
34+
<Banner.Button href="/subscriptions#coding-plans">Learn more</Banner.Button>
35+
</Banner.Action>
36+
<Button
37+
variant="ghost"
38+
size="icon"
39+
onClick={handleDismiss}
40+
aria-label="Dismiss announcement"
41+
className="h-6 w-6 shrink-0 text-blue-400 hover:bg-blue-500/20 hover:text-blue-300"
42+
>
43+
<X className="h-4 w-4" />
44+
</Button>
45+
</Banner>
46+
);
47+
}

0 commit comments

Comments
 (0)