25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(website): deduplicate contributor avatars
t8y2fdb24620ef35
diff --git a/docs/components/landing/ContributorsWall.tsx b/docs/components/landing/ContributorsWall.tsxindex 525df6d88d..c196a9d2d3 100644--- a/docs/components/landing/ContributorsWall.tsx+++ b/docs/components/landing/ContributorsWall.tsx@@ -2,7 +2,7 @@import { useState } from "react";import Link from "next/link";-import type { Contributor } from "@/lib/contributors";+import { dedupeContributors, type Contributor } from "@/lib/contributors";function ContributorAvatar({ c }: { c: Contributor }) {const [hovered, setHovered] = useState(false);@@ -34,7 +34,8 @@ function ContributorAvatar({ c }: { c: Contributor }) {}export function ContributorsWallContent({ contributors, title, desc }: { contributors: Contributor[]; title: string; desc: string }) {- if (contributors.length === 0) return null;+ const uniqueContributors = dedupeContributors(contributors);+ if (uniqueContributors.length === 0) return null;return (<>@@ -43,13 +44,13 @@ export function ContributorsWallContent({ contributors, title, desc }: { contrib<p className="mt-2 max-w-[650px] text-landing-muted text-sm leading-[1.65] justify-self-end text-right max-[760px]:max-w-none max-[760px]:text-left">{desc}{" "}<Link href="https://github.com/t8y2/dbx/graphs/contributors" target="_blank" className="landing-inline-link inline-flex items-center gap-[5px]">- {contributors.length}+ contributors on GitHub+ {uniqueContributors.length}+ contributors on GitHub</Link></p></div><div className="landing-contributor-grid">- {contributors.map((c) => (- <ContributorAvatar key={c.login} c={c} />+ {uniqueContributors.map((c) => (+ <ContributorAvatar key={c.login.toLowerCase()} c={c} />))}</div></>diff --git a/docs/lib/contributors.test.ts b/docs/lib/contributors.test.tsnew file mode 100644index 0000000000..aed916fd3b--- /dev/null+++ b/docs/lib/contributors.test.ts@@ -0,0 +1,22 @@+import assert from "node:assert/strict";+import { test } from "vitest";+import { dedupeContributors, type Contributor } from "./contributors";++const contributor = (login: string): Contributor => ({+ login,+ avatar_url: `https://avatars.githubusercontent.com/${login}`,+ html_url: `https://github.com/${login}`,+ contributions: 1,+});++test("dedupeContributors removes duplicate GitHub logins case-insensitively", () => {+ const first = contributor("BlueSkyXN");++ assert.deepEqual(dedupeContributors([first, contributor("blueskyxn"), contributor("other")]), [first, contributor("other")]);+});++test("dedupeContributors preserves the original contributor order", () => {+ const contributors = [contributor("first"), contributor("second"), contributor("third")];++ assert.deepEqual(dedupeContributors(contributors), contributors);+});diff --git a/docs/lib/contributors.ts b/docs/lib/contributors.tsindex 80e65e27ee..8ca86aaee5 100644--- a/docs/lib/contributors.ts+++ b/docs/lib/contributors.ts@@ -65,6 +65,17 @@ function fallbackContributors(): Contributor[] {];}+export function dedupeContributors(contributors: Contributor[]): Contributor[] {+ const seenLogins = new Set<string>();++ return contributors.filter((contributor) => {+ const normalizedLogin = contributor.login.trim().toLowerCase();+ if (!normalizedLogin || seenLogins.has(normalizedLogin)) return false;+ seenLogins.add(normalizedLogin);+ return true;+ });+}+export async function fetchContributors(): Promise<Contributor[]> {const token = process.env.GITHUB_TOKEN;const firstPage = `${GITHUB_CONTRIBUTORS_API}?per_page=100`;@@ -81,7 +92,7 @@ export async function fetchContributors(): Promise<Contributor[]> {if (allContributors.length === 0) return fallbackContributors();- return allContributors.filter((c) => c.login && c.avatar_url && c.type !== "Bot");+ return dedupeContributors(allContributors.filter((c) => c.login && c.avatar_url && c.type !== "Bot"));} catch {return fallbackContributors();}