Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 5, 2024
2 parents de03017 + 3129c0b commit f622db9
Show file tree
Hide file tree
Showing 627 changed files with 5,363 additions and 2,601 deletions.
3 changes: 2 additions & 1 deletion demo/admin/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"extends": "@comet/eslint-config/react",
"ignorePatterns": ["schema.json", "src/fragmentTypes.json", "dist/**", "src/**/*.generated.ts"],
"rules": {
"@calm/react-intl/missing-formatted-message": "off"
"@calm/react-intl/missing-formatted-message": "off",
"react/react-in-jsx-scope": "off"
}
}
8 changes: 4 additions & 4 deletions demo/admin/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { ImportFromUnsplash } from "@src/dam/ImportFromUnsplash";
import { pageTreeCategories } from "@src/pageTree/pageTreeCategories";
import { theme } from "@src/theme";
import { HTML5toTouch } from "rdndmb-html5-to-touch";
import * as React from "react";
import { Component, Fragment } from "react";
import { DndProvider } from "react-dnd-multi-backend";
import * as ReactDOM from "react-dom";
import { FormattedMessage, IntlProvider } from "react-intl";
Expand All @@ -54,7 +54,7 @@ const config = createConfig();
const apolloClient = createApolloClient(config.apiUrl);
const apiClient = createHttpClient(config.apiUrl);

