From 62d2a35abebf3d6673c0894061577ed57de799d2 Mon Sep 17 00:00:00 2001 From: OpeDada Date: Fri, 13 Dec 2024 15:04:07 +0900 Subject: [PATCH 1/2] sidebar plugin: create first draft --- .../PluginPlayground/Plugins/presets/index.ts | 3 +- .../Plugins/presets/ui/sidebar.ts | 192 ++++++++++++++++++ 2 files changed, 194 insertions(+), 1 deletion(-) diff --git a/web/src/beta/features/PluginPlayground/Plugins/presets/index.ts b/web/src/beta/features/PluginPlayground/Plugins/presets/index.ts index 2931a379cd..e312ad75b2 100644 --- a/web/src/beta/features/PluginPlayground/Plugins/presets/index.ts +++ b/web/src/beta/features/PluginPlayground/Plugins/presets/index.ts @@ -2,6 +2,7 @@ import { PluginType } from "../constants"; import { myPlugin } from "./custom/myPlugin"; import { responsivePanel } from "./ui/responsivePanel"; +import { sidebar } from "./ui/sidebar"; type PresetPluginCategory = { id: string; @@ -20,6 +21,6 @@ export const presetPlugins: PresetPlugins = [ { id: "ui", title: "UI", - plugins: [responsivePanel] + plugins: [responsivePanel, sidebar] } ]; diff --git a/web/src/beta/features/PluginPlayground/Plugins/presets/ui/sidebar.ts b/web/src/beta/features/PluginPlayground/Plugins/presets/ui/sidebar.ts index e69de29bb2..132aae9e8e 100644 --- a/web/src/beta/features/PluginPlayground/Plugins/presets/ui/sidebar.ts +++ b/web/src/beta/features/PluginPlayground/Plugins/presets/ui/sidebar.ts @@ -0,0 +1,192 @@ +import { FileType, PluginType } from "../../constants"; +import { PRESET_PLUGIN_COMMON_STYLE } from "../common"; + +const yamlFile: FileType = { + id: "ui-sidebar-reearth-yml", + title: "reearth.yml", + sourceCode: `id: sidebar-plugin +name: Sidebar +version: 1.0.0 +extensions: + - id: sidebar + type: widget + name: Sidebar Widget + description: Sidebar Widget + widgetLayout: + defaultLocation: + zone: outer + section: left + area: middle + `, + disableEdit: true, + disableDelete: true +}; + +const widgetFile: FileType = { + id: "ui-sidebar-widget", + title: "sidebar.js", + sourceCode: `reearth.ui.show(\` + ${PRESET_PLUGIN_COMMON_STYLE} + + +
+ +

Sidebar

+ + +
+ + \`); ` +}; + +export const sidebar: PluginType = { + id: "sidebar", + title: "Sidebar", + files: [widgetFile, yamlFile] +}; From 09a0de8b9d0659630af75cab8598094b90af69e0 Mon Sep 17 00:00:00 2001 From: airslice Date: Fri, 13 Dec 2024 15:29:17 +0800 Subject: [PATCH 2/2] refactor: add key to list item --- web/src/beta/features/PluginPlayground/Plugins/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/src/beta/features/PluginPlayground/Plugins/index.tsx b/web/src/beta/features/PluginPlayground/Plugins/index.tsx index 49b8a2ab9d..e6c21cecd2 100644 --- a/web/src/beta/features/PluginPlayground/Plugins/index.tsx +++ b/web/src/beta/features/PluginPlayground/Plugins/index.tsx @@ -46,7 +46,7 @@ const Plugins: FC = ({ {presetPlugins.map((category) => ( -
+
{category.title} {category.plugins.map((plugin) => (