Skip to content

Commit

Permalink
move plugin settings to app config
Browse files Browse the repository at this point in the history
  • Loading branch information
ritch committed Jul 26, 2022
1 parent 3761bdb commit a57287c
Show file tree
Hide file tree
Showing 11 changed files with 243 additions and 154 deletions.
1 change: 1 addition & 0 deletions app/packages/app/src/Root/Root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ const Root: Route<RootQuery> = ({ children, prepared }) => {
gridZoom
loopVideos
notebookHeight
plugins
showConfidence
showIndex
showLabel
Expand Down
244 changes: 126 additions & 118 deletions app/packages/app/src/Root/__generated__/RootConfig_query.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 10 additions & 3 deletions app/packages/app/src/Root/__generated__/RootQuery.graphql.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions app/packages/app/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ const App: React.FC = ({}) => {
const { colorscale, config, ...data } = JSON.parse(
msg.data
).state;
console.log({ config });
const state = {
...toCamelCase(data),
view: data.view,
Expand Down
5 changes: 5 additions & 0 deletions app/packages/plugins/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,11 @@ class PluginComponentRegistry {
}

export function usePluginSettings(pluginName: string): any {
const appConfig = recoil.useRecoilValue(fos.appConfig);
if (appConfig && appConfig.plugins) {
return appConfig.plugins[pluginName] || {};
}

const settings =
window.__fo_plugin_settings__ && window.__fo_plugin_settings__[pluginName];
return settings || {};
Expand Down
Loading

0 comments on commit a57287c

Please sign in to comment.