diff --git a/app/(home)/page.tsx b/app/(home)/page.tsx
index 1565135..a92ece8 100644
--- a/app/(home)/page.tsx
+++ b/app/(home)/page.tsx
@@ -373,7 +373,7 @@ function Feedback(): React.ReactElement {
- "用了一年多的 Mix Space,最让我觉得舒服的一点是别人如果要和我换友链,可以自助提交,我只需要点个通过就可以了,也借此交到了很多的朋友,光这一点我觉得就很不错了"
+ "用了一年多的 Mix Space,最让我觉得舒服的一点是别人如果要和我换友链,可以自助提交,我只需要点个通过就可以了,也借此交到了很多的朋友,光这一点我觉���就很不错了"
diff --git a/app/components/contributor-count.tsx b/app/components/contributor-count.tsx
index 3483d14..a9dc414 100644
--- a/app/components/contributor-count.tsx
+++ b/app/components/contributor-count.tsx
@@ -1,35 +1,62 @@
import type { HTMLAttributes } from 'react';
import Image from 'next/image';
-import { cn } from '@/utils/cn';
import { fetchContributors } from '@/utils/get-contributors';
export interface ContributorCounterProps
extends HTMLAttributes {
- repoOwner: string;
- repoName: string;
+ repos: Array<{
+ owner: string;
+ name: string;
+ }>;
displayCount?: number;
+ excludeUsers?: string[];
}
export default async function ContributorCounter({
- repoOwner,
- repoName,
+ repos,
displayCount = 20,
+ excludeUsers = [],
...props
}: ContributorCounterProps): Promise {
- const contributors = await fetchContributors(repoOwner, repoName);
- const topContributors = contributors
- .filter((contributor) => contributor.login !== repoOwner)
- .slice(0, displayCount);
+
+ const contributorsPromises = repos.map(repo =>
+ fetchContributors(repo.owner, repo.name)
+ );
+
+ const allContributorsList = await Promise.all(contributorsPromises);
+
+
+ const mergedContributors = new Map();
+
+ allContributorsList.flat().forEach(contributor => {
+ if (excludeUsers.includes(contributor.login)) {
+ return;
+ }
+
+ if(mergedContributors.has(contributor.login)) {
+ const existing = mergedContributors.get(contributor.login)!;
+ existing.contributions += contributor.contributions;
+ } else {
+ mergedContributors.set(contributor.login, contributor);
+ }
+ });
+
+ const sortedContributors = Array.from(mergedContributors.values())
+ .sort((a, b) => b.contributions - a.contributions);
return (
))}
- {displayCount < contributors.length && (
-
- +{contributors.length - displayCount}
-
- )}
- 感谢这些为文档做出贡献的优秀贡献者
+ 感谢这些为 Mix Space 开源社区做出贡献的优秀开发者
);