Skip to content

Commit 466614f

Browse files
Merge pull request #55 from hack4impact/feat/10-service-tab-actions-2
Feat/10 service tab actions 2
2 parents dea57dd + a7e4037 commit 466614f

32 files changed

Lines changed: 4792 additions & 109 deletions

.github/workflows/ci.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
- uses: pnpm/action-setup@v4
19+
1820
- uses: actions/setup-node@v4
1921
with:
2022
node-version: "25"
21-
cache: npm
23+
cache: pnpm
2224

2325
- name: Install dependencies
24-
run: npm ci
26+
run: pnpm install --frozen-lockfile
2527

2628
- name: Lint
27-
run: npm run lint
29+
run: pnpm lint
2830

2931
- name: Unit tests
30-
run: npm run test:ci
32+
run: pnpm test:ci

__tests__/sanity.test.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
import { render, screen } from "@testing-library/react";
2-
import DashboardPage from "@/app/(authenticated)/dashboard/page";
2+
import { TestComponent } from "./test-component";
33

44
describe("jest setup", () => {
5-
it("runs React + Testing Library", async () => {
6-
const jsx = await DashboardPage();
7-
render(jsx);
8-
expect(screen.getByText("You are admin")).toBeInTheDocument();
9-
});
5+
it("runs React + Testing Library", () => {
6+
render(<TestComponent />);
7+
expect(screen.getByText("ok")).toBeInTheDocument();
8+
});
109
});

__tests__/test-component.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export function TestComponent() {
2+
return <div>ok</div>;
3+
}

app/(authenticated)/checkout/success/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
1+
import { Suspense } from "react";
12
import { redirect } from "next/navigation";
23
import { createClient } from "@/utils/supabase/server";
34
import { syncStripeData } from "@/lib/stripe";
45
import { db } from "@/lib/db";
56
import { profiles } from "@/lib/db/schema";
67
import { eq } from "drizzle-orm";
78

8-
export default async function CheckoutSuccessPage() {
9+
export default function CheckoutSuccessPage() {
10+
return (
11+
<Suspense>
12+
<SyncAndRedirect />
13+
</Suspense>
14+
);
15+
}
16+
17+
async function SyncAndRedirect(): Promise<never> {
918
const supabase = await createClient();
1019
const {
1120
data: { user },

app/(authenticated)/dashboard/page.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/(authenticated)/layout.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
1+
import { Suspense } from "react";
12
import { redirect } from "next/navigation";
23
import { createClient } from "@/utils/supabase/server";
34
import { SidebarInset, SidebarProvider } from "@/components/ui/sidebar";
45
import { TooltipProvider } from "@/components/ui/tooltip";
56
import { AppSidebar } from "@/components/app-sidebar";
67

7-
export default async function AuthenticatedLayout({
8-
children,
9-
}: {
10-
children: React.ReactNode;
11-
}) {
8+
async function AuthGate({ children }: { children: React.ReactNode }) {
129
const supabase = await createClient();
1310
const {
1411
data: { user },
@@ -18,13 +15,23 @@ export default async function AuthenticatedLayout({
1815
redirect("/login");
1916
}
2017

18+
return <>{children}</>;
19+
}
20+
21+
export default function AuthenticatedLayout({
22+
children,
23+
}: {
24+
children: React.ReactNode;
25+
}) {
2126
return (
2227
<TooltipProvider>
2328
<SidebarProvider>
2429
<AppSidebar />
2530
<SidebarInset>
2631
<div className="flex flex-1 flex-col gap-4 p-4">
27-
{children}
32+
<Suspense fallback={null}>
33+
<AuthGate>{children}</AuthGate>
34+
</Suspense>
2835
</div>
2936
</SidebarInset>
3037
</SidebarProvider>

app/(authenticated)/page.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { Suspense } from "react";
12
import { createClient } from "@/utils/supabase/server";
23
import { signout } from "@/app/login/actions";
34
import { getSubscriptionDetails } from "@/lib/stripe";
@@ -14,7 +15,15 @@ import { CheckoutButton } from "@/components/subscribe-button";
1415
const SUBSCRIPTION_PRICE_ID = process.env.STRIPE_PRICE_ID!;
1516
const PRODUCT_PRICE_ID = process.env.STRIPE_PRODUCT_PRICE_ID!;
1617

17-
export default async function Page() {
18+
export default function Page() {
19+
return (
20+
<Suspense>
21+
<HomeContent />
22+
</Suspense>
23+
);
24+
}
25+
26+
async function HomeContent() {
1827
const supabase = await createClient();
1928
const {
2029
data: { user },

0 commit comments

Comments
 (0)