class App extends React.Component {
class App extends Component {
public static render(baseEl: Element): void {
ReactDOM.render(<App />, baseEl);
}
Expand Down Expand Up @@ -111,7 +111,7 @@ class App extends React.Component {
pageTreeDocumentTypes={pageTreeDocumentTypes}
additionalPageTreeNodeFragment={additionalPageTreeNodeFieldsFragment}
>
<React.Fragment>
<Fragment>
<GlobalStyle />
<ContentScopeProvider>
{({ match }) => (
Expand Down Expand Up @@ -141,7 +141,7 @@ class App extends React.Component {
</Switch>
)}
</ContentScopeProvider>
</React.Fragment>
</Fragment>
</CmsBlockContextProvider>
</SnackbarProvider>
</DndProvider>
Expand Down
24 changes: 12 additions & 12 deletions demo/admin/src/common/ComponentDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import {
} from "@comet/blocks-admin";
import { DamImageBlock, FinalFormToggleButtonGroup, PixelImageBlock } from "@comet/cms-admin";
import { Box, FormControlLabel, Grid, MenuItem, Typography } from "@mui/material";
import * as React from "react";
import { ReactNode, useState } from "react";

import { RichTextBlock } from "./blocks/RichTextBlock";

Expand Down Expand Up @@ -76,12 +76,12 @@ const ColumnsBlock = createColumnsBlock({
});

interface CustomSelectItemProps {
icon: React.ReactNode;
primary: React.ReactNode;
secondary: React.ReactNode;
icon: ReactNode;
primary: ReactNode;
secondary: ReactNode;
}

function CustomSelectItem({ icon, primary, secondary }: CustomSelectItemProps): React.ReactElement {
function CustomSelectItem({ icon, primary, secondary }: CustomSelectItemProps) {
return (
<Grid container spacing={4} alignItems="center">
<Grid item>
Expand All @@ -99,13 +99,13 @@ function CustomSelectItem({ icon, primary, secondary }: CustomSelectItemProps):
);
}

export function ComponentDemo(): React.ReactElement {
const [optionalBlockState, setOptionalBlockState] = React.useState(OptionalRichTextBlock.defaultValues());
const [pixelImageBlockState, setPixelImageBlockState] = React.useState(PixelImageBlock.defaultValues());
const [listBlockState, setListBlockState] = React.useState(ListBlock.defaultValues());
const [blocksBlockState, setBlocksBlockState] = React.useState(BlocksBlock.defaultValues());
const [columnsBlockState, setColumnsBlockState] = React.useState(ColumnsBlock.defaultValues());
const [imageBlockState, setImageBlockState] = React.useState(DamImageBlock.defaultValues());
export function ComponentDemo() {
const [optionalBlockState, setOptionalBlockState] = useState(OptionalRichTextBlock.defaultValues());
const [pixelImageBlockState, setPixelImageBlockState] = useState(PixelImageBlock.defaultValues());
const [listBlockState, setListBlockState] = useState(ListBlock.defaultValues());
const [blocksBlockState, setBlocksBlockState] = useState(BlocksBlock.defaultValues());
const [columnsBlockState, setColumnsBlockState] = useState(ColumnsBlock.defaultValues());
const [imageBlockState, setImageBlockState] = useState(DamImageBlock.defaultValues());

return (
<Stack topLevelTitle="Component demo">
Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/common/ContentScopeProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
useSitesConfig,
} from "@comet/cms-admin";
import { SitesConfig } from "@src/config";
import React from "react";

type Domain = "main" | "secondary" | string;
type Language = "en" | string;
Expand All @@ -30,7 +29,7 @@ export function useContentScopeConfig(p: ContentScopeConfigProps): void {
return useContentScopeConfigLibrary(p);
}

const ContentScopeProvider: React.FC<Pick<ContentScopeProviderProps, "children">> = ({ children }) => {
const ContentScopeProvider = ({ children }: Pick<ContentScopeProviderProps, "children">) => {
const sitesConfig = useSitesConfig<SitesConfig>();
const user = useCurrentUser();

Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/common/EditPageNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { gql } from "@apollo/client";
import { SelectField } from "@comet/admin";
import { createEditPageNode } from "@comet/cms-admin";
import { Box, Divider, MenuItem } from "@mui/material";
import * as React from "react";
import { FormattedMessage } from "react-intl";

export type { GQLPageTreeNodeAdditionalFieldsFragment } from "./EditPageNode.generated"; //re-export
Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/common/MasterHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { BuildEntry, ContentScopeControls, Header, UserHeaderItem } from "@comet/cms-admin";
import * as React from "react";

const MasterHeader: React.FC = () => {
const MasterHeader = () => {
return (
<Header>
<ContentScopeControls />
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/common/MasterMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ import { ProductsPage } from "@src/products/generated/ProductsPage";
import { ManufacturersPage as ManufacturersHandmadePage } from "@src/products/ManufacturersPage";
import ProductsHandmadePage from "@src/products/ProductsPage";
import ProductTagsPage from "@src/products/tags/ProductTagsPage";
import * as React from "react";
import { FormattedMessage } from "react-intl";
import { Redirect, RouteComponentProps } from "react-router-dom";

Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/common/blocks/LinkListBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { createListBlock } from "@comet/blocks-admin";
import { userGroupAdditionalItemFields } from "@src/userGroups/userGroupAdditionalItemFields";
import { UserGroupChip } from "@src/userGroups/UserGroupChip";
import { UserGroupContextMenuItem } from "@src/userGroups/UserGroupContextMenuItem";
import * as React from "react";
import { FormattedMessage } from "react-intl";

import { TextLinkBlock } from "./TextLinkBlock";
Expand Down
4 changes: 2 additions & 2 deletions demo/admin/src/common/blocks/SpaceBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { createSpaceBlock } from "@comet/blocks-admin";
import * as React from "react";
import { ReactNode } from "react";
import { FormattedMessage } from "react-intl";

const options: { value: string; label: React.ReactNode }[] = [
const options: { value: string; label: ReactNode }[] = [
{ value: "d150", label: <FormattedMessage id="spacing.d150" defaultMessage="Dynamic 150" /> },
{ value: "d200", label: <FormattedMessage id="spacing.d200" defaultMessage="Dynamic 200" /> },
{ value: "d250", label: <FormattedMessage id="spacing.d250" defaultMessage="Dynamic 250" /> },
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/common/blocks/customBlockCategories.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { BlockCategory } from "@comet/blocks-admin";
import React from "react";
import { FormattedMessage } from "react-intl";

const customBlockCategory = {
Expand Down
8 changes: 4 additions & 4 deletions demo/admin/src/dam/ImportFromUnsplash.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import { CancelButton, messages, SaveButton } from "@comet/admin";
import { useCurrentDamFolder, useDamAcceptedMimeTypes, useDamFileUpload } from "@comet/cms-admin";
import { Button, Dialog, DialogActions, DialogContent, DialogTitle } from "@mui/material";
import { styled } from "@mui/material/styles";
import * as React from "react";
import { useState } from "react";
import { FormattedMessage } from "react-intl";

import { getRandomUnsplashImage, UnsplashImage } from "./getRandomUnsplashImage";
import UnsplashIcon from "./UnsplashIcon";

export const ImportFromUnsplash: React.FC = () => {
export const ImportFromUnsplash = () => {
const { allAcceptedMimeTypes } = useDamAcceptedMimeTypes();
const { folderId } = useCurrentDamFolder();
const [isOpen, setIsOpen] = React.useState(false);
const [unsplashImage, setUnsplashImage] = React.useState<UnsplashImage>();
const [isOpen, setIsOpen] = useState(false);
const [unsplashImage, setUnsplashImage] = useState<UnsplashImage>();

const { uploadFiles } = useDamFileUpload({
acceptedMimetypes: allAcceptedMimeTypes,
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/dam/UnsplashIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { SvgIcon, SvgIconProps } from "@mui/material";
import * as React from "react";

export default function UnsplashIcon(props: SvgIconProps): JSX.Element {
return (
Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/dashboard/Dashboard.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { MainContent, Stack, Toolbar } from "@comet/admin";
import { ContentScopeIndicator, DashboardHeader, LatestBuildsDashboardWidget, useUserPermissionCheck } from "@comet/cms-admin";
import { Grid } from "@mui/material";
import * as React from "react";
import { useIntl } from "react-intl";

import backgroundImage1x from "./[email protected]";
import backgroundImage2x from "./[email protected]";
import { LatestContentUpdates } from "./LatestContentUpdates";

const Dashboard: React.FC = () => {
const Dashboard = () => {
const intl = useIntl();
const isAllowed = useUserPermissionCheck();
return (
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/dashboard/LatestContentUpdates.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { LatestContentUpdatesDashboardWidget } from "@comet/cms-admin";
import { useContentScope } from "@src/common/ContentScopeProvider";
import { GQLLatestContentUpdatesQueryVariables } from "@src/dashboard/LatestContentUpdates.generated";
import { categoryToUrlParam } from "@src/pageTree/pageTreeCategories";
import React from "react";

import { GQLLatestContentUpdatesQuery } from "./LatestContentUpdates.generated";

Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/links/EditLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { AdminComponentRoot } from "@comet/blocks-admin";
import { ContentScopeIndicator, createUsePage, PageName } from "@comet/cms-admin";
import { IconButton } from "@mui/material";
import { LinkBlock } from "@src/common/blocks/LinkBlock";
import * as React from "react";
import { useIntl } from "react-intl";

import { GQLEditLinkQuery, GQLEditLinkQueryVariables, GQLUpdateLinkMutation, GQLUpdateLinkMutationVariables } from "./EditLink.generated";
Expand Down Expand Up @@ -62,7 +61,7 @@ interface Props {
id: string;
}

export const EditLink: React.FC<Props> = ({ id }) => {
export const EditLink = ({ id }: Props) => {
const intl = useIntl();
const stackApi = useStackApi();

Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/links/Link.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { GQLLink, GQLLinkInput } from "@src/graphql.generated";
import { EditLink } from "@src/links/EditLink";
import { categoryToUrlParam } from "@src/pageTree/pageTreeCategories";
import gql from "graphql-tag";
import * as React from "react";
import { FormattedMessage } from "react-intl";

const rootBlocks = {
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/news/blocks/NewsDetailBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Field, FinalFormInput } from "@comet/admin";
import { BlockInterface, BlocksFinalForm, createBlockSkeleton } from "@comet/blocks-admin";
import { NewsDetailBlockData, NewsDetailBlockInput } from "@src/blocks.generated";
import * as React from "react";

type State = NewsDetailBlockData;

Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/news/blocks/NewsLinkBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { TextField } from "@comet/admin";
import { BlockInterface, BlocksFinalForm, createBlockSkeleton, LinkBlockInterface } from "@comet/blocks-admin";
import { NewsLinkBlockData, NewsLinkBlockInput } from "@src/blocks.generated";
import * as React from "react";

type State = NewsLinkBlockData;

Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/news/dependencies/NewsDependency.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { createDependencyMethods, DamImageBlock, DependencyInterface } from "@comet/cms-admin";
import { NewsContentBlock } from "@src/news/blocks/NewsContentBlock";
import * as React from "react";
import { FormattedMessage } from "react-intl";

export const NewsDependency: DependencyInterface = {
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pageTree/pageTreeCategories.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { AllCategories } from "@comet/cms-admin";
import { GQLPageTreeNodeCategory } from "@src/graphql.generated";
import { kebabCase, pascalCase } from "change-case";
import * as React from "react";
import { FormattedMessage } from "react-intl";

export const pageTreeCategories: AllCategories = [
Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/pages/EditPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { Button, IconButton } from "@mui/material";
import { SeoBlock } from "@src/common/blocks/SeoBlock";
import { useContentScope } from "@src/common/ContentScopeProvider";
import { GQLPageTreeNodeCategory } from "@src/graphql.generated";
import * as React from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useRouteMatch } from "react-router";

Expand Down Expand Up @@ -87,7 +86,7 @@ const usePage = createUsePage({
`,
});

export const EditPage: React.FC<Props> = ({ id, category }) => {
export const EditPage = ({ id, category }: Props) => {
const intl = useIntl();
const { pageState, rootBlocksApi, hasChanges, loading, dialogs, pageSaveButton, handleSavePage } = usePage({
pageId: id,
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/Page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { GQLPageTreeNodeAdditionalFieldsFragment } from "@src/common/EditPageNod
import { GQLPage, GQLPageInput } from "@src/graphql.generated";
import { categoryToUrlParam } from "@src/pageTree/pageTreeCategories";
import gql from "graphql-tag";
import * as React from "react";
import { FormattedMessage } from "react-intl";

import { EditPage } from "./EditPage";
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/PageContentBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { NewsDetailBlock } from "@src/news/blocks/NewsDetailBlock";
import { userGroupAdditionalItemFields } from "@src/userGroups/userGroupAdditionalItemFields";
import { UserGroupChip } from "@src/userGroups/UserGroupChip";
import { UserGroupContextMenuItem } from "@src/userGroups/UserGroupContextMenuItem";
import * as React from "react";

import { ColumnsBlock } from "./blocks/ColumnsBlock";
import { FullWidthImageBlock } from "./blocks/FullWidthImageBlock";
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/blocks/ColumnsBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
import { DamImageBlock } from "@comet/cms-admin";
import { HeadlineBlock } from "@src/common/blocks/HeadlineBlock";
import { RichTextBlock } from "@src/common/blocks/RichTextBlock";
import * as React from "react";
import { FormattedMessage } from "react-intl";

const ColumnsContentBlock = createBlocksBlock({
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/blocks/FullWidthImageBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { createCompositeBlock, createOptionalBlock } from "@comet/blocks-admin";
import { DamImageBlock } from "@comet/cms-admin";
import { customBlockCategory } from "@src/common/blocks/customBlockCategories";
import { RichTextBlock } from "@src/common/blocks/RichTextBlock";
import * as React from "react";
import { FormattedMessage } from "react-intl";

const FullWidthImageContentBlock = createOptionalBlock(RichTextBlock, {
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/blocks/MediaBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BlockCategory, createOneOfBlock } from "@comet/blocks-admin";
import { DamImageBlock, DamVideoBlock, YouTubeVideoBlock } from "@comet/cms-admin";
import * as React from "react";
import { FormattedMessage } from "react-intl";

export const MediaBlock = createOneOfBlock({
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/blocks/TeaserBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { BlockCategory, createCompositeBlock } from "@comet/blocks-admin";
import { DamImageBlock } from "@comet/cms-admin";
import { HeadlineBlock } from "@src/common/blocks/HeadlineBlock";
import { LinkListBlock } from "@src/common/blocks/LinkListBlock";
import React from "react";
import { FormattedMessage } from "react-intl";

const TeaserBlock = createCompositeBlock(
Expand Down
1 change: 0 additions & 1 deletion demo/admin/src/pages/blocks/VideoBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { BlockCategory, createOneOfBlock } from "@comet/blocks-admin";
import { DamVideoBlock, YouTubeVideoBlock } from "@comet/cms-admin";
import * as React from "react";
import { FormattedMessage } from "react-intl";

export const VideoBlock = createOneOfBlock({
Expand Down
3 changes: 1 addition & 2 deletions demo/admin/src/pages/mainMenu/MainMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { gql } from "@apollo/client";
import { Loading, Selected, Stack, StackPage, StackSwitch } from "@comet/admin";
import * as React from "react";
import { useIntl } from "react-intl";

import EditMainMenuItem, { editMainMenuItemFragment, GQLEditMainMenuItemFragment } from "./components/EditMainMenuItem";
Expand All @@ -16,7 +15,7 @@ const MAIN_MENU_ITEM_QUERY = gql`
${editMainMenuItemFragment}
`;

const MainMenu: React.FunctionComponent = () => {
const MainMenu = () => {
const intl = useIntl();

return (
Expand Down
14 changes: 7 additions & 7 deletions demo/admin/src/pages/mainMenu/components/EditMainMenuItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { Button } from "@mui/material";
import { RichTextBlock } from "@src/common/blocks/RichTextBlock";
import { useContentScope } from "@src/common/ContentScopeProvider";
import isEqual from "lodash.isequal";
import * as React from "react";
import { useEffect, useState } from "react";
import { FormattedMessage, useIntl } from "react-intl";
import { useRouteMatch } from "react-router-dom";

Expand Down Expand Up @@ -55,27 +55,27 @@ interface EditMainMenuItemProps {
type RichTextBlockState = BlockState<typeof RichTextBlock>;
type RichTextBlockOutput = BlockOutputApi<typeof RichTextBlock>;

const EditMainMenuItem: React.FunctionComponent<EditMainMenuItemProps> = ({ item }) => {
const EditMainMenuItem = ({ item }: EditMainMenuItemProps) => {
const previewApi = useBlockPreview();
const match = useRouteMatch();
const [updateMainMenuItem, { loading: saving, error: saveError }] = useMutation<
GQLUpdateMainMenuItemMutation,
GQLUpdateMainMenuItemMutationVariables
>(updateMainMenuItemMutation);
const [referenceContent, setReferenceContent] = React.useState<RichTextBlockOutput | null>(null);
const [hasChanges, setHasChanges] = React.useState(false);
const [content, setContent] = React.useState<RichTextBlockState | null>(null);
const [referenceContent, setReferenceContent] = useState<RichTextBlockOutput | null>(null);
const [hasChanges, setHasChanges] = useState(false);
const [content, setContent] = useState<RichTextBlockState | null>(null);
const { match: contentScopeMatch, scope } = useContentScope();
const siteConfig = useSiteConfig({ scope });
const intl = useIntl();
const blockContext = useCmsBlockContext();

React.useEffect(() => {
useEffect(() => {
setContent(item.content ? RichTextBlock.input2State(item.content) : null);
setReferenceContent(item.content ? RichTextBlock.state2Output(RichTextBlock.input2State(item.content)) : null);
}, [item]);

React.useEffect(() => {
useEffect(() => {
const equal = isEqual(referenceContent, content ? RichTextBlock.state2Output(content) : null);
setHasChanges(!equal);
}, [content, referenceContent]);
Expand Down
Loading

0 comments on commit f622db9

Please sign in to comment.