Widget Config Magnify (#1689)

Introduces a configuration option to widgets to allow them to magnify on
startup.
This commit is contained in:
Sylvie Crowe 2025-01-08 15:02:55 -08:00 committed by GitHub
parent 5c3eba2644
commit a3cbcc5a77
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 7 additions and 7 deletions

View File

@ -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. |
<a name="font-awesome-icons" />

View File

@ -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 (
<div
className="widget"
onClick={() => handleWidgetSelect(widget.blockdef)}
title={widget.description || widget.label}
>
<div className="widget" onClick={() => handleWidgetSelect(widget)} title={widget.description || widget.label}>
<div className="widget-icon" style={{ color: widget.color }}>
<i className={makeIconClass(widget.icon, true, { defaultIcon: "browser" })}></i>
</div>

View File

@ -1159,6 +1159,7 @@ declare global {
color?: string;
label?: string;
description?: string;
magnified?: boolean;
blockdef: BlockDef;
};

View File

@ -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"`
}