mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-11 07:55:52 +01:00
✨ Change integration structure to array and rename to widgets in config
This commit is contained in:
@@ -10,7 +10,7 @@ interface DashboardWrapperProps {
|
||||
}
|
||||
|
||||
export const DashboardWrapper = ({ wrapper }: DashboardWrapperProps) => {
|
||||
const { refs, items, integrations } = useGridstack('wrapper', wrapper.id);
|
||||
const { refs, items, widgets } = useGridstack('wrapper', wrapper.id);
|
||||
|
||||
return (
|
||||
<div
|
||||
@@ -35,21 +35,23 @@ export const DashboardWrapper = ({ wrapper }: DashboardWrapperProps) => {
|
||||
</GridstackTileWrapper>
|
||||
);
|
||||
})}
|
||||
{Object.entries(integrations).map(([k, v]) => {
|
||||
const widget = Widgets[k as keyof typeof Widgets] as IWidgetDefinition | undefined;
|
||||
if (!widget) return null;
|
||||
{widgets.map((widget) => {
|
||||
const definition = Widgets[widget.id as keyof typeof Widgets] as
|
||||
| IWidgetDefinition
|
||||
| undefined;
|
||||
if (!definition) return null;
|
||||
|
||||
return (
|
||||
<GridstackTileWrapper
|
||||
type="module"
|
||||
key={k}
|
||||
itemRef={refs.items.current[k]}
|
||||
id={widget.id}
|
||||
{...widget.gridstack}
|
||||
{...v.shape.location}
|
||||
{...v.shape.size}
|
||||
type="widget"
|
||||
key={widget.id}
|
||||
itemRef={refs.items.current[widget.id]}
|
||||
id={definition.id}
|
||||
{...definition.gridstack}
|
||||
{...widget.shape.location}
|
||||
{...widget.shape.size}
|
||||
>
|
||||
<widget.component className="grid-stack-item-content" module={v} />
|
||||
<definition.component className="grid-stack-item-content" widget={widget} />
|
||||
</GridstackTileWrapper>
|
||||
);
|
||||
})}
|
||||
|
||||
Reference in New Issue
Block a user