// Pages import the catalog (`/snippets/plugin-catalog.jsx`) and pass it in. Mintlify takes each imported
// export on its own, so every component here is self-contained: no imports, no shared top-level helpers.
export const Marketplace = ({ catalog: pluginCatalog, lang = "en" }) => {
const TEXT = {
en: {
eyebrow: "Plugin Marketplace",
title: "Make OpenIDEA yours.",
lead: "Languages, frameworks, linters, themes and tools, signed by their publishers and installed in one click from",
path: "Settings › Plugins › Marketplace",
leadEnd: ".",
plugins: "plugins",
publishers: "publishers",
downloads: "downloads",
downloadsLabel: "Downloads",
listSep: ", ",
search: "Search plugins",
sort: "Sort",
popular: "Popular",
az: "A–Z",
category: "Category",
official: "Official",
empty: (q) => `No plugins match “${q}”.`,
buildEyebrow: "Build a plugin",
buildTitle: "Ship your plugin to every OpenIDEA user.",
buildLead:
"Plugins are sandboxed WebAssembly components with a typed API. Themes, icon themes and languages need no code at all. Scaffold one in a minute, then list it through the community registry.",
quickstart: "Plugin quickstart",
publish: "Publish to the marketplace",
term1: "# attach the .oiplugin to a release, then open a",
term2: "# pull request in l0ng-ai/openidea-plugins",
note: (d) =>
`Snapshot of the marketplace index from ${d}. The IDE always shows the current list. Community plugins are built and signed by their authors.`,
close: "Close",
version: "Version",
categoriesLabel: "Categories",
pluginId: "Plugin id",
install: (name) => (
<>
Install In OpenIDEA, open Settings › Plugins › Marketplace, search for “{name}” and click{" "}
Install.
>
),
source: "Source and docs",
categories: {
all: "All",
frameworks: "Frameworks",
languages: "Languages",
tools: "Tools",
linters: "Linters",
vcs: "Version control",
ai: "AI",
themes: "Themes",
"icon-themes": "Icon themes",
other: "Other",
},
},
zh: {
eyebrow: "插件市场",
title: "让 OpenIDEA 成为你的 IDE。",
lead: "语言、框架、代码检查、主题和工具,均由发布者签名,在",
path: "设置 › 插件 › 插件市场",
leadEnd: "中一键安装。",
plugins: "个插件",
publishers: "位发布者",
downloads: "次下载",
downloadsLabel: "下载量",
listSep: "、",
search: "搜索插件",
sort: "排序",
popular: "最热门",
az: "按名称",
category: "分类",
official: "官方",
empty: (q) => `没有与“${q}”匹配的插件。`,
buildEyebrow: "开发插件",
buildTitle: "把你的插件交到每一位 OpenIDEA 用户手中。",
buildLead:
"插件是运行在沙箱中的 WebAssembly 组件,API 有完整类型。主题、图标主题和语言完全不用写代码。一分钟搭好脚手架,再通过社区登记仓库上架。",
quickstart: "插件快速开始",
publish: "发布到插件市场",
term1: "# 把 .oiplugin 附加到 release,然后向",
term2: "# l0ng-ai/openidea-plugins 提交 pull request",
note: (d) => `插件市场索引快照,生成于 ${d}。IDE 中显示的始终是最新列表。社区插件由作者自行构建和签名。`,
close: "关闭",
version: "版本",
categoriesLabel: "分类",
pluginId: "插件 id",
install: (name) => (
<>
安装 在 OpenIDEA 中打开 设置 › 插件 › 插件市场,搜索“
{name}”,点击 安装。
>
),
source: "源码与文档",
categories: {
all: "全部",
frameworks: "框架",
languages: "语言",
tools: "工具",
linters: "代码检查",
vcs: "版本控制",
ai: "AI",
themes: "主题",
"icon-themes": "图标主题",
other: "其他",
},
},
};
const CATEGORY_IDS = [
"all",
"frameworks",
"languages",
"tools",
"linters",
"vcs",
"ai",
"themes",
"icon-themes",
"other",
];
const formatCount = (n) => (n >= 1000 ? `${(n / 1000).toFixed(1).replace(/\.0$/, "")}k` : `${n}`);
// Called as a function: snippet components cannot use each other as JSX tags.
const pluginIcon = (plugin, size) =>
plugin.icon ? (
) : (
{plugin.name
.replace(/^[^A-Za-z0-9]+/, "")
.slice(0, 1)
.toUpperCase()}
);
const t = TEXT[lang] || TEXT.en;
const categoryLabel = (id) => t.categories[id] || id;
const all = pluginCatalog.plugins;
const [query, setQuery] = useState("");
const [category, setCategory] = useState("all");
const [sort, setSort] = useState("popular");
const [open, setOpen] = useState(null);
const counts = {};
for (const p of all) for (const c of p.categories) counts[c] = (counts[c] || 0) + 1;
const totalDownloads = all.reduce((s, p) => s + p.downloads, 0);
const q = query.trim().toLowerCase();
const shown = all
.filter((p) => category === "all" || p.categories.includes(category))
.filter(
(p) =>
!q ||
p.name.toLowerCase().includes(q) ||
p.description.toLowerCase().includes(q) ||
p.publisher.toLowerCase().includes(q) ||
p.id.toLowerCase().includes(q),
)
.slice()
.sort((a, b) => (sort === "name" ? a.name.localeCompare(b.name) : b.downloads - a.downloads));
const current = open && all.find((p) => p.id === open);
useEffect(() => {
if (!current) return;
const onKey = (e) => e.key === "Escape" && setOpen(null);
window.addEventListener("keydown", onKey);
return () => window.removeEventListener("keydown", onKey);
}, [current]);
return (
{t.lead} {t.path} {t.leadEnd}
{t.empty(query)}
}{t.note(pluginCatalog.generatedAt)}
{current.description}
{current.id}