Skip to content

armgit / dbx

Public Imported from GitHub
0

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。

feat(site): sort marketplace by installs, add badges and new releases

t8y20b9aeb771417
diff --git a/docs/app/[lang]/plugins/PluginsClient.tsx b/docs/app/[lang]/plugins/PluginsClient.tsx
index 992b1fb12d..341040f6b8 100644
--- a/docs/app/[lang]/plugins/PluginsClient.tsx
+++ b/docs/app/[lang]/plugins/PluginsClient.tsx
@@ -1,13 +1,15 @@
"use client";
-import { useEffect, useState } from "react";
+import { useEffect, useMemo, useState } from "react";
import Link from "next/link";
+import { BadgeCheck } from "lucide-react";
import { LandingNav } from "@/components/landing/LandingNav";
import { LandingFooter } from "@/components/landing/LandingFooter";
import type { DocsLang } from "@/lib/i18n";
import {
DBX_STORE_CONTRIBUTING_URL,
fetchPluginCatalog,
+ formatPluginDate,
latestPluginVersion,
pluginDisplayDescription,
pluginDisplayName,
@@ -21,6 +23,10 @@ const i18n = {
viewPlugin: "View plugin",
refreshError: "Could not refresh the catalog; showing the last snapshot.",
installCount: (count: number) => `${formatPluginInstalls(count, "en")} installs`,
+ listedOn: (iso: string) => `Listed ${formatPluginDate(iso, "en")}`,
+ verified: "Verified",
+ newSection: "New releases",
+ allSection: "All plugins",
submitTitle: "Built a plugin for DBX?",
submitDesc: "Package it as a .dbxp, submit a PR to dbx-store, and it will appear here and in the in-app plugin center after review.",
submitAction: "Submit to dbx-store",
@@ -33,6 +39,10 @@ const i18n = {
viewPlugin: "查看插件",
refreshError: "目录刷新失败,当前展示构建时的快照。",
installCount: (count: number) => `${formatPluginInstalls(count, "cn")} 次安装`,
+ listedOn: (iso: string) => `${formatPluginDate(iso, "cn")}上架`,
+ verified: "已认证",
+ newSection: "最新上架",
+ allSection: "全部插件",
submitTitle: "为 DBX 开发了插件?",
submitDesc: "打包为 .dbxp,向 dbx-store 提交 PR,审核通过后会同时出现在本页面和客户端插件中心。",
submitAction: "提交到 dbx-store",
@@ -49,6 +59,63 @@ function mergePlugins(snapshot: MarketplacePlugin[], live: MarketplacePlugin[]):
return [...byId.values()];
}
+// Earliest version release ≈ when the plugin was first listed in the store.
+type ListedAt = { iso: string; time: number };
+
+function pluginListedAt(plugin: MarketplacePlugin): ListedAt | null {
+ let listed: ListedAt | null = null;
+ for (const version of plugin.versions) {
+ const time = Date.parse(version.releasedAt);
+ if (Number.isNaN(time)) continue;
+ if (!listed || time < listed.time) listed = { iso: version.releasedAt, time };
+ }
+ return listed;
+}
+
+function PluginCard({ lang, plugin, metaNote }: { lang: DocsLang; plugin: MarketplacePlugin; metaNote: string }) {
+ const t = i18n[lang];
+ const latest = latestPluginVersion(plugin);
+ return (
+ <div className="group relative flex flex-col rounded-xl border border-landing-line bg-landing-panel p-6 transition-colors hover:border-landing-blue">
+ {/* Stretched link: the whole card navigates; interactive children sit above it. */}
+ <Link
+ href={`/${lang}/plugins/${plugin.id}`}
+ prefetch={false}
+ className="absolute inset-0 z-[1] rounded-xl"
+ aria-label={`${t.viewPlugin}: ${pluginDisplayName(plugin, lang)}`}
+ />
+ <div className="flex items-start gap-4">
+ <span className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-white">
+ {plugin.icon ? (
+ // eslint-disable-next-line @next/next/no-img-element
+ <img src={plugin.icon} alt="" aria-hidden="true" width={40} height={40} className="size-10 object-contain" />
+ ) : null}
+ </span>
+ <div className="min-w-0 flex-1">
+ <div className="flex items-center gap-x-2.5">
+ <h3 className="truncate text-[19px] font-[760]">{pluginDisplayName(plugin, lang)}</h3>
+ {latest ? <span className="shrink-0 rounded-md border border-landing-line px-1.5 py-0.5 text-[11px] font-[650] text-landing-muted">v{latest.version}</span> : null}
+ </div>
+ <p className="mt-0.5 flex min-w-0 items-center gap-1 text-[13px] text-landing-muted">
+ <span className="truncate">{plugin.publisher}</span>
+ {/* Store-wide certification, same semantics as the in-app marketplace. */}
+ <BadgeCheck className="size-3.5 shrink-0 text-emerald-600" role="img" aria-label={t.verified} />
+ {metaNote ? <span className="truncate">{metaNote}</span> : null}
+ </p>
+ </div>
+ </div>
+ <p className="mt-3.5 line-clamp-2 text-sm leading-[1.7] text-landing-muted">{pluginDisplayDescription(plugin, lang)}</p>
+ <div className="mt-auto flex flex-wrap items-center gap-1.5 pt-4">
+ {(plugin.tags ?? []).slice(0, 5).map((tag) => (
+ <span key={tag} className="rounded-md bg-landing-soft px-2 py-0.5 text-[11px] font-medium text-landing-muted">
+ {tag}
+ </span>
+ ))}
+ </div>
+ </div>
+ );
+}
+
export function PluginsClient({
lang,
initialPlugins,
@@ -82,14 +149,50 @@ export function PluginsClient({
};
}, []);
+ // Popularity order for the main grid: installs descending; ties and
+ // zero-count plugins keep the catalog's original relative order at the tail.
+ const sortedPlugins = useMemo(
+ () => [...plugins].sort((a, b) => (installs?.[b.id] ?? 0) - (installs?.[a.id] ?? 0)),
+ [plugins, installs],
+ );
+ const newestPlugins = useMemo(
+ () =>
+ [...plugins]
+ .map((plugin) => ({ plugin, time: pluginListedAt(plugin)?.time ?? Number.POSITIVE_INFINITY }))
+ .sort((a, b) => a.time - b.time)
+ .slice(0, 6)
+ .map((entry) => entry.plugin),
+ [plugins],
+ );
+
return (
<main className="min-h-screen bg-landing-bg text-landing-ink">
<LandingNav lang={lang} active="plugins" />
<section className="max-w-[1180px] mx-auto px-6 pt-32 pb-24">
- <h1 className="text-4xl font-[820] tracking-tight">{t.title}</h1>
+ {/* Kept for screen readers/SEO; the visual headline is the section titles. */}
+ <h1 className="sr-only">{t.title}</h1>
- {refreshFailed && <p className="mt-4 text-[13px] text-landing-muted">{t.refreshError}</p>}
+ {refreshFailed && <p className="text-[13px] text-landing-muted">{t.refreshError}</p>}
+
+ {newestPlugins.length > 0 && (
+ <section>
+ <h2 className="text-xl font-[720]">{t.newSection}</h2>
+ <div className="mt-4 grid grid-cols-3 gap-5 max-[1040px]:grid-cols-2 max-[720px]:grid-cols-1">
+ {newestPlugins.map((plugin) => {
+ const listed = pluginListedAt(plugin);
+ return (
+ <PluginCard
+ key={plugin.id}
+ lang={lang}
+ plugin={plugin}
+ metaNote={listed ? t.listedOn(listed.iso) : ""}
+ />
+ );
+ })}
+ </div>
+ </section>
+ )}
{plugins.length === 0 ? (
<div className="mt-10 rounded-xl border border-landing-line bg-landing-panel p-8 text-center">
@@ -97,52 +200,19 @@ export function PluginsClient({
<p className="mt-2 text-sm text-landing-muted">{t.emptyDesc}</p>
</div>
) : (
- <div className="mt-8 grid grid-cols-3 gap-5 max-[1040px]:grid-cols-2 max-[720px]:grid-cols-1">
- {plugins.map((plugin) => {
- const latest = latestPluginVersion(plugin);
- return (
- <div
+ <section className="mt-10">
+ <h2 className="text-xl font-[720]">{t.allSection}</h2>
+ <div className="mt-4 grid grid-cols-3 gap-5 max-[1040px]:grid-cols-2 max-[720px]:grid-cols-1">
+ {sortedPlugins.map((plugin) => (
+ <PluginCard
key={plugin.id}
- className="group relative flex flex-col rounded-xl border border-landing-line bg-landing-panel p-6 transition-colors hover:border-landing-blue"
- >
- {/* Stretched link: the whole card navigates; interactive children sit above it. */}
- <Link
- href={`/${lang}/plugins/${plugin.id}`}
- prefetch={false}
- className="absolute inset-0 z-[1] rounded-xl"
- aria-label={`${t.viewPlugin}: ${pluginDisplayName(plugin, lang)}`}
- />
- <div className="flex items-start gap-4">
- <span className="flex size-12 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-white">
- {plugin.icon ? (
- // eslint-disable-next-line @next/next/no-img-element
- <img src={plugin.icon} alt="" aria-hidden="true" width={40} height={40} className="size-10 object-contain" />
- ) : null}
- </span>
- <div className="min-w-0 flex-1">
- <div className="flex items-center gap-x-2.5">
- <h2 className="truncate text-[19px] font-[760]">{pluginDisplayName(plugin, lang)}</h2>
- {latest ? <span className="shrink-0 rounded-md border border-landing-line px-1.5 py-0.5 text-[11px] font-[650] text-landing-muted">v{latest.version}</span> : null}
- </div>
- <p className="mt-0.5 text-[13px] text-landing-muted">
- {plugin.publisher}
- {plugin.license ? ` · ${plugin.license}` : ""}
- {installs?.[plugin.id] ? ` · ${t.installCount(installs[plugin.id])}` : ""}
- </p>
- </div>
- </div>
- <p className="mt-3.5 line-clamp-2 text-sm leading-[1.7] text-landing-muted">{pluginDisplayDescription(plugin, lang)}</p>
- <div className="mt-auto flex flex-wrap items-center gap-1.5 pt-4">
- {(plugin.tags ?? []).slice(0, 5).map((tag) => (
- <span key={tag} className="rounded-md bg-landing-soft px-2 py-0.5 text-[11px] font-medium text-landing-muted">
- {tag}
- </span>
- ))}
- </div>
- </div>
- );
- })}
- </div>
+ lang={lang}
+ plugin={plugin}
+ metaNote={installs?.[plugin.id] ? t.installCount(installs[plugin.id]) : ""}
+ />
+ ))}
+ </div>
+ </section>
)}
<div className="mt-10 rounded-xl border border-landing-line bg-landing-panel">
diff --git a/docs/app/[lang]/plugins/page.tsx b/docs/app/[lang]/plugins/page.tsx
index 8bf70a66dc..3d32aa5cc1 100644
--- a/docs/app/[lang]/plugins/page.tsx
+++ b/docs/app/[lang]/plugins/page.tsx
@@ -34,9 +34,11 @@ export default async function PluginsPage({ params }: { params: Promise<{ lang:
const { lang } = await params;
const l = resolveLang(lang);
// Build-time snapshot for instant paint and SEO; the client refreshes it from R2 on mount.
- const catalog = await fetchPluginCatalog({ cache: "force-cache" });
+ // Dev serves fresh data — force-cache would pin a stale entry from .next across sessions.
+ const snapshotCache: RequestCache = process.env.NODE_ENV === "production" ? "force-cache" : "no-store";
+ const catalog = await fetchPluginCatalog({ cache: snapshotCache });
// Install counters are decorative: a null snapshot just renders cards without counts.
- const installs = await fetchPluginInstalls({ cache: "force-cache" });
+ const installs = await fetchPluginInstalls({ cache: snapshotCache });
return <PluginsClient lang={l} initialPlugins={catalog?.plugins ?? []} initialInstalls={installs} />;
}