Initial commit
This commit is contained in:
12
apps/web-next/src/app/about/page.tsx
Normal file
12
apps/web-next/src/app/about/page.tsx
Normal file
@@ -0,0 +1,12 @@
|
||||
import { PageContent } from "@repo/marketing-pages/ui";
|
||||
import { bindAll } from "../../server/bind-production";
|
||||
|
||||
export default async function AboutPage() {
|
||||
await bindAll();
|
||||
|
||||
return (
|
||||
<main className="px-6 py-8">
|
||||
<PageContent slug="about" />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
13
apps/web-next/src/app/api/trpc/[trpc]/route.ts
Normal file
13
apps/web-next/src/app/api/trpc/[trpc]/route.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { fetchRequestHandler } from "@trpc/server/adapters/fetch";
|
||||
import { appRouter } from "@repo/core-api";
|
||||
|
||||
const handler = async (req: Request) => {
|
||||
return fetchRequestHandler({
|
||||
endpoint: "/api/trpc",
|
||||
req,
|
||||
router: appRouter,
|
||||
createContext: () => ({}),
|
||||
});
|
||||
};
|
||||
|
||||
export { handler as GET, handler as POST };
|
||||
17
apps/web-next/src/app/blog/[slug]/page.tsx
Normal file
17
apps/web-next/src/app/blog/[slug]/page.tsx
Normal file
@@ -0,0 +1,17 @@
|
||||
import { ArticleDetail } from "@repo/blog/ui";
|
||||
import { bindAll } from "../../../server/bind-production";
|
||||
|
||||
type PageProps = {
|
||||
params: Promise<{ slug: string }>;
|
||||
};
|
||||
|
||||
export default async function BlogPostPage({ params }: PageProps) {
|
||||
await bindAll();
|
||||
const { slug } = await params;
|
||||
|
||||
return (
|
||||
<main className="px-6 py-8">
|
||||
<ArticleDetail slug={slug} />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
31
apps/web-next/src/app/layout.tsx
Normal file
31
apps/web-next/src/app/layout.tsx
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { Metadata } from "next";
|
||||
import "../styles/app.css";
|
||||
import { getNonce } from "@repo/core-shared/security/next";
|
||||
import { bindAll } from "../server/bind-production";
|
||||
import { Providers } from "./providers";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "Template — Next.js",
|
||||
description: "Clean Architecture Monorepo Template",
|
||||
};
|
||||
|
||||
export default async function RootLayout({
|
||||
children,
|
||||
}: {
|
||||
children: React.ReactNode;
|
||||
}) {
|
||||
await bindAll();
|
||||
const nonce = await getNonce();
|
||||
|
||||
return (
|
||||
<html lang="en">
|
||||
<head>
|
||||
{/* nonce exposed to client so instrumentation-client.ts can read it */}
|
||||
<meta name="csp-nonce" content={nonce} />
|
||||
</head>
|
||||
<body>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
}
|
||||
15
apps/web-next/src/app/page.tsx
Normal file
15
apps/web-next/src/app/page.tsx
Normal file
@@ -0,0 +1,15 @@
|
||||
import { ArticleList } from "@repo/blog/ui";
|
||||
import { bindAll } from "../server/bind-production";
|
||||
|
||||
export default async function Home() {
|
||||
await bindAll();
|
||||
|
||||
return (
|
||||
<main className="mx-auto max-w-5xl px-6 py-8">
|
||||
<h2 className="mb-4 text-2xl font-bold text-foreground">
|
||||
Latest articles
|
||||
</h2>
|
||||
<ArticleList />
|
||||
</main>
|
||||
);
|
||||
}
|
||||
14
apps/web-next/src/app/providers.test.tsx
Normal file
14
apps/web-next/src/app/providers.test.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { Providers } from "./providers";
|
||||
|
||||
describe("Providers", () => {
|
||||
it("renders children", () => {
|
||||
render(
|
||||
<Providers>
|
||||
<div data-testid="child">hi</div>
|
||||
</Providers>,
|
||||
);
|
||||
expect(screen.getByTestId("child")).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
7
apps/web-next/src/app/providers.tsx
Normal file
7
apps/web-next/src/app/providers.tsx
Normal file
@@ -0,0 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { NextTrpcProvider } from "@repo/core-trpc/next";
|
||||
|
||||
export function Providers({ children }: { children: React.ReactNode }) {
|
||||
return <NextTrpcProvider>{children}</NextTrpcProvider>;
|
||||
}
|
||||
Reference in New Issue
Block a user