"use client"; import { useEffect, useState } from "react"; import Link from "next/link"; import { ArrowLeftRight, ArrowUpRight } from "lucide-react"; import { socialApi } from "@social/lib/api"; import { socialPath } from "@social/lib/socialPath"; import { socialTx } from "@social/lib/socialTx"; import SectionSpark from "./SectionSpark"; type SkillItem = { id: string; author: string; city: string; offer: string; want: string; }; const SEED: SkillItem[] = [ { id: "seed-1", author: "Mia", city: "清迈", offer: "英语口语陪练", want: "帮拍短视频 / 剪辑", }, { id: "seed-2", author: "Ken", city: "里斯本", offer: "帮看代码 / 架构 review", want: "签证 / D7 经验咨询", }, { id: "seed-3", author: "Lin", city: "成都", offer: "小红书运营陪跑", want: "摄影设备借用一天", }, { id: "seed-4", author: "Jay", city: "线上", offer: "简历 / LinkedIn 点评", want: "葡萄牙语入门交换", }, ]; export default function HomeSkillsPreview({ /** When true, render on /team (找搭子) instead of the homepage. */ inPage = false, }: { inPage?: boolean; }) { const [items, setItems] = useState(SEED); useEffect(() => { let cancelled = false; void socialApi .listSkills({ limit: 4 }) .then((res) => { if (cancelled) return; const live = res?.items || []; if (live.length) { setItems( live.slice(0, 4).map((s) => ({ id: s.id, author: s.author, city: s.city, offer: s.offer, want: s.want, })), ); } }) .catch(() => { /* keep SEED */ }); return () => { cancelled = true; }; }, []); return (
{socialTx("技能板")} {socialTx("互换互助")}

🔄 {socialTx("技能交换")}

{socialTx( "教英语换拍视频、帮忙看代码换签证咨询——写清楚你能给什么、想换什么。", )}

{items.map((item) => ( {item.city} {item.author}

{socialTx("能提供")} {item.offer}

{socialTx("想换到")} {item.want}

))}
{socialTx("去发互换")}
); }