Hey Clay,
I’m trying to figure out how to develop a Local add-on and so far running into a few snags. I’ve got a menu item showing up in Local in the MORE dropdown. But:
- Is there a way to see console.log while developing?
- Is there a way to load changes to the add-on within Local without restarting Local?
- Can you describe the routing a little?
I’ve got this for the renderer:
'use strict';
const path = require('path');
module.exports = function(context) {
const hooks = context.hooks;
const React = context.React;
const {Link, Route} = context.ReactRouter;
const AddonTest = require('./AddonTest')(context);
hooks.addContent('routesAddonTest', () => {
return <Route key="site-info-test" path="/site-info/:siteID/test" component={AddonTest}/>
});
hooks.addFilter('siteInfoMoreMenu', function(menu, site) {
menu.push({
label: 'Test ' + site.id,
enabled: !this.context.router.isActive(`/site-info/${site.id}/test`),
click: () => {
context.events.send('goToRoute', `/site-info/${site.id}/test`);
}
});
return menu;
});
};
And here’s my AddonTest.js:
module.exports = function (context) {
const Component = context.React.Component;
const React = context.React;
const $ = context.jQuery;
return class AddonTest extends Component {
render() {
return (
<div style={{display: 'flex', flexDirection: 'column', flex: 1, padding: '15px 0'}}>
<h4>Test</h4>
</div>
);
}
}
}
I’m not sure what the Route path should be and as written it doesn’t seem to be going to any path when the item in the MORE dropdown is clicked - it’s just reloading the default screen.
Thanks for the help!