From 343810925dbd500ecf4015647e8aaaaa70f636d2 Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Tue, 7 Jan 2025 13:12:33 -0800 Subject: [PATCH 1/2] feat: allow widgets to be launched magnified --- frontend/app/workspace/workspace.tsx | 11 ++++------- frontend/types/gotypes.d.ts | 1 + pkg/wconfig/settingsconfig.go | 1 + 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/frontend/app/workspace/workspace.tsx b/frontend/app/workspace/workspace.tsx index 12366c83c3..6261915818 100644 --- a/frontend/app/workspace/workspace.tsx +++ b/frontend/app/workspace/workspace.tsx @@ -71,17 +71,14 @@ const Widgets = memo(() => { ); }); -async function handleWidgetSelect(blockDef: BlockDef) { - createBlock(blockDef); +async function handleWidgetSelect(widget: WidgetConfigType) { + const blockDef = widget.blockdef; + createBlock(blockDef, widget.magnified); } const Widget = memo(({ widget }: { widget: WidgetConfigType }) => { return ( -
handleWidgetSelect(widget.blockdef)} - title={widget.description || widget.label} - > +
handleWidgetSelect(widget)} title={widget.description || widget.label}>
diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 4354af5cdc..056fe8ea9a 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -1159,6 +1159,7 @@ declare global { color?: string; label?: string; description?: string; + magnified?: boolean; blockdef: BlockDef; }; diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 354975b786..427d67cdfd 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -539,6 +539,7 @@ type WidgetConfigType struct { Color string `json:"color,omitempty"` Label string `json:"label,omitempty"` Description string `json:"description,omitempty"` + Magnified bool `json:"magnified,omitempty"` BlockDef waveobj.BlockDef `json:"blockdef"` } From 57ca63701f2f1bda4495119153bc9afb73617603 Mon Sep 17 00:00:00 2001 From: Sylvia Crowe Date: Tue, 7 Jan 2025 13:15:02 -0800 Subject: [PATCH 2/2] docs: add magnified to WidgetConfigType --- docs/docs/customwidgets.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/docs/customwidgets.mdx b/docs/docs/customwidgets.mdx index 44e6a95d05..fdef384a8f 100644 --- a/docs/docs/customwidgets.mdx +++ b/docs/docs/customwidgets.mdx @@ -45,6 +45,7 @@ This `WidgetConfigType` is shared between all types of widgets. That is to say, | "color" | (optional) A string representing a color as would be used in CSS. Hex codes and custom CSS properties are included. This defaults to `"var(--secondary-text-color)"` which is a color wave uses for text that should be differentiated from other text. Out of the box, it is `"#c3c8c2"`. | | "label" | (optional) A string representing the label that appears underneath the widget. It will also act as a tooltip on hover if the `"description"` key isn't filled out. It is null by default. | | "description" | (optional) A description of what the widget does. If it is specified, this serves as a tooltip on hover. It is null by default. | +| "magnified" | (optional) A boolean indicating whether or not the widget should launch magnfied. It is false by default. | | "blockdef" | This is where the the non-visual portion of the widget is defined. Note that all further definition takes place inside a meta object inside this one. |