Files
john 4e21ca937a
Deploy Documentation / deploy (push) Has been cancelled
Canary / Prepare Version (push) Has been cancelled
Canary / build-cli (push) Has been cancelled
Canary / Upload Install Script (push) Has been cancelled
Canary / bundle-desktop (push) Has been cancelled
Canary / bundle-desktop-intel (push) Has been cancelled
Canary / bundle-desktop-linux (push) Has been cancelled
Canary / bundle-desktop-windows (push) Has been cancelled
Canary / bundle-desktop-windows-cuda (push) Has been cancelled
Canary / Release (push) Has been cancelled
Unused Dependencies / machete (push) Has been cancelled
CI / changes (push) Has been cancelled
CI / Check Rust Code Format (push) Has been cancelled
CI / Build and Test Rust Project (push) Has been cancelled
CI / Build Rust Project on Windows (push) Has been cancelled
CI / Check MSRV (push) Has been cancelled
CI / Lint Rust Code (push) Has been cancelled
CI / Check Generated Schemas are Up-to-Date (push) Has been cancelled
CI / Test and Lint Electron Desktop App (push) Has been cancelled
CI / H5 Plaza Tests and Build (push) Has been cancelled
Live Provider Tests / check-fork (push) Has been cancelled
Live Provider Tests / changes (push) Has been cancelled
Live Provider Tests / Build Binary (push) Has been cancelled
Live Provider Tests / Smoke Tests (push) Has been cancelled
Live Provider Tests / Smoke Tests (Code Execution) (push) Has been cancelled
Live Provider Tests / Compaction Tests (push) Has been cancelled
Live Provider Tests / goose server HTTP integration tests (push) Has been cancelled
Publish Ask AI Bot Docker Image / docker (push) Has been cancelled
Publish Docker Image / docker (push) Has been cancelled
Scorecard supply-chain security / Scorecard analysis (push) Has been cancelled
Add TKMind platform extensions, H5/MindSpace stack, and deployment tooling.
Fork goose with custom MCP widgets, platform extensions (aider, git, web, search),
MindSpace H5 backend/frontend, Plaza/Ops UIs, and deploy scripts for tkmind.cn.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-14 21:30:20 +08:00

60 lines
2.3 KiB
TypeScript

'use client';
import Image from 'next/image';
import Link from 'next/link';
import { useState } from 'react';
import type { PlazaPost } from '@/types/plaza';
import { categoryAccent, formatCount, formatRelativeTime } from '@/lib/format';
import { plazaPath } from '@/lib/site';
export function PostCard({ post, priority = false }: { post: PlazaPost; priority?: boolean }) {
const [coverFailed, setCoverFailed] = useState(false);
const showFallback = !post.cover_url || coverFailed;
const accent = categoryAccent(post.category.slug);
const initial = post.title.trim().charAt(0) || '页';
return (
<Link
href={plazaPath(`p/${post.id}`)}
className="group flex flex-col overflow-hidden rounded-2xl border border-[#d6d0c3] bg-[#fffdf7] shadow-sm transition hover:-translate-y-0.5 hover:shadow-md"
>
<div className="relative aspect-[16/10] overflow-hidden bg-[#ebe4d6]">
{showFallback ? (
<div
className={`flex h-full w-full items-center justify-center bg-gradient-to-br ${accent} text-5xl font-bold text-white/90`}
>
{initial}
</div>
) : (
<Image
src={post.cover_url}
alt={post.title}
fill
priority={priority}
loading={priority ? undefined : 'lazy'}
className="object-cover transition group-hover:scale-[1.02]"
sizes="(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw"
onError={() => setCoverFailed(true)}
/>
)}
</div>
<div className="flex flex-1 flex-col gap-2 p-4">
<h3 className="line-clamp-2 text-base font-semibold leading-snug text-[#17221d]">
{post.title}
</h3>
{post.summary ? (
<p className="line-clamp-2 text-sm leading-relaxed text-[#68716c]">{post.summary}</p>
) : null}
<div className="mt-auto flex items-center justify-between gap-2 pt-2 text-xs text-[#8a928c]">
<span className="truncate">{post.author.display_name}</span>
<span>{formatRelativeTime(post.published_at)}</span>
</div>
<div className="flex gap-3 text-xs text-[#4a5751]">
<span>👍 {formatCount(post.stats.like_count)}</span>
<span>💬 {formatCount(post.stats.comment_count)}</span>
</div>
</div>
</Link>
);
}