Skip to content

Commit 514647c

Browse files
committed
Add Billing alerts on /connect layout in app router (#4892)
## Problem solved Short description of the bug fixed or feature added <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on enhancing the `BillingAlerts` component by allowing it to accept a `className` prop for better styling flexibility. It also updates the usage of `BillingAlerts` in various components to apply specific padding classes. ### Detailed summary - Modified `BillingAlerts` to accept an optional `className` prop. - Updated the `BillingAlerts` usage in `apps/dashboard/src/components/layout/app-shell/index.tsx` to include `className="py-6"`. - Updated `BillingAlerts` usage in `apps/dashboard/src/app/(dashboard)/dashboard/connect/layout.tsx` to include `className="pb-6"`. - Adjusted the rendering of `BillingAlertsUI` to apply the `className` prop. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent eb8638e commit 514647c

File tree

4 files changed

+19
-4
lines changed

4 files changed

+19
-4
lines changed

apps/dashboard/src/@3rdweb-sdk/react/hooks/useLoggedInUser.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use client";
2+
13
import { isLoginRequired } from "@/constants/auth";
24
import { useDashboardRouter } from "@/lib/DashboardRouter";
35
import { useQuery } from "@tanstack/react-query";
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,13 @@
1+
import { BillingAlerts } from "../../../../components/settings/Account/Billing/alerts/Alert";
12
import { ConnectSidebarLayout } from "./DashboardConnectLayout";
23

34
export default function Layout(props: {
45
children: React.ReactNode;
56
}) {
6-
return <ConnectSidebarLayout>{props.children}</ConnectSidebarLayout>;
7+
return (
8+
<ConnectSidebarLayout>
9+
<BillingAlerts className="pb-6" />
10+
{props.children}
11+
</ConnectSidebarLayout>
12+
);
713
}

apps/dashboard/src/components/layout/app-shell/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const AppShell: ComponentWithChildren<AppShellProps> = ({
2626
className={cn("min-h-screen py-6 md:pt-10 md:pb-20", mainClassName)}
2727
>
2828
<Container maxW="container.page">
29-
<BillingAlerts />
29+
<BillingAlerts className="py-6" />
3030
</Container>
3131

3232
{layout === "custom-contract" ? (

apps/dashboard/src/components/settings/Account/Billing/alerts/Alert.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
44
import { Button } from "@/components/ui/button";
55
import { TrackedLinkTW } from "@/components/ui/tracked-link";
6+
import { cn } from "@/lib/utils";
67
import {
78
type Account,
89
AccountStatus,
@@ -36,7 +37,9 @@ type AlertConditionType = {
3637
| "usage";
3738
};
3839

39-
export const BillingAlerts = () => {
40+
export const BillingAlerts = (props: {
41+
className?: string;
42+
}) => {
4043
const pathname = usePathname();
4144
const { isLoggedIn } = useLoggedInUser();
4245
const usageQuery = useAccountUsage();
@@ -64,13 +67,15 @@ export const BillingAlerts = () => {
6467
<BillingAlertsUI
6568
usageData={usageQuery.data}
6669
dashboardAccount={meQuery.data}
70+
className={props.className}
6771
/>
6872
);
6973
};
7074

7175
export function BillingAlertsUI(props: {
7276
usageData: UsageBillableByService;
7377
dashboardAccount: Account;
78+
className?: string;
7479
}) {
7580
const { usageData, dashboardAccount } = props;
7681
const trackEvent = useTrack();
@@ -295,7 +300,9 @@ export function BillingAlertsUI(props: {
295300
return null;
296301
}
297302

298-
return <div className="flex flex-col gap-4 py-6">{alerts}</div>;
303+
return (
304+
<div className={cn("flex flex-col gap-4", props.className)}>{alerts}</div>
305+
);
299306
}
300307

301308
type AddPaymentNotificationProps = {

0 commit comments

Comments
 (0)