mirror of
https://litchi.icu/ngc2207/judge4c-demo.git
synced 2025-07-04 04:31:11 +00:00
feat: 添加代码片段编辑页面,并在展示页面中添加编辑链接
This commit is contained in:
parent
e4d639e77c
commit
2478f1a91e
11
src/app/snippets/[id]/edit/page.tsx
Normal file
11
src/app/snippets/[id]/edit/page.tsx
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
interface SnippetEditPageProps {
|
||||||
|
params: Promise<{
|
||||||
|
id: string;
|
||||||
|
}>;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default async function SnippetEditPage(props: SnippetEditPageProps) {
|
||||||
|
const params = await props.params;
|
||||||
|
const id = parseInt(params.id);
|
||||||
|
return <div>Editing snippet with id {id}</div>;
|
||||||
|
}
|
@ -1,4 +1,5 @@
|
|||||||
import { db } from "@/db";
|
import { db } from "@/db";
|
||||||
|
import Link from "next/link";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
|
|
||||||
interface SnippetShowPageProps {
|
interface SnippetShowPageProps {
|
||||||
@ -26,7 +27,12 @@ export default async function SnippetShowPage(props: SnippetShowPageProps) {
|
|||||||
<div className="flex m-4 justify-between items-center">
|
<div className="flex m-4 justify-between items-center">
|
||||||
<h1 className="text-xl font-bold">{snippet.title}</h1>
|
<h1 className="text-xl font-bold">{snippet.title}</h1>
|
||||||
<div className="flex gap-4">
|
<div className="flex gap-4">
|
||||||
<button className="p-2 border rounded">Edit</button>
|
<Link
|
||||||
|
href={`/snippets/${snippet.id}/edit`}
|
||||||
|
className="p-2 border rounded"
|
||||||
|
>
|
||||||
|
Edit
|
||||||
|
</Link>
|
||||||
<button className="p-2 border rounded">Delete</button>
|
<button className="p-2 border rounded">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user