Skip to content

Commit

Permalink
feat: add Data Interactive API Tester to plugins menu when DEBUG_PLUG…
Browse files Browse the repository at this point in the history
…INS is set (#1416)
  • Loading branch information
kswenson authored Aug 20, 2024
1 parent 71c8516 commit 4d2bbf7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
13 changes: 13 additions & 0 deletions v3/src/components/tool-shelf/debug-plugins.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
{
"title": "Plugin API Tester",
"description": "Exercise the CODAP Plugin API and see the results.",
"width": 420,
"height": 540,
"path": "https://concord-consortium.github.io/codap-data-interactives/DataInteractiveAPITester/index.html",
"icon": "/TP-Sampler/icon-sampler.svg",
"visible": "true",
"isStandard": "true",
"categories": []
}
]
6 changes: 5 additions & 1 deletion v3/src/components/tool-shelf/plugins-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ import { Menu, MenuButton, MenuDivider, MenuItem, MenuList } from "@chakra-ui/re
import PluginsIcon from '../../assets/icons/icon-plug.svg'
import { useRemotePluginsConfig } from "../../hooks/use-remote-plugins-config"
import { useDocumentContent } from "../../hooks/use-document-content"
import { DEBUG_PLUGINS } from "../../lib/debug"
import { t } from "../../utilities/translation/translate"
import { kWebViewTileType } from "../web-view/web-view-defs"
import { isWebViewModel } from "../web-view/web-view-model"
import { kRootPluginUrl, processPluginUrl } from "../web-view/web-view-utils"
import { ToolShelfButtonTag } from "./tool-shelf-button"
import { PluginData, PluginMenuConfig } from "./plugin-config-types"
import _debugPlugins from "./debug-plugins.json"
import _standardPlugins from "./standard-plugins.json"
const debugPlugins = DEBUG_PLUGINS ? _debugPlugins as PluginMenuConfig : []
const standardPlugins = _standardPlugins as PluginMenuConfig
const combinedPlugins = [...standardPlugins, ...debugPlugins]

import "./plugins-button.scss"

Expand Down Expand Up @@ -53,7 +57,7 @@ function PluginItem({ pluginData }: IPluginItemProps) {
export function PluginsButton() {
const { plugins: remotePlugins } = useRemotePluginsConfig()
const pluginItems: Array<PluginData | null> =
remotePlugins.length ? [...standardPlugins, null, ...remotePlugins] : standardPlugins
remotePlugins.length ? [...combinedPlugins, null, ...remotePlugins] : combinedPlugins

return (
<Menu isLazy>
Expand Down

0 comments on commit 4d2bbf7

Please sign in to comment.