Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

Commit

Permalink
feat: register settings dashboard
Browse files Browse the repository at this point in the history
Signed-off-by: Mike Murray <hellomikemurray@gmail.com>
  • Loading branch information
mikemurray committed Apr 7, 2020
1 parent 52223a9 commit d1bb593
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion 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";

Expand All @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit d1bb593

Please sign in to comment.