Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: replace "Content" section in the main menu with "Page Builder" a…
…nd "Form Builder"
- Loading branch information
Showing
2 changed files
with
34 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,39 @@ | ||
import React from "react"; | ||
import { ReactComponent as PagesIcon } from "@webiny/app-page-builder/admin/assets/round-ballot-24px.svg"; | ||
import { i18n } from "@webiny/app/i18n"; | ||
import { SecureView } from "@webiny/app-security/components"; | ||
import { AdminMenuContentSectionPlugin } from "@webiny/app-admin/types"; | ||
import { AdminMenuPlugin } from "@webiny/app-admin/types"; | ||
|
||
const t = i18n.ns("app-form-builder/admin/menus"); | ||
const ROLE_FORMS_EDITOR = ["forms:form:crud"]; | ||
|
||
const ROLE_FORMS_EDITOR = ["forms:settings"]; | ||
const plugin: AdminMenuPlugin = { | ||
type: "admin-menu", | ||
name: "admin-menu-form-builder", | ||
render({ Menu, Section, Item }) { | ||
return ( | ||
<SecureView | ||
scopes={{ | ||
forms: ROLE_FORMS_EDITOR | ||
}} | ||
> | ||
{({ scopes }) => { | ||
const { forms } = scopes; | ||
if (!forms) { | ||
return null; | ||
} | ||
|
||
export default [ | ||
{ | ||
type: "admin-menu-content-section", | ||
name: "menu-content-section-forms", | ||
render({ Section, Item }) { | ||
return ( | ||
<SecureView scopes={ROLE_FORMS_EDITOR}> | ||
<Section label={t`Form Builder`}> | ||
<Item label={t`Forms`} path="/forms" /> | ||
</Section> | ||
</SecureView> | ||
); | ||
} | ||
return ( | ||
<Menu name="app-form-builder" label={t`Form Builder`} icon={<PagesIcon />}> | ||
<Section label={t`Forms`}> | ||
{forms && <Item label={t`Forms`} path="/forms" />} | ||
</Section> | ||
</Menu> | ||
); | ||
}} | ||
</SecureView> | ||
); | ||
} | ||
] as AdminMenuContentSectionPlugin[]; | ||
}; | ||
|
||
export default plugin; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters