| 1 | import Link from "next/link"; |
| 2 | import { getFacts } from "@/lib/facts"; |
| 3 | import { buildPageMetadata } from "@/lib/page-meta"; |
| 4 | import { RELEASE_CONTRIBUTORS, RELEASE_HELPERS } from "@/lib/release-credits"; |
| 5 | |
| 6 | export const revalidate = 300; |
| 7 | |
| 8 | export async function generateMetadata({ params }: { params: Promise<{ locale: string }> }) { |
| 9 | const { locale } = await params; |
| 10 | const isZh = locale === "zh"; |
| 11 | return buildPageMetadata({ |
| 12 | path: "/community", |
| 13 | locale, |
| 14 | title: isZh ? "社区 · Codewhale" : "Community · Codewhale", |
| 15 | description: isZh |
| 16 | ? "了解 Codewhale 的国际开源社区,提交 issue、发送 pull request、改进翻译并查看版本贡献者。" |
| 17 | : "Meet Codewhale's international open-source community, file issues, send pull requests, improve translations, and see release contributors.", |
| 18 | }); |
| 19 | } |
| 20 | |
| 21 | export default async function CommunityPage({ params }: { params: Promise<{ locale: string }> }) { |
| 22 | const { locale } = await params; |
| 23 | const isZh = locale === "zh"; |
| 24 | const p = (path: string) => `/${locale}${path}`; |
| 25 | const facts = await getFacts(); |
| 26 | const sourceIsPublished = facts.latestPublishedRelease?.version === facts.version; |
| 27 | |
| 28 | const contributionPaths = isZh |
| 29 | ? [ |
| 30 | { |
| 31 | title: "报告问题", |
| 32 | description: "报告 bug、兼容性问题或不清楚的行为,并附上系统信息、复现步骤和可以安全分享的日志。", |
| 33 | cta: "提交 issue →", |
| 34 | href: "https://github.com/Hmbown/CodeWhale/issues/new/choose", |
| 35 | }, |
| 36 | { |
| 37 | title: "改进代码或测试", |
| 38 | description: "选择一个范围清晰的问题,提交尽可能小的有效补丁,并添加能够证明行为变化的回归测试。", |
| 39 | cta: "查看开放 issues →", |
| 40 | href: "https://github.com/Hmbown/CodeWhale/issues", |
| 41 | }, |
| 42 | { |
| 43 | title: "改进文档或翻译", |
| 44 | description: "修正不准确的说明、补充实际示例,或帮助完成新的语言包,让文档在不同地区都自然准确。", |
| 45 | cta: "查看本地化指南 ↗", |
| 46 | href: "https://github.com/Hmbown/CodeWhale/blob/main/docs/LOCALIZATION.md", |
| 47 | }, |
| 48 | { |
| 49 | title: "复现并审查现有工作", |
| 50 | description: "在你的平台和提供商上验证 issue 或 pull request,然后分享你运行的命令、结果和剩余问题。", |
| 51 | cta: "查看 pull requests →", |
| 52 | href: "https://github.com/Hmbown/CodeWhale/pulls", |
| 53 | }, |
| 54 | ] |
| 55 | : [ |
| 56 | { |
| 57 | title: "Report a problem", |
| 58 | description: "File a bug, compatibility problem, or unclear behavior with system details, reproduction steps, and any logs you can share safely.", |
| 59 | cta: "File an issue →", |
| 60 | href: "https://github.com/Hmbown/CodeWhale/issues/new/choose", |
| 61 | }, |
| 62 | { |
| 63 | title: "Improve code or tests", |
| 64 | description: "Choose one well-bounded problem, make the smallest useful patch, and add a regression test that proves the changed behavior.", |
| 65 | cta: "Browse open issues →", |
| 66 | href: "https://github.com/Hmbown/CodeWhale/issues", |
| 67 | }, |
| 68 | { |
| 69 | title: "Improve documentation or translations", |
| 70 | description: "Correct inaccurate guidance, add a practical example, or help complete a language pack so the project reads naturally in more regions.", |
| 71 | cta: "Open the localization guide ↗", |
| 72 | href: "https://github.com/Hmbown/CodeWhale/blob/main/docs/LOCALIZATION.md", |
| 73 | }, |
| 74 | { |
| 75 | title: "Reproduce and review existing work", |
| 76 | description: "Verify an issue or pull request with your platform and provider, then share the commands you ran, the result, and any remaining problem.", |
| 77 | cta: "Browse pull requests →", |
| 78 | href: "https://github.com/Hmbown/CodeWhale/pulls", |
| 79 | }, |
| 80 | ]; |
| 81 | |
| 82 | const activityLinks = isZh |
| 83 | ? [ |
| 84 | { title: "仓库动态", description: "最近的 issues 与 pull requests。", href: p("/feed") }, |
| 85 | { title: "社区摘要", description: "经过维护者审核的每周项目记录。", href: p("/digest") }, |
| 86 | { title: "公开路线图", description: "已发布、正在进行、考虑中和明确不做的工作。", href: p("/roadmap") }, |
| 87 | ] |
| 88 | : [ |
| 89 | { title: "Repository activity", description: "Recent issues and pull requests.", href: p("/feed") }, |
| 90 | { title: "Community digest", description: "The maintainer-reviewed weekly project record.", href: p("/digest") }, |
| 91 | { title: "Public roadmap", description: "Shipped, underway, considered, and ruled-out work.", href: p("/roadmap") }, |
| 92 | ]; |
| 93 | |
| 94 | return ( |
| 95 | <> |
| 96 | <section className="community-welcome"> |
| 97 | <div className="portal-current" aria-hidden="true" /> |
| 98 | <div className="portal-container community-welcome-inner"> |
| 99 | <div className="eyebrow">{isZh ? "国际开源社区" : "International open-source community"}</div> |
| 100 | <h1>{isZh ? "与世界各地的贡献者一起构建 Codewhale。" : "Build Codewhale with contributors around the world."}</h1> |
| 101 | <p> |
| 102 | {isZh |
| 103 | ? "Codewhale 的运行时、文档、测试和翻译由不同国家、语言、平台和技术背景的贡献者共同改进。第一次参与不需要从大功能开始;清楚的 bug 报告、准确的文档修正或带测试的小补丁都是重要的项目工作。" |
| 104 | : "Codewhale's runtime, documentation, tests, and translations improve through contributors across countries, languages, platforms, and technical backgrounds. A first contribution does not need to be a large feature; a clear bug report, an accurate documentation correction, or a small tested patch is valuable project work."} |
| 105 | </p> |
| 106 | <div className="portal-actions"> |
| 107 | <Link href="https://github.com/Hmbown/CodeWhale/issues/new/choose" className="portal-button portal-button-primary"> |
| 108 | {isZh ? "提交 issue" : "File an issue"} |
| 109 | </Link> |
| 110 | <Link href="https://github.com/Hmbown/CodeWhale/pulls" className="portal-button portal-button-secondary"> |
| 111 | {isZh ? "查看 pull requests" : "Browse pull requests"} |
| 112 | </Link> |
| 113 | <Link href={p("/contribute")} className="portal-button portal-button-secondary"> |
| 114 | {isZh ? "阅读贡献指南" : "Read the contribution guide"} |
| 115 | </Link> |
| 116 | </div> |
| 117 | </div> |
| 118 | </section> |
| 119 | |
| 120 | <section className="portal-section"> |
| 121 | <div className="portal-container portal-section-grid"> |
| 122 | <div className="portal-section-copy"> |
| 123 | <span>{isZh ? "参与方式" : "Ways to contribute"}</span> |
| 124 | <h2>{isZh ? "从一个具体、可验证的改进开始。" : "Start with one concrete, verifiable improvement."}</h2> |
| 125 | <p> |
| 126 | {isZh |
| 127 | ? "问题报告、代码、测试、文档、翻译和审查都会推进项目。请选择最适合你当前经验和时间的一种方式。" |
| 128 | : "Issue reports, code, tests, documentation, translations, and review all move the project forward. Choose the path that fits your experience and available time."} |
| 129 | </p> |
| 130 | </div> |
| 131 | <div className="contribute-path-grid"> |
| 132 | {contributionPaths.map((path) => ( |
| 133 | <article key={path.title}> |
| 134 | <h3>{path.title}</h3> |
| 135 | <p>{path.description}</p> |
| 136 | <Link href={path.href}>{path.cta}</Link> |
| 137 | </article> |
| 138 | ))} |
| 139 | </div> |
| 140 | </div> |
| 141 | </section> |
| 142 | |
| 143 | <section className="portal-section portal-section-muted"> |
| 144 | <div className="portal-container portal-section-grid"> |
| 145 | <div className="portal-section-copy"> |
| 146 | <span>{isZh ? "公开项目记录" : "Public project record"}</span> |
| 147 | <h2>{isZh ? "从提案到发布,项目工作保持公开。" : "Follow the repository work from proposal to release."}</h2> |
| 148 | <p> |
| 149 | {isZh |
| 150 | ? "动态页面汇总最近的仓库活动,社区摘要保留每周存档,路线图区分已发布的能力与仍在讨论的方向。" |
| 151 | : "The activity feed collects recent repository work, the community digest keeps the weekly archive of repository activity, and the roadmap separates shipped capabilities from work that is still being discussed."} |
| 152 | </p> |
| 153 | </div> |
| 154 | <div className="portal-topic-list"> |
| 155 | {activityLinks.map((item) => ( |
| 156 | <Link key={item.href} href={item.href}> |
| 157 | <strong>{item.title}</strong> |
| 158 | <span>{item.description}</span> |
| 159 | <span aria-hidden="true">→</span> |
| 160 | </Link> |
| 161 | ))} |
| 162 | </div> |
| 163 | </div> |
| 164 | </section> |
| 165 | |
| 166 | <section className="portal-section community-credit-section"> |
| 167 | <div className="portal-container portal-section-grid"> |
| 168 | <div className="portal-section-copy"> |
| 169 | <span> |
| 170 | {sourceIsPublished |
| 171 | ? isZh |
| 172 | ? `v${facts.version} 版本致谢` |
| 173 | : `v${facts.version} release credit` |
| 174 | : isZh |
| 175 | ? `v${facts.version} 候选版致谢` |
| 176 | : `v${facts.version} candidate credit`} |
| 177 | </span> |
| 178 | <h2>{isZh ? "贡献者署名是版本记录的一部分。" : "Contributor credit is part of the release record."}</h2> |
| 179 | <p> |
| 180 | {isZh |
| 181 | ? `${sourceIsPublished ? "这一版本" : "这一候选版"}包含社区提交的代码、测试、复现和验证。即使维护者需要调整补丁后再合入,原始贡献者的署名也会保留在提交、更新日志和贡献者名单中。` |
| 182 | : `This ${sourceIsPublished ? "release" : "candidate"} includes code, tests, reproductions, and verification from the community. When a maintainer needs to adapt a patch before it lands, the original contributor remains credited in the commit, changelog, and contributor record.`} |
| 183 | </p> |
| 184 | <div className="community-record-links"> |
| 185 | <Link href="https://github.com/Hmbown/CodeWhale/blob/main/docs/CONTRIBUTORS.md"> |
| 186 | {isZh ? "完整贡献者名单 ↗" : "Full contributor record ↗"} |
| 187 | </Link> |
| 188 | <Link href="https://github.com/Hmbown/CodeWhale/blob/main/CHANGELOG.md">CHANGELOG ↗</Link> |
| 189 | </div> |
| 190 | </div> |
| 191 | <div className="community-credit-groups"> |
| 192 | <section> |
| 193 | <h3>{isZh ? "已合并或吸收的贡献" : "Merged or adapted contributions"}</h3> |
| 194 | <div className="community-credit-list"> |
| 195 | {RELEASE_CONTRIBUTORS.map((handle) => ( |
| 196 | <Link key={handle} href={`https://github.com/${handle.slice(1)}`}>{handle}</Link> |
| 197 | ))} |
| 198 | </div> |
| 199 | </section> |
| 200 | <section> |
| 201 | <h3>{isZh ? "报告、复现与验证" : "Reports, reproductions, and verification"}</h3> |
| 202 | <div className="community-credit-list"> |
| 203 | {RELEASE_HELPERS.map((handle) => ( |
| 204 | <Link key={handle} href={`https://github.com/${handle.slice(1)}`}>{handle}</Link> |
| 205 | ))} |
| 206 | </div> |
| 207 | </section> |
| 208 | </div> |
| 209 | </div> |
| 210 | </section> |
| 211 | </> |
| 212 | ); |
| 213 | } |
| 214 |