Skip to content

Commit

Permalink
fix: adapt settings menus to the new structure
Browse files Browse the repository at this point in the history
  • Loading branch information
adrians5j committed Mar 31, 2020
1 parent bf2e9d8 commit 3728d01
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 61 deletions.
34 changes: 20 additions & 14 deletions packages/app-cookie-policy/src/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,39 @@ import { Route } from "@webiny/react-router";
import { Helmet } from "react-helmet";
import { AdminLayout } from "@webiny/app-admin/components/AdminLayout";
import CookiePolicySettings from "./components/CookiePolicySettings";
import { SettingsPlugin } from "@webiny/app-admin/types";
import { hasRoles } from "@webiny/app-security";
import { SecureRoute } from "@webiny/app-security/components";
import { i18n } from "@webiny/app/i18n";
import { RoutePlugin } from "@webiny/app/types";
import { PbMenuSettingsItem } from "@webiny/app-page-builder/types";
const t = i18n.ns("app-cookie-policy/admin");

const roles = ["pb-settings"];

const plugin: SettingsPlugin = {
type: "settings",
name: "settings-cookie-policy",
settings: {
show: () => hasRoles(roles),
type: "integration",
name: "Cookie Policy",
const plugins = [
{
type: "route",
name: "route-settings-page-builder-cookie-policy",
route: (
<Route
path="/cookie-policy"
path="/settings/page-builder/cookie-policy"
render={() => (
<AdminLayout>
<Helmet title={"Cookie Policy"} />
<Helmet title={"Page Builder - Cookie Policy Settings"} />
<SecureRoute roles={roles}>
<CookiePolicySettings />
</SecureRoute>
</AdminLayout>
)}
/>
)
}
};
} as RoutePlugin,
{
type: "menu-settings-page-builder",
name: "menu-settings-page-builder-cookie-policy",
render({ Item }) {
return <Item label={t`Cookie Policy`} path={"/settings/page-builder/cookie-policy"} />;
}
} as PbMenuSettingsItem
];

export default plugin;
export default plugins;
54 changes: 32 additions & 22 deletions packages/app-google-tag-manager/src/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,45 @@ import { Route } from "@webiny/react-router";
import { Helmet } from "react-helmet";
import { AdminLayout } from "@webiny/app-admin/components/AdminLayout";
import GoogleTagManagerSettings from "./components/GoogleTagManagerSettings";
import { SettingsPlugin } from "@webiny/app-admin/types";
import { hasRoles } from "@webiny/app-security";
import { SecureRoute } from "@webiny/app-security/components";
import { RoutePlugin } from "@webiny/app/types";
import { i18n } from "@webiny/app/i18n";
import { PbMenuSettingsItem } from "@webiny/app-page-builder/types";

const t = i18n.ns("app-google-tag-manager/admin");

const roles = ["pb-settings"];

const plugins: SettingsPlugin[] = [
const plugins = [
{
type: "route",
name: "route-settings-page-builder-google-tag-manager",
route: (
<Route
path="/settings/page-builder/google-tag-manager"
render={() => (
<AdminLayout>
<Helmet title={"Page Builder - Google Tag Manager Settings"} />
<SecureRoute roles={roles}>
<GoogleTagManagerSettings />
</SecureRoute>
</AdminLayout>
)}
/>
)
} as RoutePlugin,
{
type: "settings",
name: "settings-google-tag-manager",
settings: {
show: () => hasRoles(roles),
type: "integration",
name: "Google Tag Manager",
route: (
<Route
path="/google-tag-manager"
render={() => (
<AdminLayout>
<Helmet title={"Google Tag Manager"} />
<SecureRoute roles={roles}>
<GoogleTagManagerSettings />
</SecureRoute>
</AdminLayout>
)}
type: "menu-settings-page-builder",
name: "menu-settings-page-builder-google-tag-manager",
render({ Item }) {
return (
<Item
label={t`Google Tag Manager`}
path="/settings/page-builder/google-tag-manager"
/>
)
);
}
}
} as PbMenuSettingsItem
];

export default plugins;
57 changes: 32 additions & 25 deletions packages/app-mailchimp/src/admin/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@ import { AdminLayout } from "@webiny/app-admin/components/AdminLayout";
import MailchimpSettings from "./components/MailchimpSettings";
import MailchimpElementAdvancedSettings from "./components/MailchimpElementAdvancedSettings";
import MailchimpElement from "./components/MailchimpElement";
import { hasRoles } from "@webiny/app-security";
import { SecureRoute } from "@webiny/app-security/components";
import { ReactComponent as MailchimpLogo } from "./mailchimp-logo.svg";

import render from "./../render";
import {
PbEditorPageElementPlugin,
PbEditorPageElementAdvancedSettingsPlugin
PbEditorPageElementAdvancedSettingsPlugin, PbMenuSettingsItem
} from "@webiny/app-page-builder/types";
import { SettingsPlugin } from "@webiny/app-admin/types";
import { i18n } from "@webiny/app/i18n";
import { RoutePlugin } from "@webiny/app/types";
import { MenuSettingsPlugin } from "@webiny/app-admin/types";
const t = i18n.ns("app-mailchimp/admin");

const PreviewBox = styled("div")({
textAlign: "center",
Expand Down Expand Up @@ -46,7 +47,11 @@ export default [
);
}
},
settings: ["pb-editor-page-element-settings-delete", "", "pb-editor-page-element-settings-height"],
settings: [
"pb-editor-page-element-settings-delete",
"",
"pb-editor-page-element-settings-height"
],
target: ["column", "row", "list-item"],
onCreate: "open-settings",
render({ element }) {
Expand Down Expand Up @@ -74,25 +79,27 @@ export default [
}
} as PbEditorPageElementAdvancedSettingsPlugin,
{
type: "settings",
name: "settings-mailchimp",
settings: {
show: () => hasRoles(roles),
type: "integration",
name: "Mailchimp",
route: (
<Route
path="/mailchimp"
render={() => (
<AdminLayout>
<Helmet title={"Mailchimp"} />
<SecureRoute roles={roles}>
<MailchimpSettings />
</SecureRoute>
</AdminLayout>
)}
/>
)
type: "route",
name: "route-settings-page-builder-mailchimp",
route: (
<Route
path="/settings/page-builder/mailchimp"
render={() => (
<AdminLayout>
<Helmet title={"Page Builder - Mailchimp Settings"} />
<SecureRoute roles={roles}>
<MailchimpSettings />
</SecureRoute>
</AdminLayout>
)}
/>
)
} as RoutePlugin,
{
type: "menu-settings-page-builder",
name: "menu-settings-page-builder-mailchimp",
render({ Item }) {
return <Item label={t`Mailchimp`} path={"/settings/page-builder/mailchimp"} />;
}
} as SettingsPlugin
} as PbMenuSettingsItem
];

0 comments on commit 3728d01

Please sign in to comment.