Add TKMind platform extensions, H5/MindSpace stack, and deployment tooling.
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
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
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>
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import Link from 'next/link';
|
||||
import type { PlazaCategory } from '@/types/plaza';
|
||||
import { plazaPath } from '@/lib/site';
|
||||
|
||||
export function CategoryNav({
|
||||
categories,
|
||||
activeSlug,
|
||||
}: {
|
||||
categories: PlazaCategory[];
|
||||
activeSlug?: string;
|
||||
}) {
|
||||
return (
|
||||
<div className="flex gap-2 overflow-x-auto pb-1 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden">
|
||||
<Link
|
||||
href={plazaPath()}
|
||||
className={`shrink-0 rounded-full px-4 py-2 text-sm font-medium transition ${
|
||||
!activeSlug
|
||||
? 'bg-[#2f6f57] text-white'
|
||||
: 'bg-[#ebe4d6] text-[#4a5751] hover:bg-[#dfd7c8]'
|
||||
}`}
|
||||
>
|
||||
全部
|
||||
</Link>
|
||||
{categories.map((cat) => (
|
||||
<Link
|
||||
key={cat.id}
|
||||
href={plazaPath(`cat/${cat.slug}`)}
|
||||
className={`shrink-0 rounded-full px-4 py-2 text-sm font-medium transition ${
|
||||
activeSlug === cat.slug
|
||||
? 'bg-[#2f6f57] text-white'
|
||||
: 'bg-[#ebe4d6] text-[#4a5751] hover:bg-[#dfd7c8]'
|
||||
}`}
|
||||
>
|
||||
{cat.icon} {cat.name}
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
import Link from 'next/link';
|
||||
import type { PlazaPost } from '@/types/plaza';
|
||||
import { plazaPath } from '@/lib/site';
|
||||
|
||||
export function FeaturedBanner({ posts }: { posts: PlazaPost[] }) {
|
||||
if (posts.length === 0) return null;
|
||||
|
||||
return (
|
||||
<section className="space-y-3">
|
||||
<h2 className="text-lg font-semibold text-[#17221d]">精选推荐</h2>
|
||||
<div className="grid gap-3 md:grid-cols-2">
|
||||
{posts.slice(0, 5).map((post) => (
|
||||
<Link
|
||||
key={post.id}
|
||||
href={plazaPath(`p/${post.id}`)}
|
||||
className="rounded-2xl border border-[#d6d0c3] bg-gradient-to-r from-[#2f6f57] to-[#1f4f3f] p-5 text-[#fffdf7] shadow-sm transition hover:-translate-y-0.5"
|
||||
>
|
||||
<p className="text-sm opacity-80">{post.category.icon} {post.category.name}</p>
|
||||
<h3 className="mt-2 text-lg font-semibold leading-snug">{post.title}</h3>
|
||||
<p className="mt-2 text-sm opacity-90">{post.author.display_name}</p>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
'use client';
|
||||
|
||||
import { useCallback, useEffect, useRef, useState } from 'react';
|
||||
import type { PlazaPost } from '@/types/plaza';
|
||||
import { PostGrid } from '@/components/feed/PostGrid';
|
||||
|
||||
async function loadFeedPage(url: string) {
|
||||
const response = await fetch(url);
|
||||
const payload = await response.json();
|
||||
if (!response.ok) throw new Error(payload?.error?.message ?? '加载失败');
|
||||
return payload.data as {
|
||||
posts: PlazaPost[];
|
||||
next_cursor: string | null;
|
||||
has_more: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export function FeedLoadMore({
|
||||
initialPosts,
|
||||
initialCursor,
|
||||
initialHasMore,
|
||||
sort,
|
||||
categorySlug,
|
||||
}: {
|
||||
initialPosts: PlazaPost[];
|
||||
initialCursor: string | null;
|
||||
initialHasMore: boolean;
|
||||
sort: 'hot' | 'new';
|
||||
categorySlug?: string;
|
||||
}) {
|
||||
const [posts, setPosts] = useState(initialPosts);
|
||||
const [cursor, setCursor] = useState(initialCursor);
|
||||
const [hasMore, setHasMore] = useState(initialHasMore);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [error, setError] = useState<string | null>(null);
|
||||
const sentinelRef = useRef<HTMLDivElement | null>(null);
|
||||
const loadingRef = useRef(false);
|
||||
|
||||
const loadMore = useCallback(async () => {
|
||||
if (!hasMore || loadingRef.current || !cursor) return;
|
||||
loadingRef.current = true;
|
||||
setLoading(true);
|
||||
setError(null);
|
||||
try {
|
||||
const query = new URLSearchParams({ sort, limit: '20', cursor });
|
||||
if (categorySlug) query.set('category', categorySlug);
|
||||
const data = await loadFeedPage(`/api/plaza/v1/feed?${query.toString()}`);
|
||||
setPosts((prev) => [...prev, ...data.posts]);
|
||||
setCursor(data.next_cursor);
|
||||
setHasMore(data.has_more);
|
||||
} catch (err) {
|
||||
setError(err instanceof Error ? err.message : '加载失败');
|
||||
} finally {
|
||||
loadingRef.current = false;
|
||||
setLoading(false);
|
||||
}
|
||||
}, [categorySlug, cursor, hasMore, sort]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!hasMore || !cursor) return;
|
||||
const node = sentinelRef.current;
|
||||
if (!node) return;
|
||||
const observer = new IntersectionObserver(
|
||||
(entries) => {
|
||||
if (entries.some((entry) => entry.isIntersecting)) {
|
||||
void loadMore();
|
||||
}
|
||||
},
|
||||
{ rootMargin: '240px' },
|
||||
);
|
||||
observer.observe(node);
|
||||
return () => observer.disconnect();
|
||||
}, [cursor, hasMore, loadMore]);
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
<PostGrid posts={posts} />
|
||||
{error ? <p className="text-center text-sm text-red-700">{error}</p> : null}
|
||||
{hasMore ? (
|
||||
<div ref={sentinelRef} className="flex justify-center pb-8">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => void loadMore()}
|
||||
disabled={loading || !cursor}
|
||||
className="rounded-full border border-[#2f6f57] px-6 py-2.5 text-sm font-semibold text-[#2f6f57] transition hover:bg-[#2f6f57] hover:text-white disabled:opacity-60"
|
||||
>
|
||||
{loading ? '加载中…' : '加载更多'}
|
||||
</button>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
import Link from 'next/link';
|
||||
import { plazaPath } from '@/lib/site';
|
||||
|
||||
export function FeedTabs({
|
||||
sort,
|
||||
categorySlug,
|
||||
}: {
|
||||
sort: 'hot' | 'new';
|
||||
categorySlug?: string;
|
||||
}) {
|
||||
const base = categorySlug ? plazaPath(`cat/${categorySlug}`) : plazaPath();
|
||||
|
||||
return (
|
||||
<div className="inline-flex rounded-full bg-[#ebe4d6] p-1">
|
||||
<Link
|
||||
href={`${base}?sort=hot`}
|
||||
className={`rounded-full px-4 py-2 text-sm font-semibold transition ${
|
||||
sort === 'hot' ? 'bg-[#fffdf7] text-[#17221d] shadow-sm' : 'text-[#68716c]'
|
||||
}`}
|
||||
>
|
||||
热门
|
||||
</Link>
|
||||
<Link
|
||||
href={`${base}?sort=new`}
|
||||
className={`rounded-full px-4 py-2 text-sm font-semibold transition ${
|
||||
sort === 'new' ? 'bg-[#fffdf7] text-[#17221d] shadow-sm' : 'text-[#68716c]'
|
||||
}`}
|
||||
>
|
||||
最新
|
||||
</Link>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
'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>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import type { PlazaPost } from '@/types/plaza';
|
||||
import { PostCard } from '@/components/feed/PostCard';
|
||||
|
||||
export function PostGrid({ posts }: { posts: PlazaPost[] }) {
|
||||
if (posts.length === 0) {
|
||||
return (
|
||||
<div className="rounded-2xl border border-dashed border-[#d6d0c3] bg-[#fffdf7] px-6 py-16 text-center">
|
||||
<p className="text-lg font-semibold text-[#17221d]">暂无内容</p>
|
||||
<p className="mt-2 text-sm text-[#68716c]">发布到广场的作品会出现在这里</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
|
||||
{posts.map((post, index) => (
|
||||
<PostCard key={post.id} post={post} priority={index < 4} />
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
export function PostGridSkeleton({ count = 8 }: { count?: number }) {
|
||||
return (
|
||||
<div className="grid grid-cols-2 gap-4 md:grid-cols-3 lg:grid-cols-4">
|
||||
{Array.from({ length: count }, (_, index) => (
|
||||
<div
|
||||
key={index}
|
||||
className="overflow-hidden rounded-2xl border border-[#d6d0c3] bg-[#fffdf7] shadow-sm"
|
||||
>
|
||||
<div className="aspect-[16/10] animate-pulse bg-[#ebe4d6]" />
|
||||
<div className="space-y-3 p-4">
|
||||
<div className="h-4 animate-pulse rounded bg-[#ebe4d6]" />
|
||||
<div className="h-4 w-2/3 animate-pulse rounded bg-[#ebe4d6]" />
|
||||
<div className="h-3 w-1/2 animate-pulse rounded bg-[#f0ebe0]" />
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user