feat: add quote post selection state and preview card
This commit is contained in:
@@ -109,7 +109,7 @@ export default function NewPostPage() {
|
|||||||
{postType === "quote" && (
|
{postType === "quote" && (
|
||||||
<div className="space-y-2">
|
<div className="space-y-2">
|
||||||
<Label>引用帖子</Label>
|
<Label>引用帖子</Label>
|
||||||
<Select>
|
<Select value={selectedQuotePostId} onValueChange={setSelectedQuotePostId}>
|
||||||
<SelectTrigger>
|
<SelectTrigger>
|
||||||
<SelectValue placeholder="选择要引用的帖子" />
|
<SelectValue placeholder="选择要引用的帖子" />
|
||||||
</SelectTrigger>
|
</SelectTrigger>
|
||||||
@@ -123,7 +123,27 @@ export default function NewPostPage() {
|
|||||||
</Select>
|
</Select>
|
||||||
<div className="mt-2 rounded-md border bg-muted/50 p-3 text-sm text-muted-foreground">
|
<div className="mt-2 rounded-md border bg-muted/50 p-3 text-sm text-muted-foreground">
|
||||||
<p className="font-medium text-foreground">预览:</p>
|
<p className="font-medium text-foreground">预览:</p>
|
||||||
<p className="mt-1">选择一个帖子以查看预览...</p>
|
{selectedQuotePostId ? (
|
||||||
|
(() => {
|
||||||
|
const post = mockPosts.find((p) => p.id === selectedQuotePostId)
|
||||||
|
if (!post) return <p className="mt-1">未找到帖子</p>
|
||||||
|
return (
|
||||||
|
<div className="mt-2 rounded border bg-background p-3">
|
||||||
|
<p className="font-medium text-foreground">{post.title}</p>
|
||||||
|
<p className="mt-1 line-clamp-2 text-xs text-muted-foreground">
|
||||||
|
{post.content}
|
||||||
|
</p>
|
||||||
|
<div className="mt-2 flex items-center gap-2 text-xs text-muted-foreground">
|
||||||
|
<span>@{post.author.nickname}</span>
|
||||||
|
<span>·</span>
|
||||||
|
<span>{new Date(post.createdAt).toLocaleDateString("zh-CN")}</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
})()
|
||||||
|
) : (
|
||||||
|
<p className="mt-1">选择一个帖子以查看预览...</p>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|||||||
Reference in New Issue
Block a user