Initial commit
This commit is contained in:
4
apps/admin/next-env.d.ts
vendored
Normal file
4
apps/admin/next-env.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited.
|
||||
7
apps/admin/next.config.ts
Normal file
7
apps/admin/next.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { NextConfig } from "next"
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
transpilePackages: ["@cms/ui", "@cms/content", "@cms/db"],
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
36
apps/admin/package.json
Normal file
36
apps/admin/package.json
Normal file
@ -0,0 +1,36 @@
|
||||
{
|
||||
"name": "@cms/admin",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --port 3001",
|
||||
"build": "next build",
|
||||
"start": "next start --port 3001",
|
||||
"lint": "biome check src",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cms/content": "workspace:*",
|
||||
"@cms/db": "workspace:*",
|
||||
"@cms/ui": "workspace:*",
|
||||
"@tanstack/react-form": "latest",
|
||||
"@tanstack/react-query": "latest",
|
||||
"@tanstack/react-query-devtools": "latest",
|
||||
"@tanstack/react-table": "latest",
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest",
|
||||
"zustand": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cms/config": "workspace:*",
|
||||
"@biomejs/biome": "latest",
|
||||
"@tailwindcss/postcss": "latest",
|
||||
"@types/node": "latest",
|
||||
"@types/react": "latest",
|
||||
"@types/react-dom": "latest",
|
||||
"tailwindcss": "latest",
|
||||
"typescript": "latest"
|
||||
}
|
||||
}
|
||||
5
apps/admin/postcss.config.mjs
Normal file
5
apps/admin/postcss.config.mjs
Normal file
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
}
|
||||
12
apps/admin/src/app/globals.css
Normal file
12
apps/admin/src/app/globals.css
Normal file
@ -0,0 +1,12 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #fafafa;
|
||||
--foreground: #111111;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: "Geist", "Segoe UI", sans-serif;
|
||||
}
|
||||
20
apps/admin/src/app/layout.tsx
Normal file
20
apps/admin/src/app/layout.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import type { Metadata } from "next"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import "./globals.css"
|
||||
import { Providers } from "./providers"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "CMS Admin",
|
||||
description: "Admin dashboard for the CMS monorepo",
|
||||
}
|
||||
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
39
apps/admin/src/app/page.tsx
Normal file
39
apps/admin/src/app/page.tsx
Normal file
@ -0,0 +1,39 @@
|
||||
import { listPosts } from "@cms/db"
|
||||
import { Button } from "@cms/ui/button"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function AdminHomePage() {
|
||||
const posts = await listPosts()
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex min-h-screen w-full max-w-4xl flex-col gap-8 px-6 py-16">
|
||||
<header className="space-y-3">
|
||||
<p className="text-sm uppercase tracking-[0.2em] text-neutral-500">Admin App</p>
|
||||
<h1 className="text-4xl font-semibold tracking-tight">Content Dashboard</h1>
|
||||
<p className="text-neutral-600">Manage posts from a dedicated admin surface.</p>
|
||||
</header>
|
||||
|
||||
<section className="rounded-xl border border-neutral-200 p-6">
|
||||
<div className="mb-4 flex items-center justify-between">
|
||||
<h2 className="text-xl font-medium">Posts</h2>
|
||||
<Button>Create post</Button>
|
||||
</div>
|
||||
|
||||
<div className="space-y-3">
|
||||
{posts.map((post) => (
|
||||
<article key={post.id} className="rounded-lg border border-neutral-200 p-4">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<h3 className="text-lg font-medium">{post.title}</h3>
|
||||
<span className="rounded-full bg-neutral-100 px-3 py-1 text-xs uppercase tracking-wide">
|
||||
{post.status}
|
||||
</span>
|
||||
</div>
|
||||
<p className="mt-2 text-sm text-neutral-600">{post.slug}</p>
|
||||
</article>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
9
apps/admin/src/app/providers.tsx
Normal file
9
apps/admin/src/app/providers.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
"use client"
|
||||
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import { QueryProvider } from "@/providers/query-provider"
|
||||
|
||||
export function Providers({ children }: { children: ReactNode }) {
|
||||
return <QueryProvider>{children}</QueryProvider>
|
||||
}
|
||||
5
apps/admin/src/lib/query-client.ts
Normal file
5
apps/admin/src/lib/query-client.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { QueryClient } from "@tanstack/react-query"
|
||||
|
||||
export function createQueryClient() {
|
||||
return new QueryClient()
|
||||
}
|
||||
19
apps/admin/src/providers/query-provider.tsx
Normal file
19
apps/admin/src/providers/query-provider.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
"use client"
|
||||
|
||||
import { QueryClientProvider } from "@tanstack/react-query"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import type { ReactNode } from "react"
|
||||
import { useState } from "react"
|
||||
|
||||
import { createQueryClient } from "@/lib/query-client"
|
||||
|
||||
export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
const [queryClient] = useState(() => createQueryClient())
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{children}
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</QueryClientProvider>
|
||||
)
|
||||
}
|
||||
11
apps/admin/src/store/ui.ts
Normal file
11
apps/admin/src/store/ui.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { create } from "zustand"
|
||||
|
||||
type UiStore = {
|
||||
sidebarOpen: boolean
|
||||
setSidebarOpen: (value: boolean) => void
|
||||
}
|
||||
|
||||
export const useUiStore = create<UiStore>((set) => ({
|
||||
sidebarOpen: true,
|
||||
setSidebarOpen: (value) => set({ sidebarOpen: value }),
|
||||
}))
|
||||
11
apps/admin/tsconfig.json
Normal file
11
apps/admin/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "@cms/config/tsconfig/next",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
4
apps/web/next-env.d.ts
vendored
Normal file
4
apps/web/next-env.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NOTE: This file should not be edited.
|
||||
7
apps/web/next.config.ts
Normal file
7
apps/web/next.config.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import type { NextConfig } from "next"
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
transpilePackages: ["@cms/ui", "@cms/content", "@cms/db"],
|
||||
}
|
||||
|
||||
export default nextConfig
|
||||
34
apps/web/package.json
Normal file
34
apps/web/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "@cms/web",
|
||||
"version": "0.0.1",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev --port 3000",
|
||||
"build": "next build",
|
||||
"start": "next start --port 3000",
|
||||
"lint": "biome check src",
|
||||
"typecheck": "tsc -p tsconfig.json --noEmit"
|
||||
},
|
||||
"dependencies": {
|
||||
"@cms/content": "workspace:*",
|
||||
"@cms/db": "workspace:*",
|
||||
"@cms/ui": "workspace:*",
|
||||
"@tanstack/react-query": "latest",
|
||||
"@tanstack/react-query-devtools": "latest",
|
||||
"next": "latest",
|
||||
"react": "latest",
|
||||
"react-dom": "latest",
|
||||
"zustand": "latest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@cms/config": "workspace:*",
|
||||
"@biomejs/biome": "latest",
|
||||
"@tailwindcss/postcss": "latest",
|
||||
"@types/node": "latest",
|
||||
"@types/react": "latest",
|
||||
"@types/react-dom": "latest",
|
||||
"tailwindcss": "latest",
|
||||
"typescript": "latest"
|
||||
}
|
||||
}
|
||||
5
apps/web/postcss.config.mjs
Normal file
5
apps/web/postcss.config.mjs
Normal file
@ -0,0 +1,5 @@
|
||||
export default {
|
||||
plugins: {
|
||||
"@tailwindcss/postcss": {},
|
||||
},
|
||||
}
|
||||
12
apps/web/src/app/globals.css
Normal file
12
apps/web/src/app/globals.css
Normal file
@ -0,0 +1,12 @@
|
||||
@import "tailwindcss";
|
||||
|
||||
:root {
|
||||
--background: #ffffff;
|
||||
--foreground: #171717;
|
||||
}
|
||||
|
||||
body {
|
||||
background: var(--background);
|
||||
color: var(--foreground);
|
||||
font-family: "Geist", "Segoe UI", sans-serif;
|
||||
}
|
||||
20
apps/web/src/app/layout.tsx
Normal file
20
apps/web/src/app/layout.tsx
Normal file
@ -0,0 +1,20 @@
|
||||
import type { Metadata } from "next"
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import "./globals.css"
|
||||
import { Providers } from "./providers"
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: "CMS Web",
|
||||
description: "Public frontend for the CMS monorepo",
|
||||
}
|
||||
|
||||
export default function RootLayout({ children }: { children: ReactNode }) {
|
||||
return (
|
||||
<html lang="en">
|
||||
<body>
|
||||
<Providers>{children}</Providers>
|
||||
</body>
|
||||
</html>
|
||||
)
|
||||
}
|
||||
37
apps/web/src/app/page.tsx
Normal file
37
apps/web/src/app/page.tsx
Normal file
@ -0,0 +1,37 @@
|
||||
import { listPosts } from "@cms/db"
|
||||
import { Button } from "@cms/ui/button"
|
||||
|
||||
export const dynamic = "force-dynamic"
|
||||
|
||||
export default async function HomePage() {
|
||||
const posts = await listPosts()
|
||||
|
||||
return (
|
||||
<main className="mx-auto flex min-h-screen w-full max-w-3xl flex-col gap-6 px-6 py-16">
|
||||
<header className="space-y-3">
|
||||
<p className="text-sm uppercase tracking-[0.2em] text-neutral-500">Web App</p>
|
||||
<h1 className="text-4xl font-semibold tracking-tight">Your Next.js CMS Frontend</h1>
|
||||
<p className="text-neutral-600">
|
||||
This page reads posts through the shared database package.
|
||||
</p>
|
||||
</header>
|
||||
|
||||
<section className="space-y-4 rounded-xl border border-neutral-200 p-6">
|
||||
<div className="flex items-center justify-between">
|
||||
<h2 className="text-xl font-medium">Latest posts</h2>
|
||||
<Button variant="secondary">Explore</Button>
|
||||
</div>
|
||||
|
||||
<ul className="space-y-3">
|
||||
{posts.map((post) => (
|
||||
<li key={post.id} className="rounded-lg border border-neutral-200 p-4">
|
||||
<p className="text-xs uppercase tracking-wide text-neutral-500">{post.status}</p>
|
||||
<h3 className="mt-1 text-lg font-medium">{post.title}</h3>
|
||||
<p className="mt-2 text-sm text-neutral-600">{post.excerpt ?? "No excerpt"}</p>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</section>
|
||||
</main>
|
||||
)
|
||||
}
|
||||
9
apps/web/src/app/providers.tsx
Normal file
9
apps/web/src/app/providers.tsx
Normal file
@ -0,0 +1,9 @@
|
||||
"use client"
|
||||
|
||||
import type { ReactNode } from "react"
|
||||
|
||||
import { QueryProvider } from "@/providers/query-provider"
|
||||
|
||||
export function Providers({ children }: { children: ReactNode }) {
|
||||
return <QueryProvider>{children}</QueryProvider>
|
||||
}
|
||||
5
apps/web/src/lib/query-client.ts
Normal file
5
apps/web/src/lib/query-client.ts
Normal file
@ -0,0 +1,5 @@
|
||||
import { QueryClient } from "@tanstack/react-query"
|
||||
|
||||
export function createQueryClient() {
|
||||
return new QueryClient()
|
||||
}
|
||||
19
apps/web/src/providers/query-provider.tsx
Normal file
19
apps/web/src/providers/query-provider.tsx
Normal file
@ -0,0 +1,19 @@
|
||||
"use client"
|
||||
|
||||
import { QueryClientProvider } from "@tanstack/react-query"
|
||||
import { ReactQueryDevtools } from "@tanstack/react-query-devtools"
|
||||
import type { ReactNode } from "react"
|
||||
import { useState } from "react"
|
||||
|
||||
import { createQueryClient } from "@/lib/query-client"
|
||||
|
||||
export function QueryProvider({ children }: { children: ReactNode }) {
|
||||
const [queryClient] = useState(() => createQueryClient())
|
||||
|
||||
return (
|
||||
<QueryClientProvider client={queryClient}>
|
||||
{children}
|
||||
<ReactQueryDevtools initialIsOpen={false} />
|
||||
</QueryClientProvider>
|
||||
)
|
||||
}
|
||||
11
apps/web/src/store/ui.ts
Normal file
11
apps/web/src/store/ui.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { create } from "zustand"
|
||||
|
||||
type UiStore = {
|
||||
mobileMenuOpen: boolean
|
||||
setMobileMenuOpen: (value: boolean) => void
|
||||
}
|
||||
|
||||
export const useUiStore = create<UiStore>((set) => ({
|
||||
mobileMenuOpen: false,
|
||||
setMobileMenuOpen: (value) => set({ mobileMenuOpen: value }),
|
||||
}))
|
||||
11
apps/web/tsconfig.json
Normal file
11
apps/web/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "@cms/config/tsconfig/next",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@/*": ["./src/*"]
|
||||
}
|
||||
},
|
||||
"include": ["next-env.d.ts", "src/**/*.ts", "src/**/*.tsx", ".next/types/**/*.ts"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
Reference in New Issue
Block a user