feat: replace core homepage widget registry with generic extension points

This commit is contained in:
LukeGus committed 2026-09-29 13:23:51 -05:00
1 parent b8bbcd2196
commit 50d43e29fb
18 files changed
+242 -147

No files matched your search

+1 -2
View File
@@ -57,6 +57,5 @@ export const dockerWidget: WidgetDefinition<DockerWidgetConfig> = {
defaultConfig: { hostId: 0 },
defaultSize: { w: GRID_SIZE * 20, h: GRID_SIZE * 14 },
minSize: { w: GRID_SIZE * 10, h: GRID_SIZE * 8 },
component: DockerWidget,
editFormComponent: DockerWidgetEditForm,
components: { view: DockerWidget, editForm: DockerWidgetEditForm },
};
+17 -5
View File
@@ -1,4 +1,5 @@
import type { HomepageWidgetContribution } from "@termix/plugin-sdk/frontend";
import type { ComponentType, ReactNode } from "react";
import type { ExtensionContribution } from "@termix/plugin-sdk/frontend";
/** The homepage's grid step, in pixels. */
export const GRID_SIZE = 30;
@@ -18,7 +19,18 @@ export interface WidgetEditFormProps<C> {
onChange: (config: C) => void;
}
export type WidgetDefinition<C> = Omit<
HomepageWidgetContribution<C>,
"defaultConfig"
> & { defaultConfig: C };
/** What app.registerExtension("homepage.widgets", ...) takes. */
export interface WidgetDefinition<C> extends ExtensionContribution {
id: string;
name: string;
description: string;
category: "links" | "info" | "system" | "monitoring";
icon: ReactNode;
defaultConfig: C;
defaultSize: { w: number; h: number };
minSize: { w: number; h: number };
components: {
view: ComponentType<WidgetComponentProps<C>>;
editForm?: ComponentType<WidgetEditFormProps<C>>;
};
}
+1 -4
View File
@@ -1,7 +1,6 @@
import type { ComponentType } from "react";
import { Box } from "lucide-react";
import type {
HomepageWidgetContribution,
StandaloneViewProps,
TabProps,
TermixApp,
@@ -57,9 +56,7 @@ export function activate(app: TermixApp): void {
when: (host) => canUse && !!host.enableSsh && dockerEnabled(host),
});
app.registerHomepageWidget(
dockerWidget as unknown as HomepageWidgetContribution,
);
app.registerExtension("homepage.widgets", dockerWidget);
app.registerSlotContribution("onboarding.features", {
actionId: "docker.feature",