From d1bb593230bd93a5a2a57712d2b1d3b57e1de0d0 Mon Sep 17 00:00:00 2001 From: Mike Murray Date: Tue, 7 Apr 2020 10:59:31 -0700 Subject: [PATCH] feat: register settings dashboard Signed-off-by: Mike Murray --- package/src/lib/core/reaction.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/package/src/lib/core/reaction.js b/package/src/lib/core/reaction.js index 3492ec2..6a5ee81 100644 --- a/package/src/lib/core/reaction.js +++ b/package/src/lib/core/reaction.js @@ -1,8 +1,11 @@ import React from "react"; import ReactDOM from "react-dom"; +import SettingsIcon from "mdi-material-ui/Settings"; import initApollo from "../graphql/initApollo"; +import SettingsDashboard from "../SettingsDashboard"; import { getOidcProps } from "./authentication"; import { plugins } from "./plugins"; +import { registerRoute } from "./routes"; import { initI18next } from "./i18n"; import { loadRegisteredBlocks } from "./blocks"; @@ -21,7 +24,10 @@ export function Reaction(props) { }, AppComponent, DashboardComponent, - dashboardComponentProps + SettingsDashboardComponent = SettingsDashboard, + dashboardComponentProps, + settingsRouteProps, + shouldShowSettingsInNavigation = true } = props; // Initialize apollo client to be used for the ApolloProvider in the AppComponent @@ -33,6 +39,20 @@ export function Reaction(props) { // Load registered blocks loadRegisteredBlocks(); + if (shouldShowSettingsInNavigation) { + registerRoute({ + group: "navigation", + priority: 9999, + path: "/settings/:setting?", + href: "/settings/shop", + LayoutComponent: null, + MainComponent: SettingsDashboardComponent, + IconComponent: SettingsIcon, + navigationItemLabel: "admin.settings.settingsLabel", + ...settingsRouteProps + }); + } + // Create OIDC props to be used on the AuthenticationProvider in the AppComponent const authenticationProviderProps = getOidcProps({ oidcClientId: PUBLIC_OIDC_CLIENT_ID,