import { createRoot } from "react-dom/client"; import type { IPluginManagementService } from "@zcode/services"; import { createPluginManagementStore } from "@/store/pluginManagementStore.js"; import { PluginStoreInstallButton } from "@/settings/PluginStoreCard.js"; import { ZCodeIntlProvider } from "@/i18n/IntlProvider.js"; import { logger } from "@/logger.js"; import "@/styles.css"; const params = new URLSearchParams(location.search); document.documentElement.className = params.get("theme") === "light" ? "light theme-zai-light" : "dark theme-zai-dark"; const releases = new Map void>(); const service = { listPlugins: async () => ({ plugins: [], diagnostics: [] }), getPluginsOverview: async () => ({ marketplaces: [], availablePlugins: [], installedPlugins: [], restorableBuiltins: [], diagnostics: [], }), installPlugin: ({ pluginName }: { pluginName: string }) => new Promise((resolve) => { releases.set(pluginName, () => resolve({ installedPlugins: [], dependencyClosure: [], diagnostics: [] }), ); }), } as unknown as IPluginManagementService; const store = createPluginManagementStore(service); await store.getState().initialize({ workspacePath: "/workspace/fixture", pluginService: service }); store.subscribe((state) => logger.debug("install-state", JSON.stringify(state.activeOperations))); function Fixture() { const state = store(); return (
{["first", "second"].map((name) => (
{name} { void state.installPlugin(name, "personal", service); }, onOpenDetail: () => {}, onUninstall: () => {}, onUpdate: () => {}, }} />
))}
); } createRoot(document.getElementById("root")!).render();