I’m trying to build a custom add-on and I need to add a new row to the site Overview table (left column the option label, right clolumn an input field and/or a switch), however the docs are very scarce in general.
I tried looking at the github repos, the boilerplate, everything and nothing works. What would make the most sense to me would be something like this in renderer.jsx:
This is my entire original code, that did not worl, so I assume the problem was with the context constant (electron instead of react).
import { TextButton, TableListRow, BasicInput } from "@getflywheel/local-components";
import { AddonRendererContext } from "@getflywheel/local/renderer";
import Boilerplate from "./Boilerplate";
import fs from "fs-extra";
import path from "path";
const packageJSON = fs.readJsonSync(path.join(__dirname, "../package.json"));
const addonID = packageJSON.slug;
export default function (context: AddonRendererContext) {
const { hooks, electron } = context;
/*
* The `path` is relative to the context of this hook, which is the currently viewed site
*
* The full path would look something like `/main/site-info/:siteID/<below-path-var>`
*/
hooks.addFilter("siteInfoToolsItem", (menu) => [
...menu,
{
menuItem: "Counter",
path: `/${addonID}`,
render: (props) => <Boilerplate {...props} />,
},
]);
hooks.addContent("SiteInfoOverview_TableList", (site) => {
return (
<TableListRow key="wp-subfolder" label="WP in Subfolder">
<BasicInput key={`wp-subfolder-field-${site.id}`} site={site} />
<TextButton onClick={(event) => {electron.ipcRenderer.send("add-wp-subfolder-config",site.id)}}>
Save
</TextButton>
</TableListRow>
);
});
}