Skip to content

Commit 845d718

Browse files
authored
Plugin api improvements (#4935)
* Support hook into App component * Add hookable PluginSettings component * Add useSettings to plugin hooks * Make setting inputs hookable * Add hooks for performer details panel * Update docs
1 parent ed057c9 commit 845d718

File tree

7 files changed

+521
-421
lines changed

7 files changed

+521
-421
lines changed

ui/v2.5/src/App.tsx

Lines changed: 45 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ import { PluginRoutes } from "./plugins";
5050
// import plugin_api to run code
5151
import "./pluginApi";
5252
import { ConnectionMonitor } from "./ConnectionMonitor";
53+
import { PatchFunction } from "./patch";
5354

5455
const Performers = lazyComponent(
5556
() => import("./components/Performers/Performers")
@@ -144,6 +145,13 @@ function sortPlugins(plugins: PluginList) {
144145
return sorted;
145146
}
146147

148+
const AppContainer: React.FC<React.PropsWithChildren<{}>> = PatchFunction(
149+
"App",
150+
(props: React.PropsWithChildren<{}>) => {
151+
return <>{props.children}</>;
152+
}
153+
) as React.FC;
154+
147155
export const App: React.FC = () => {
148156
const config = useConfiguration();
149157
const [saveUI] = useConfigureUI();
@@ -357,41 +365,43 @@ export const App: React.FC = () => {
357365
const titleProps = makeTitleProps();
358366

359367
return (
360-
<ErrorBoundary>
361-
{messages ? (
362-
<IntlProvider
363-
locale={language}
364-
messages={messages}
365-
formats={intlFormats}
366-
>
367-
<ConfigurationProvider
368-
configuration={config.data?.configuration}
369-
loading={config.loading}
368+
<AppContainer>
369+
<ErrorBoundary>
370+
{messages ? (
371+
<IntlProvider
372+
locale={language}
373+
messages={messages}
374+
formats={intlFormats}
370375
>
371-
{maybeRenderReleaseNotes()}
372-
<ToastProvider>
373-
<ConnectionMonitor />
374-
<Suspense fallback={<LoadingIndicator />}>
375-
<LightboxProvider>
376-
<ManualProvider>
377-
<InteractiveProvider>
378-
<Helmet {...titleProps} />
379-
{maybeRenderNavbar()}
380-
<div
381-
className={`main container-fluid ${
382-
appleRendering ? "apple" : ""
383-
}`}
384-
>
385-
{renderContent()}
386-
</div>
387-
</InteractiveProvider>
388-
</ManualProvider>
389-
</LightboxProvider>
390-
</Suspense>
391-
</ToastProvider>
392-
</ConfigurationProvider>
393-
</IntlProvider>
394-
) : null}
395-
</ErrorBoundary>
376+
<ConfigurationProvider
377+
configuration={config.data?.configuration}
378+
loading={config.loading}
379+
>
380+
{maybeRenderReleaseNotes()}
381+
<ToastProvider>
382+
<ConnectionMonitor />
383+
<Suspense fallback={<LoadingIndicator />}>
384+
<LightboxProvider>
385+
<ManualProvider>
386+
<InteractiveProvider>
387+
<Helmet {...titleProps} />
388+
{maybeRenderNavbar()}
389+
<div
390+
className={`main container-fluid ${
391+
appleRendering ? "apple" : ""
392+
}`}
393+
>
394+
{renderContent()}
395+
</div>
396+
</InteractiveProvider>
397+
</ManualProvider>
398+
</LightboxProvider>
399+
</Suspense>
400+
</ToastProvider>
401+
</ConfigurationProvider>
402+
</IntlProvider>
403+
) : null}
404+
</ErrorBoundary>
405+
</AppContainer>
396406
);
397407
};

0 commit comments

Comments
 (0)