diff --git a/tone-page-web/app/(with-header-footer)/resource/components/ResourceCard.tsx b/tone-page-web/app/(with-header-footer)/resource/components/ResourceCard.tsx index 0a42bc2..ac35311 100644 --- a/tone-page-web/app/(with-header-footer)/resource/components/ResourceCard.tsx +++ b/tone-page-web/app/(with-header-footer)/resource/components/ResourceCard.tsx @@ -1,3 +1,4 @@ +import { ResourceBadge } from "@/components/resource"; import { Card, CardContent } from "@/components/ui/card"; import { Resource } from "@/lib/types/resource"; import Image from "next/image"; @@ -30,11 +31,7 @@ export function ResourceCard({ resource, key }: ResourceCardProps) {
{ resource.tags.map((tag) => ( -
{tag.name}
+ )) }
diff --git a/tone-page-web/app/console/(with-menu)/web/blog/components/BlogTable.tsx b/tone-page-web/app/console/(with-menu)/web/blog/components/BlogTable.tsx new file mode 100644 index 0000000..3bbfffd --- /dev/null +++ b/tone-page-web/app/console/(with-menu)/web/blog/components/BlogTable.tsx @@ -0,0 +1,48 @@ +import { + Table, + TableBody, + TableCaption, + TableCell, + TableFooter, + TableHead, + TableHeader, + TableRow, +} from "@/components/ui/table" + +interface BlogTableProps { + blogs: { + + }[] +} + +export default function BlogTable({ blogs }: BlogTableProps) { + return ( + + A list of your recent invoices. + + + Invoice + Status + Method + Amount + + + + {/* {invoices.map((invoice) => ( + + {invoice.invoice} + {invoice.paymentStatus} + {invoice.paymentMethod} + {invoice.totalAmount} + + ))} */} + + + + Total + $2,500.00 + + +
+ ) +} \ No newline at end of file diff --git a/tone-page-web/app/console/(with-menu)/web/blog/page.tsx b/tone-page-web/app/console/(with-menu)/web/blog/page.tsx index 3279ab0..63835f4 100644 --- a/tone-page-web/app/console/(with-menu)/web/blog/page.tsx +++ b/tone-page-web/app/console/(with-menu)/web/blog/page.tsx @@ -1,7 +1,7 @@ export default function Page() { return ( <> - Blog + ) } \ No newline at end of file diff --git a/tone-page-web/app/console/(with-menu)/web/resource/components/AddResource.tsx b/tone-page-web/app/console/(with-menu)/web/resource/components/AddResource.tsx new file mode 100644 index 0000000..9597264 --- /dev/null +++ b/tone-page-web/app/console/(with-menu)/web/resource/components/AddResource.tsx @@ -0,0 +1,157 @@ +"use client" + +import React, { useState } from "react" +import { + Dialog, + DialogContent, + DialogFooter, + DialogHeader, + DialogTitle, + DialogTrigger, +} from "@/components/ui/dialog" +import { Input } from "@/components/ui/input" +import { Label } from "@/components/ui/label" +import { Button } from "@/components/ui/button" +import { AdminApi } from "@/lib/api" +import { toast } from "sonner" +import { ApiError } from "next/dist/server/api-utils" +import { ResourceBadge } from "@/components/resource" +import AddResourceTag from "./AddResourceTag" +import { Textarea } from "@/components/ui/textarea" +import { Plus } from "lucide-react" + + +interface AddResourceProps { + children: React.ReactNode; + refresh: () => void; +} + +export default function AddResource({ children, refresh }: AddResourceProps) { + const [open, setOpen] = useState(false); + const [loading, setLoading] = useState(false); + + const [formData, setFormData] = useState({ + title: "", + description: "", + imageUrl: "", + link: "", + tags: [] as { type: string, name: string }[], + }); + + const handleSubmit = async () => { + try { + setLoading(true); + await AdminApi.web.resource.create({ + ...formData, + }); + toast.success("添加成功"); + setOpen(false); + refresh(); + } catch (error) { + toast.error((error as ApiError).message || "添加失败"); + } + } + + const handleOpenChange = (open: boolean) => { + setOpen(open); + if (open) { + setFormData({ + title: "", + description: "", + imageUrl: "", + link: "", + tags: [] as { type: string, name: string }[], + }); + } + } + + return ( + + + {children} + + + + 添加资源 + +
+
+ + setFormData({ ...formData, title: e.target.value })} + className="col-span-3" + /> +
+
+ +