Skip to content

Commit 0700b7c

Browse files
committed
Add billing modal
1 parent 73fbbbb commit 0700b7c

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Modal } from "@heroui/react";
2+
import { HugeiconsIcon } from "@hugeicons/react";
3+
import { CreditCardIcon } from "@hugeicons/core-free-icons";
4+
import { useAuthStore } from "@/stores/auth";
5+
import { planLabel, PLANS } from "@livedot/shared/plans";
6+
7+
interface Props {
8+
isOpen: boolean;
9+
onOpenChange: (open: boolean) => void;
10+
}
11+
12+
export default function BillingModal({ isOpen, onOpenChange }: Props) {
13+
const { user } = useAuthStore();
14+
const plan = user?.plan ?? "free";
15+
16+
return (
17+
<Modal isOpen={isOpen} onOpenChange={onOpenChange}>
18+
<Modal.Backdrop>
19+
<Modal.Container>
20+
<Modal.Dialog className="sm:max-w-[400px]">
21+
<Modal.CloseTrigger />
22+
<Modal.Header>
23+
<Modal.Icon className="bg-default text-foreground">
24+
<HugeiconsIcon icon={CreditCardIcon} size={20} />
25+
</Modal.Icon>
26+
<Modal.Heading>Billing</Modal.Heading>
27+
</Modal.Header>
28+
<Modal.Body>
29+
<div className="flex flex-col items-center text-center py-4 gap-3">
30+
<span className="text-xs font-medium uppercase tracking-wider px-2 py-0.5 rounded-md bg-white/[0.06] border border-white/[0.08] text-muted">
31+
{planLabel(plan)}
32+
</span>
33+
<p className="text-sm text-muted">
34+
Plan upgrades and billing management are coming soon.
35+
</p>
36+
</div>
37+
</Modal.Body>
38+
</Modal.Dialog>
39+
</Modal.Container>
40+
</Modal.Backdrop>
41+
</Modal>
42+
);
43+
}

apps/web/src/components/layout/Navbar.tsx

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@ import {
77
Settings01Icon,
88
UserIcon,
99
HelpCircleIcon,
10+
CreditCardIcon,
1011
Github,
1112
} from "@hugeicons/core-free-icons";
1213
import { useAuthStore } from "@/stores/auth";
1314
import { planLabel } from "@livedot/shared/plans";
1415
import ProfileModal from "./ProfileModal";
16+
import BillingModal from "./BillingModal";
1517

1618
function getInitials(username: string) {
1719
return username.slice(0, 2).toUpperCase();
@@ -21,6 +23,7 @@ export default function Navbar() {
2123
const navigate = useNavigate();
2224
const { user, logout } = useAuthStore();
2325
const [profileOpen, setProfileOpen] = useState(false);
26+
const [billingOpen, setBillingOpen] = useState(false);
2427

2528
return (
2629
<>
@@ -69,6 +72,7 @@ export default function Navbar() {
6972
<Dropdown.Menu
7073
onAction={async (key) => {
7174
if (key === "profile") setProfileOpen(true);
75+
if (key === "billing") setBillingOpen(true);
7276
if (key === "logout") {
7377
await logout();
7478
navigate({ to: "/auth/login" });
@@ -80,6 +84,12 @@ export default function Navbar() {
8084
<HugeiconsIcon icon={UserIcon} size={16} />
8185
My Account
8286
</Dropdown.Item>
87+
{user?.plan !== "ce" && (
88+
<Dropdown.Item id="billing" textValue="Billing">
89+
<HugeiconsIcon icon={CreditCardIcon} size={16} />
90+
Billing
91+
</Dropdown.Item>
92+
)}
8393
<Dropdown.Item id="settings" textValue="Settings">
8494
<HugeiconsIcon icon={Settings01Icon} size={16} />
8595
Settings
@@ -104,6 +114,7 @@ export default function Navbar() {
104114
</nav>
105115

106116
<ProfileModal isOpen={profileOpen} onOpenChange={setProfileOpen} />
117+
<BillingModal isOpen={billingOpen} onOpenChange={setBillingOpen} />
107118
</>
108119
);
109120
}

0 commit comments

Comments
 (0)