Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove email campaigns factory #148

Open
wants to merge 5 commits into
base: next
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .changeset/cyan-ties-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@comet/brevo-admin": major
---

Remove factory createEmailCampaignsPage
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Remove factory createEmailCampaignsPage
Remove `createEmailCampaignsPage` factory


The `EmailCampaignsPage` can now be created like this:

```tsx
<EmailCampaignsPage EmailCampaignContentBlock={EmailCampaignContentBlock} />
```
24 changes: 24 additions & 0 deletions .changeset/witty-coats-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
"@comet/brevo-admin": major
---

Define scopeParts in BrevoConfig

Previously the scopeParts had to be defined in the functions:

- createBrevoContactsPage
- createTargetGroupsPage
- createEmailCampaignsPage

Now it has to be defined once in the BrevoConfig:

```tsx
<BrevoConfigProvider
value={{
scopeParts: ["domain", "language"],
...otherProps,
}}
>
{children}
</BrevoConfigProvider>
```
27 changes: 23 additions & 4 deletions demo/admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "@fontsource-variable/roboto-flex/full.css";
import "material-design-icons/iconfont/material-icons.css";

import { ApolloProvider } from "@apollo/client";
import { ErrorDialogHandler, MuiThemeProvider, RouterBrowserRouter, SnackbarProvider } from "@comet/admin";
import { ErrorDialogHandler, MasterLayout, MuiThemeProvider, RouterBrowserRouter, SnackbarProvider } from "@comet/admin";
import { BrevoConfigProvider } from "@comet/brevo-admin";
import {
AllCategories,
Expand All @@ -11,22 +11,26 @@ import {
createHttpClient,
CurrentUserProvider,
LocaleProvider,
SitePreview,
SitesConfigProvider,
} from "@comet/cms-admin";
import { css, Global } from "@emotion/react";
import { ContentScope } from "@src/common/ContentScopeProvider";
import { ContentScope, ContentScopeProvider } from "@src/common/ContentScopeProvider";
import { MasterRoutes } from "@src/common/MasterMenu";
import { getMessages } from "@src/lang";
import { theme } from "@src/theme";
import * as React from "react";
import { DndProvider } from "react-dnd";
import { HTML5Backend } from "react-dnd-html5-backend";
import { FormattedMessage, IntlProvider } from "react-intl";
import { Route, Switch } from "react-router";

import { createApolloClient } from "./common/apollo/createApolloClient";
import { MasterHeader } from "./common/MasterHeader";
import { AppMasterMenu } from "./common/MasterMenu";
import { createConfig } from "./config";
import { Link } from "./documents/links/Link";
import { Page } from "./documents/pages/Page";
import { Routes } from "./Routes";

const GlobalStyle = () => (
<Global
Expand Down Expand Up @@ -80,6 +84,7 @@ export function App() {
<SnackbarProvider>
<BrevoConfigProvider
value={{
scopeParts: ["domain", "language"],
apiUrl: config.apiUrl,
resolvePreviewUrlForScope: (scope: ContentScope) => {
return `${config.campaignUrl}/block-preview/${scope.domain}/${scope.language}`;
Expand All @@ -99,7 +104,21 @@ export function App() {
>
<RouterBrowserRouter>
<GlobalStyle />
<Routes />
<ContentScopeProvider>
{({ match }) => (
<Switch>
<Route
path={`${match.path}/preview`}
render={(props) => <SitePreview {...props} />}
/>
<Route>
<MasterLayout headerComponent={MasterHeader} menuComponent={AppMasterMenu}>
<MasterRoutes />
</MasterLayout>
</Route>
</Switch>
)}
</ContentScopeProvider>
</RouterBrowserRouter>
</CmsBlockContextProvider>
</BrevoConfigProvider>
Expand Down
101 changes: 0 additions & 101 deletions demo/admin/src/Routes.tsx

This file was deleted.

Loading
Loading