import React from "react" import * as antd from "antd" import { Icons } from "components/Icons" import { openModal as openWidgetsBrowserModal } from "components/WidgetsBrowser" import WidgetItemPreview from "components/WidgetItemPreview" import "./index.less" export default class WidgetsView extends React.Component { state = { loadedWidgets: this.props.ctx.currentValue ?? [], } render() { return
{ Array.isArray(this.state.loadedWidgets) && this.state.loadedWidgets.map((manifest) => { return { app.cores.widgets.uninstall(manifest._id) }} onInstall={() => { app.cores.widgets.install(manifest._id) }} onUpdate={() => { app.cores.widgets.install(manifest._id, { update: true, }) }} onChangeVisible={(visible) => { app.cores.widgets.toggleVisibility(manifest._id, visible) }} /> }) }
} onClick={openWidgetsBrowserModal} > Add widget
} }