@arch-cadre/blog-module 1.0.10 → 1.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/index.d.ts +1 -1
- package/dist/actions/index.js +2 -2
- package/dist/components/BlogStatsWidget.js +1 -1
- package/dist/components/RecentCommentsWidget.js +1 -1
- package/dist/components/RecentPostsWidget.js +1 -1
- package/dist/components/ui/button.js +1 -1
- package/dist/components/ui/card.js +1 -1
- package/dist/components/ui/input.js +1 -1
- package/dist/components/ui/table.js +1 -1
- package/dist/components/ui/textarea.js +1 -1
- package/dist/index.js +5 -5
- package/dist/routes.js +2 -2
- package/dist/ui/views.js +7 -7
- package/package.json +5 -5
- package/src/actions/index.ts +2 -2
- package/src/components/BlogStatsWidget.tsx +1 -1
- package/src/components/RecentCommentsWidget.tsx +1 -1
- package/src/components/RecentPostsWidget.tsx +1 -1
- package/src/components/ui/button.js +37 -23
- package/src/components/ui/button.tsx +1 -1
- package/src/components/ui/card.js +30 -6
- package/src/components/ui/card.tsx +1 -1
- package/src/components/ui/input.js +12 -3
- package/src/components/ui/input.tsx +1 -1
- package/src/components/ui/table.js +57 -8
- package/src/components/ui/table.tsx +1 -1
- package/src/components/ui/textarea.js +11 -3
- package/src/components/ui/textarea.tsx +1 -1
- package/src/index.ts +5 -5
- package/src/routes.tsx +2 -2
- package/src/ui/views.tsx +7 -7
package/dist/actions/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { z } from "zod";
|
|
2
|
-
import { commentSchema, postSchema } from "../lib/validation
|
|
2
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
3
3
|
export declare function createPost(data: z.infer<typeof postSchema>): Promise<{
|
|
4
4
|
success: boolean;
|
|
5
5
|
error?: undefined;
|
package/dist/actions/index.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { db, getCurrentSession, userTable } from "@arch-cadre/core/server";
|
|
3
3
|
import { desc, eq } from "drizzle-orm";
|
|
4
4
|
import { revalidatePath } from "next/cache";
|
|
5
|
-
import { commentSchema, postSchema } from "../lib/validation
|
|
6
|
-
import { commentsTable, postsTable } from "../schema
|
|
5
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
6
|
+
import { commentsTable, postsTable } from "../schema";
|
|
7
7
|
// --- Posts ---
|
|
8
8
|
export async function createPost(data) {
|
|
9
9
|
try {
|
|
@@ -4,7 +4,7 @@ import { getTranslation } from "@arch-cadre/intl/server";
|
|
|
4
4
|
import { Card, CardContent, CardHeader, CardTitle } from "@arch-cadre/ui";
|
|
5
5
|
import { sql } from "drizzle-orm";
|
|
6
6
|
import { FileText, MessageSquare } from "lucide-react";
|
|
7
|
-
import { commentsTable, postsTable } from "../schema
|
|
7
|
+
import { commentsTable, postsTable } from "../schema";
|
|
8
8
|
export default async function BlogStatsWidget() {
|
|
9
9
|
const { t } = await getTranslation();
|
|
10
10
|
const [postsCount] = await db
|
|
@@ -3,7 +3,7 @@ import { db, userTable } from "@arch-cadre/core/server";
|
|
|
3
3
|
import { getTranslation } from "@arch-cadre/intl/server";
|
|
4
4
|
import { Avatar, AvatarFallback, AvatarImage, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@arch-cadre/ui";
|
|
5
5
|
import { desc, eq } from "drizzle-orm";
|
|
6
|
-
import { commentsTable } from "../schema
|
|
6
|
+
import { commentsTable } from "../schema";
|
|
7
7
|
export default async function RecentCommentsWidget() {
|
|
8
8
|
const { t } = await getTranslation();
|
|
9
9
|
const comments = await db
|
|
@@ -3,7 +3,7 @@ import { db, userTable } from "@arch-cadre/core/server";
|
|
|
3
3
|
import { getTranslation } from "@arch-cadre/intl/server";
|
|
4
4
|
import { Avatar, AvatarFallback, AvatarImage, Card, CardContent, CardDescription, CardHeader, CardTitle, } from "@arch-cadre/ui";
|
|
5
5
|
import { desc, eq } from "drizzle-orm";
|
|
6
|
-
import { postsTable } from "../schema
|
|
6
|
+
import { postsTable } from "../schema";
|
|
7
7
|
export default async function RecentPostsWidget() {
|
|
8
8
|
const { t } = await getTranslation();
|
|
9
9
|
const posts = await db
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
3
|
import { cva } from "class-variance-authority";
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import { cn } from "../../lib/utils
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
6
|
const buttonVariants = cva("inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50", {
|
|
7
7
|
variants: {
|
|
8
8
|
variant: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cn } from "../../lib/utils
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
4
|
const Card = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("rounded-xl border bg-card text-card-foreground shadow", className), ...props })));
|
|
5
5
|
Card.displayName = "Card";
|
|
6
6
|
const CardHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { ref: ref, className: cn("flex flex-col space-y-1.5 p-6", className), ...props })));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cn } from "../../lib/utils
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
4
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
5
5
|
return (_jsx("input", { type: type, className: cn("flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
|
|
6
6
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cn } from "../../lib/utils
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
4
|
const Table = React.forwardRef(({ className, ...props }, ref) => (_jsx("div", { className: "relative w-full overflow-auto", children: _jsx("table", { ref: ref, className: cn("w-full caption-bottom text-sm", className), ...props }) })));
|
|
5
5
|
Table.displayName = "Table";
|
|
6
6
|
const TableHeader = React.forwardRef(({ className, ...props }, ref) => (_jsx("thead", { ref: ref, className: cn("[&_tr]:border-b", className), ...props })));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
|
-
import { cn } from "../../lib/utils
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
4
|
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
5
5
|
return (_jsx("textarea", { className: cn("flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50", className), ref: ref, ...props }));
|
|
6
6
|
});
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { assignPermissionToRole, createPermission, db, getRoles, permissionsTable, } from "@arch-cadre/core/server";
|
|
2
2
|
import { inArray, sql } from "drizzle-orm";
|
|
3
3
|
import manifest from "../manifest.json" with { type: "json" };
|
|
4
|
-
import BlogStatsWidget from "./components/BlogStatsWidget
|
|
5
|
-
import RecentCommentsWidget from "./components/RecentCommentsWidget
|
|
6
|
-
import RecentPostsWidget from "./components/RecentPostsWidget
|
|
7
|
-
import { navigation } from "./navigation
|
|
8
|
-
import { privateRoutes, publicRoutes } from "./routes
|
|
4
|
+
import BlogStatsWidget from "./components/BlogStatsWidget";
|
|
5
|
+
import RecentCommentsWidget from "./components/RecentCommentsWidget";
|
|
6
|
+
import RecentPostsWidget from "./components/RecentPostsWidget";
|
|
7
|
+
import { navigation } from "./navigation";
|
|
8
|
+
import { privateRoutes, publicRoutes } from "./routes";
|
|
9
9
|
const BLOG_PERMISSIONS = [
|
|
10
10
|
{ name: "post:create", description: "Allow creating blog posts" },
|
|
11
11
|
{ name: "post:update", description: "Allow updating blog posts" },
|
package/dist/routes.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getCurrentSession } from "@arch-cadre/core/server";
|
|
3
|
-
import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index
|
|
4
|
-
import { BlogAdminPage, BlogListPage, CreatePostForm, EditPostForm, PostDetailPage, } from "./ui/views
|
|
3
|
+
import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index";
|
|
4
|
+
import { BlogAdminPage, BlogListPage, CreatePostForm, EditPostForm, PostDetailPage, } from "./ui/views";
|
|
5
5
|
export const publicRoutes = [
|
|
6
6
|
{
|
|
7
7
|
path: "/blog",
|
package/dist/ui/views.js
CHANGED
|
@@ -8,13 +8,13 @@ import Link from "next/link";
|
|
|
8
8
|
import { useRouter } from "next/navigation";
|
|
9
9
|
import { useForm } from "react-hook-form";
|
|
10
10
|
import { toast } from "sonner";
|
|
11
|
-
import { createComment, createPost, deletePost, updatePost } from "../actions/index
|
|
12
|
-
import { Button } from "../components/ui/button
|
|
13
|
-
import { Card, CardContent, CardHeader, CardTitle, } from "../components/ui/card
|
|
14
|
-
import { Input } from "../components/ui/input
|
|
15
|
-
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../components/ui/table
|
|
16
|
-
import { Textarea } from "../components/ui/textarea
|
|
17
|
-
import { commentSchema, postSchema } from "../lib/validation
|
|
11
|
+
import { createComment, createPost, deletePost, updatePost } from "../actions/index";
|
|
12
|
+
import { Button } from "../components/ui/button";
|
|
13
|
+
import { Card, CardContent, CardHeader, CardTitle, } from "../components/ui/card";
|
|
14
|
+
import { Input } from "../components/ui/input";
|
|
15
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "../components/ui/table";
|
|
16
|
+
import { Textarea } from "../components/ui/textarea";
|
|
17
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
18
18
|
export function BlogListPage({ posts = [] }) {
|
|
19
19
|
const { t } = useTranslation();
|
|
20
20
|
return (_jsxs("div", { className: "max-w-4xl mx-auto p-6 space-y-8", children: [_jsxs("header", { className: "border-b pb-6", children: [_jsx("h1", { className: "text-4xl font-black tracking-tighter text-primary", children: t("Blog Posts") }), _jsx("p", { className: "text-muted-foreground mt-2", children: t("Reading your blog posts") })] }), _jsx("div", { className: "grid gap-6", children: posts.map((post) => (_jsx(Link, { href: `/blog/${post.slug}`, children: _jsxs(Card, { className: "group hover:shadow-lg transition-all cursor-pointer overflow-hidden border-primary/5", children: [_jsxs(CardHeader, { children: [_jsx(CardTitle, { className: "text-2xl group-hover:text-primary transition-colors", children: post.title }), _jsxs("div", { className: "flex items-center gap-2 text-xs text-muted-foreground mt-1", children: [_jsx(UserIcon, { className: "size-3" }), _jsx("span", { children: post.author?.name }), _jsx("span", { children: "\u2022" }), _jsx("span", { children: new Date(post.createdAt).toLocaleDateString() })] })] }), _jsx(CardContent, { children: _jsx("p", { className: "text-secondary-foreground line-clamp-2", children: post.content }) })] }) }, post.id))) })] }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arch-cadre/blog-module",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.12",
|
|
4
4
|
"description": "A sample module for Kryo framework",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"build": "pnpm clean && tsc --module esnext"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@arch-cadre/modules": "^0.0.
|
|
27
|
+
"@arch-cadre/modules": "^0.0.81",
|
|
28
28
|
"@hookform/resolvers": "^3.10.0",
|
|
29
29
|
"@radix-ui/react-slot": "^1.2.3",
|
|
30
30
|
"class-variance-authority": "^0.7.1",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"unbuild": "^3.6.1"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@arch-cadre/core": "^0.0.
|
|
51
|
-
"@arch-cadre/intl": "^0.0.
|
|
52
|
-
"@arch-cadre/ui": "^0.0.
|
|
50
|
+
"@arch-cadre/core": "^0.0.55",
|
|
51
|
+
"@arch-cadre/intl": "^0.0.55",
|
|
52
|
+
"@arch-cadre/ui": "^0.0.55",
|
|
53
53
|
"react": "^19.0.0"
|
|
54
54
|
},
|
|
55
55
|
"main": "./dist/index.mjs"
|
package/src/actions/index.ts
CHANGED
|
@@ -4,8 +4,8 @@ import { db, getCurrentSession, userTable } from "@arch-cadre/core/server";
|
|
|
4
4
|
import { desc, eq } from "drizzle-orm";
|
|
5
5
|
import { revalidatePath } from "next/cache";
|
|
6
6
|
import type { z } from "zod";
|
|
7
|
-
import { commentSchema, postSchema } from "../lib/validation
|
|
8
|
-
import { commentsTable, postsTable } from "../schema
|
|
7
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
8
|
+
import { commentsTable, postsTable } from "../schema";
|
|
9
9
|
|
|
10
10
|
// --- Posts ---
|
|
11
11
|
export async function createPost(data: z.infer<typeof postSchema>) {
|
|
@@ -4,7 +4,7 @@ import { Card, CardContent, CardHeader, CardTitle } from "@arch-cadre/ui";
|
|
|
4
4
|
import { sql } from "drizzle-orm";
|
|
5
5
|
import { FileText, MessageSquare } from "lucide-react";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import { commentsTable, postsTable } from "../schema
|
|
7
|
+
import { commentsTable, postsTable } from "../schema";
|
|
8
8
|
|
|
9
9
|
export default async function BlogStatsWidget() {
|
|
10
10
|
const { t } = await getTranslation();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@arch-cadre/ui";
|
|
13
13
|
import { desc, eq } from "drizzle-orm";
|
|
14
14
|
import * as React from "react";
|
|
15
|
-
import { commentsTable } from "../schema
|
|
15
|
+
import { commentsTable } from "../schema";
|
|
16
16
|
|
|
17
17
|
export default async function RecentCommentsWidget() {
|
|
18
18
|
const { t } = await getTranslation();
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "@arch-cadre/ui";
|
|
13
13
|
import { desc, eq } from "drizzle-orm";
|
|
14
14
|
import * as React from "react";
|
|
15
|
-
import { postsTable } from "../schema
|
|
15
|
+
import { postsTable } from "../schema";
|
|
16
16
|
|
|
17
17
|
export default async function RecentPostsWidget() {
|
|
18
18
|
const { t } = await getTranslation();
|
|
@@ -1,33 +1,47 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
3
2
|
import { cva } from "class-variance-authority";
|
|
4
3
|
import * as React from "react";
|
|
5
|
-
import {
|
|
6
|
-
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
import { cn } from "../../lib/utils";
|
|
6
|
+
|
|
7
|
+
const buttonVariants = cva(
|
|
8
|
+
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
9
|
+
{
|
|
7
10
|
variants: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
11
|
+
variant: {
|
|
12
|
+
default:
|
|
13
|
+
"bg-primary text-primary-foreground shadow hover:bg-primary/90",
|
|
14
|
+
destructive:
|
|
15
|
+
"bg-destructive text-destructive-foreground shadow-sm hover:bg-destructive/90",
|
|
16
|
+
outline:
|
|
17
|
+
"border border-input bg-background shadow-sm hover:bg-accent hover:text-accent-foreground",
|
|
18
|
+
secondary:
|
|
19
|
+
"bg-secondary text-secondary-foreground shadow-sm hover:bg-secondary/80",
|
|
20
|
+
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
21
|
+
link: "text-primary underline-offset-4 hover:underline",
|
|
22
|
+
},
|
|
23
|
+
size: {
|
|
24
|
+
default: "h-9 px-4 py-2",
|
|
25
|
+
sm: "h-8 rounded-md px-3 text-xs",
|
|
26
|
+
lg: "h-10 rounded-md px-8",
|
|
27
|
+
icon: "size-9",
|
|
28
|
+
},
|
|
22
29
|
},
|
|
23
30
|
defaultVariants: {
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
variant: "default",
|
|
32
|
+
size: "default",
|
|
26
33
|
},
|
|
27
|
-
}
|
|
28
|
-
|
|
34
|
+
},
|
|
35
|
+
);
|
|
36
|
+
const Button = React.forwardRef(
|
|
37
|
+
({ className, variant, size, asChild = false, ...props }, ref) => {
|
|
29
38
|
const Comp = asChild ? Slot : "button";
|
|
30
|
-
return
|
|
31
|
-
})
|
|
39
|
+
return _jsx(Comp, {
|
|
40
|
+
className: cn(buttonVariants({ variant, size, className })),
|
|
41
|
+
ref: ref,
|
|
42
|
+
...props,
|
|
43
|
+
});
|
|
44
|
+
},
|
|
45
|
+
);
|
|
32
46
|
Button.displayName = "Button";
|
|
33
47
|
export { Button, buttonVariants };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Slot } from "@radix-ui/react-slot";
|
|
2
2
|
import { cva, type VariantProps } from "class-variance-authority";
|
|
3
3
|
import * as React from "react";
|
|
4
|
-
import { cn } from "../../lib/utils
|
|
4
|
+
import { cn } from "../../lib/utils";
|
|
5
5
|
|
|
6
6
|
const buttonVariants = cva(
|
|
7
7
|
"inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50",
|
|
@@ -1,12 +1,36 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Card = React.forwardRef(({ className, ...props }, ref) =>
|
|
6
|
+
_jsx("div", {
|
|
7
|
+
ref: ref,
|
|
8
|
+
className: cn(
|
|
9
|
+
"rounded-xl border bg-card text-card-foreground shadow",
|
|
10
|
+
className,
|
|
11
|
+
),
|
|
12
|
+
...props,
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
5
15
|
Card.displayName = "Card";
|
|
6
|
-
const CardHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
16
|
+
const CardHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
17
|
+
_jsx("div", {
|
|
18
|
+
ref: ref,
|
|
19
|
+
className: cn("flex flex-col space-y-1.5 p-6", className),
|
|
20
|
+
...props,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
7
23
|
CardHeader.displayName = "CardHeader";
|
|
8
|
-
const CardTitle = React.forwardRef(({ className, ...props }, ref) =>
|
|
24
|
+
const CardTitle = React.forwardRef(({ className, ...props }, ref) =>
|
|
25
|
+
_jsx("div", {
|
|
26
|
+
ref: ref,
|
|
27
|
+
className: cn("font-semibold leading-none tracking-tight", className),
|
|
28
|
+
...props,
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
9
31
|
CardTitle.displayName = "CardTitle";
|
|
10
|
-
const CardContent = React.forwardRef(({ className, ...props }, ref) =>
|
|
32
|
+
const CardContent = React.forwardRef(({ className, ...props }, ref) =>
|
|
33
|
+
_jsx("div", { ref: ref, className: cn("p-6 pt-0", className), ...props }),
|
|
34
|
+
);
|
|
11
35
|
CardContent.displayName = "CardContent";
|
|
12
36
|
export { Card, CardHeader, CardTitle, CardContent };
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
4
5
|
const Input = React.forwardRef(({ className, type, ...props }, ref) => {
|
|
5
|
-
|
|
6
|
+
return _jsx("input", {
|
|
7
|
+
type: type,
|
|
8
|
+
className: cn(
|
|
9
|
+
"flex h-9 w-full rounded-md border border-input bg-transparent px-3 py-1 text-sm shadow-sm transition-colors file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
10
|
+
className,
|
|
11
|
+
),
|
|
12
|
+
ref: ref,
|
|
13
|
+
...props,
|
|
14
|
+
});
|
|
6
15
|
});
|
|
7
16
|
Input.displayName = "Input";
|
|
8
17
|
export { Input };
|
|
@@ -1,16 +1,65 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import {
|
|
4
|
-
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
5
|
+
const Table = React.forwardRef(({ className, ...props }, ref) =>
|
|
6
|
+
_jsx("div", {
|
|
7
|
+
className: "relative w-full overflow-auto",
|
|
8
|
+
children: _jsx("table", {
|
|
9
|
+
ref: ref,
|
|
10
|
+
className: cn("w-full caption-bottom text-sm", className),
|
|
11
|
+
...props,
|
|
12
|
+
}),
|
|
13
|
+
}),
|
|
14
|
+
);
|
|
5
15
|
Table.displayName = "Table";
|
|
6
|
-
const TableHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
16
|
+
const TableHeader = React.forwardRef(({ className, ...props }, ref) =>
|
|
17
|
+
_jsx("thead", {
|
|
18
|
+
ref: ref,
|
|
19
|
+
className: cn("[&_tr]:border-b", className),
|
|
20
|
+
...props,
|
|
21
|
+
}),
|
|
22
|
+
);
|
|
7
23
|
TableHeader.displayName = "TableHeader";
|
|
8
|
-
const TableBody = React.forwardRef(({ className, ...props }, ref) =>
|
|
24
|
+
const TableBody = React.forwardRef(({ className, ...props }, ref) =>
|
|
25
|
+
_jsx("tbody", {
|
|
26
|
+
ref: ref,
|
|
27
|
+
className: cn("[&_tr:last-child]:border-0", className),
|
|
28
|
+
...props,
|
|
29
|
+
}),
|
|
30
|
+
);
|
|
9
31
|
TableBody.displayName = "TableBody";
|
|
10
|
-
const TableRow = React.forwardRef(({ className, ...props }, ref) =>
|
|
32
|
+
const TableRow = React.forwardRef(({ className, ...props }, ref) =>
|
|
33
|
+
_jsx("tr", {
|
|
34
|
+
ref: ref,
|
|
35
|
+
className: cn(
|
|
36
|
+
"border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted",
|
|
37
|
+
className,
|
|
38
|
+
),
|
|
39
|
+
...props,
|
|
40
|
+
}),
|
|
41
|
+
);
|
|
11
42
|
TableRow.displayName = "TableRow";
|
|
12
|
-
const TableHead = React.forwardRef(({ className, ...props }, ref) =>
|
|
43
|
+
const TableHead = React.forwardRef(({ className, ...props }, ref) =>
|
|
44
|
+
_jsx("th", {
|
|
45
|
+
ref: ref,
|
|
46
|
+
className: cn(
|
|
47
|
+
"h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
48
|
+
className,
|
|
49
|
+
),
|
|
50
|
+
...props,
|
|
51
|
+
}),
|
|
52
|
+
);
|
|
13
53
|
TableHead.displayName = "TableHead";
|
|
14
|
-
const TableCell = React.forwardRef(({ className, ...props }, ref) =>
|
|
54
|
+
const TableCell = React.forwardRef(({ className, ...props }, ref) =>
|
|
55
|
+
_jsx("td", {
|
|
56
|
+
ref: ref,
|
|
57
|
+
className: cn(
|
|
58
|
+
"p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]",
|
|
59
|
+
className,
|
|
60
|
+
),
|
|
61
|
+
...props,
|
|
62
|
+
}),
|
|
63
|
+
);
|
|
15
64
|
TableCell.displayName = "TableCell";
|
|
16
65
|
export { Table, TableHeader, TableBody, TableHead, TableRow, TableCell };
|
|
@@ -1,8 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
1
|
import * as React from "react";
|
|
3
|
-
import {
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cn } from "../../lib/utils";
|
|
4
|
+
|
|
4
5
|
const Textarea = React.forwardRef(({ className, ...props }, ref) => {
|
|
5
|
-
|
|
6
|
+
return _jsx("textarea", {
|
|
7
|
+
className: cn(
|
|
8
|
+
"flex min-h-[60px] w-full rounded-md border border-input bg-transparent px-3 py-2 text-sm shadow-sm placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",
|
|
9
|
+
className,
|
|
10
|
+
),
|
|
11
|
+
ref: ref,
|
|
12
|
+
...props,
|
|
13
|
+
});
|
|
6
14
|
});
|
|
7
15
|
Textarea.displayName = "Textarea";
|
|
8
16
|
export { Textarea };
|
package/src/index.ts
CHANGED
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
import type { IModule } from "@arch-cadre/modules";
|
|
9
9
|
import { inArray, sql } from "drizzle-orm";
|
|
10
10
|
import manifest from "../manifest.json" with { type: "json" };
|
|
11
|
-
import BlogStatsWidget from "./components/BlogStatsWidget
|
|
12
|
-
import RecentCommentsWidget from "./components/RecentCommentsWidget
|
|
13
|
-
import RecentPostsWidget from "./components/RecentPostsWidget
|
|
14
|
-
import { navigation } from "./navigation
|
|
15
|
-
import { privateRoutes, publicRoutes } from "./routes
|
|
11
|
+
import BlogStatsWidget from "./components/BlogStatsWidget";
|
|
12
|
+
import RecentCommentsWidget from "./components/RecentCommentsWidget";
|
|
13
|
+
import RecentPostsWidget from "./components/RecentPostsWidget";
|
|
14
|
+
import { navigation } from "./navigation";
|
|
15
|
+
import { privateRoutes, publicRoutes } from "./routes";
|
|
16
16
|
|
|
17
17
|
const BLOG_PERMISSIONS = [
|
|
18
18
|
{ name: "post:create", description: "Allow creating blog posts" },
|
package/src/routes.tsx
CHANGED
|
@@ -4,14 +4,14 @@ import type {
|
|
|
4
4
|
PublicRouteDefinition,
|
|
5
5
|
} from "@arch-cadre/modules";
|
|
6
6
|
import * as React from "react";
|
|
7
|
-
import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index
|
|
7
|
+
import { getComments, getPostById, getPostBySlug, getPosts } from "./actions/index";
|
|
8
8
|
import {
|
|
9
9
|
BlogAdminPage,
|
|
10
10
|
BlogListPage,
|
|
11
11
|
CreatePostForm,
|
|
12
12
|
EditPostForm,
|
|
13
13
|
PostDetailPage,
|
|
14
|
-
} from "./ui/views
|
|
14
|
+
} from "./ui/views";
|
|
15
15
|
|
|
16
16
|
export const publicRoutes: PublicRouteDefinition[] = [
|
|
17
17
|
{
|
package/src/ui/views.tsx
CHANGED
|
@@ -17,15 +17,15 @@ import { useRouter } from "next/navigation";
|
|
|
17
17
|
import * as React from "react";
|
|
18
18
|
import { useForm } from "react-hook-form";
|
|
19
19
|
import { toast } from "sonner";
|
|
20
|
-
import { createComment, createPost, deletePost, updatePost } from "../actions/index
|
|
21
|
-
import { Button } from "../components/ui/button
|
|
20
|
+
import { createComment, createPost, deletePost, updatePost } from "../actions/index";
|
|
21
|
+
import { Button } from "../components/ui/button";
|
|
22
22
|
import {
|
|
23
23
|
Card,
|
|
24
24
|
CardContent,
|
|
25
25
|
CardHeader,
|
|
26
26
|
CardTitle,
|
|
27
|
-
} from "../components/ui/card
|
|
28
|
-
import { Input } from "../components/ui/input
|
|
27
|
+
} from "../components/ui/card";
|
|
28
|
+
import { Input } from "../components/ui/input";
|
|
29
29
|
import {
|
|
30
30
|
Table,
|
|
31
31
|
TableBody,
|
|
@@ -33,9 +33,9 @@ import {
|
|
|
33
33
|
TableHead,
|
|
34
34
|
TableHeader,
|
|
35
35
|
TableRow,
|
|
36
|
-
} from "../components/ui/table
|
|
37
|
-
import { Textarea } from "../components/ui/textarea
|
|
38
|
-
import { commentSchema, postSchema } from "../lib/validation
|
|
36
|
+
} from "../components/ui/table";
|
|
37
|
+
import { Textarea } from "../components/ui/textarea";
|
|
38
|
+
import { commentSchema, postSchema } from "../lib/validation";
|
|
39
39
|
|
|
40
40
|
export function BlogListPage({ posts = [] }: { posts?: any[] }) {
|
|
41
41
|
const { t } = useTranslation();
|