Skip to content

Commit

Permalink
Merge branch 'main' into admin-gen-configurable_mergehaufen-2024-08-08
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Ho committed Nov 15, 2024
2 parents 5a631b9 + a168e55 commit de549bf
Show file tree
Hide file tree
Showing 67 changed files with 1,173 additions and 821 deletions.
5 changes: 5 additions & 0 deletions .changeset/curvy-radios-study.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin": patch
---

Open collapsible menu item on refresh if its child or sub-child is selected
2 changes: 2 additions & 0 deletions demo/admin/src/pages/blocks/ColumnsBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
} 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 { RichTextBlock } from "@src/common/blocks/RichTextBlock";
import { FormattedMessage } from "react-intl";

Expand All @@ -18,6 +19,7 @@ const ColumnsContentBlock = createBlocksBlock({
richtext: RichTextBlock,
headline: HeadlineBlock,
image: DamImageBlock,
linkList: LinkListBlock,
},
});

Expand Down
5 changes: 5 additions & 0 deletions demo/admin/src/pages/blocks/TeaserBlock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ 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 { ColumnsBlock } from "@src/pages/blocks/ColumnsBlock";
import { FormattedMessage } from "react-intl";

const TeaserBlock = createCompositeBlock(
Expand Down Expand Up @@ -31,6 +32,10 @@ const TeaserBlock = createCompositeBlock(
title: <FormattedMessage id="blocks.teaser.buttons" defaultMessage="Buttons" />,
nested: true,
},
columns: {
block: ColumnsBlock,
title: <FormattedMessage id="blocks.teaser.columns" defaultMessage="Columns" />,
},
},
},
(block) => {
Expand Down
18 changes: 16 additions & 2 deletions demo/api/block-meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@
"space": "Space",
"richtext": "RichText",
"headline": "Headline",
"image": "DamImage"
"image": "DamImage",
"linkList": "LinkList"
},
"nullable": false
}
Expand Down Expand Up @@ -150,7 +151,8 @@
"space": "Space",
"richtext": "RichText",
"headline": "Headline",
"image": "DamImage"
"image": "DamImage",
"linkList": "LinkList"
},
"nullable": false
}
Expand Down Expand Up @@ -2046,6 +2048,12 @@
"kind": "Block",
"block": "LinkList",
"nullable": false
},
{
"name": "columns",
"kind": "Block",
"block": "Columns",
"nullable": false
}
],
"inputFields": [
Expand All @@ -2072,6 +2080,12 @@
"kind": "Block",
"block": "LinkList",
"nullable": false
},
{
"name": "columns",
"kind": "Block",
"block": "Columns",
"nullable": false
}
]
},
Expand Down
10 changes: 5 additions & 5 deletions demo/api/src/config/environment-variables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,23 +79,23 @@ export class EnvironmentVariables {
@IsString()
BLOB_STORAGE_DIRECTORY_PREFIX: string;

@ValidateIf((v) => v.DAM_STORAGE_DRIVER === "s3")
@ValidateIf((v) => v.BLOB_STORAGE_DRIVER === "s3")
@IsString()
S3_REGION: string;

@ValidateIf((v) => v.DAM_STORAGE_DRIVER === "s3")
@ValidateIf((v) => v.BLOB_STORAGE_DRIVER === "s3")
@IsString()
S3_ENDPOINT: string;

@ValidateIf((v) => v.DAM_STORAGE_DRIVER === "s3")
@ValidateIf((v) => v.BLOB_STORAGE_DRIVER === "s3")
@IsString()
S3_ACCESS_KEY_ID: string;

@ValidateIf((v) => v.DAM_STORAGE_DRIVER === "s3")
@ValidateIf((v) => v.BLOB_STORAGE_DRIVER === "s3")
@IsString()
S3_SECRET_ACCESS_KEY: string;

@ValidateIf((v) => v.DAM_STORAGE_DRIVER === "s3")
@ValidateIf((v) => v.BLOB_STORAGE_DRIVER === "s3")
@IsString()
S3_BUCKET: string;

Expand Down
2 changes: 2 additions & 0 deletions demo/api/src/pages/blocks/columns.block.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ColumnsBlockFactory, createBlocksBlock, SpaceBlock } from "@comet/blocks-api";
import { DamImageBlock } from "@comet/cms-api";
import { LinkListBlock } from "@src/common/blocks/link-list.block";
import { RichTextBlock } from "@src/common/blocks/rich-text.block";

import { HeadlineBlock } from "./headline.block";
Expand All @@ -11,6 +12,7 @@ const ColumnsContentBlock = createBlocksBlock(
richtext: RichTextBlock,
headline: HeadlineBlock,
image: DamImageBlock,
linkList: LinkListBlock,
},
},
"ColumnsContent",
Expand Down
7 changes: 7 additions & 0 deletions demo/api/src/pages/blocks/teaser.block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
} from "@comet/blocks-api";
import { DamImageBlock } from "@comet/cms-api";
import { LinkListBlock } from "@src/common/blocks/link-list.block";
import { ColumnsBlock } from "@src/pages/blocks/columns.block";

import { HeadlineBlock } from "./headline.block";

Expand All @@ -26,6 +27,9 @@ class TeaserBlockData extends BlockData {

@ChildBlock(LinkListBlock)
buttons: ExtractBlockData<typeof LinkListBlock>;

@ChildBlock(ColumnsBlock)
columns: ExtractBlockData<typeof ColumnsBlock>;
}

class TeaserBlockInput extends BlockInput {
Expand All @@ -41,6 +45,9 @@ class TeaserBlockInput extends BlockInput {
@ChildBlockInput(LinkListBlock)
buttons: ExtractBlockInput<typeof LinkListBlock>;

@ChildBlockInput(ColumnsBlock)
columns: ExtractBlockInput<typeof ColumnsBlock>;

transformToBlockData(): BlockDataInterface {
return inputToData(TeaserBlockData, this);
}
Expand Down
2 changes: 2 additions & 0 deletions demo/site-pages/src/blocks/ColumnsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { BlocksBlock, PropsWithData, SupportedBlocks, withPreview } from "@comet/cms-site";
import { ColumnsBlockData, ColumnsContentBlockData } from "@src/blocks.generated";
import { LinkListBlock } from "@src/blocks/LinkListBlock";
import styled from "styled-components";

import { DamImageBlock } from "./DamImageBlock";
Expand All @@ -12,6 +13,7 @@ const supportedBlocks: SupportedBlocks = {
richtext: (props) => <RichTextBlock data={props} />,
headline: (props) => <HeadlineBlock data={props} />,
image: (props) => <DamImageBlock data={props} aspectRatio="inherit" />,
linkList: (props) => <LinkListBlock data={props} />,
};

const ColumnsContentBlock = withPreview(
Expand Down
4 changes: 3 additions & 1 deletion demo/site-pages/src/documents/pages/blocks/TeaserBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
import { PropsWithData, withPreview } from "@comet/cms-site";
import { TeaserBlockData } from "@src/blocks.generated";
import { ColumnsBlock } from "@src/blocks/ColumnsBlock";
import { DamImageBlock } from "@src/blocks/DamImageBlock";
import { HeadlineBlock } from "@src/blocks/HeadlineBlock";
import { LinkListBlock } from "@src/blocks/LinkListBlock";
import styled from "styled-components";

const TeaserBlock = withPreview(
({ data: { headline, image, links, buttons } }: PropsWithData<TeaserBlockData>) => {
({ data: { headline, image, links, buttons, columns } }: PropsWithData<TeaserBlockData>) => {
return (
<Root>
<HeadlineBlock data={headline} />
<DamImageBlock data={image} aspectRatio="1x1" />
<LinkListBlock data={links} />
<LinkListBlock data={buttons} />
<ColumnsBlock data={columns} />
</Root>
);
},
Expand Down
22 changes: 0 additions & 22 deletions demo/site/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,6 @@ const cometConfig = require("./src/comet-config.json");
* @type {import('next').NextConfig}
**/
const nextConfig = {
async rewrites() {
return [
{
source: "/dam/:path*",
destination: process.env.API_URL + "/dam/:path*",
},
];
},
async redirects() {
const adminUrl = process.env.ADMIN_URL;

if (!adminUrl) {
throw Error("ADMIN_URL is not defined");
}
return [
{
source: "/admin",
destination: adminUrl,
permanent: false,
},
];
},
images: {
deviceSizes: cometConfig.dam.allowedImageSizes,
},
Expand Down
2 changes: 2 additions & 0 deletions demo/site/src/blocks/ColumnsBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";
import { BlocksBlock, PropsWithData, SupportedBlocks, withPreview } from "@comet/cms-site";
import { ColumnsBlockData, ColumnsContentBlockData } from "@src/blocks.generated";
import { LinkListBlock } from "@src/blocks/LinkListBlock";
import styled from "styled-components";

import { DamImageBlock } from "./DamImageBlock";
Expand All @@ -13,6 +14,7 @@ const supportedBlocks: SupportedBlocks = {
richtext: (props) => <RichTextBlock data={props} />,
headline: (props) => <HeadlineBlock data={props} />,
image: (props) => <DamImageBlock data={props} aspectRatio="inherit" />,
linkList: (props) => <LinkListBlock data={props} />,
};

const ColumnsContentBlock = withPreview(
Expand Down
4 changes: 3 additions & 1 deletion demo/site/src/documents/pages/blocks/TeaserBlock.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
"use client";
import { PropsWithData, withPreview } from "@comet/cms-site";
import { TeaserBlockData } from "@src/blocks.generated";
import { ColumnsBlock } from "@src/blocks/ColumnsBlock";
import { DamImageBlock } from "@src/blocks/DamImageBlock";
import { HeadlineBlock } from "@src/blocks/HeadlineBlock";
import { LinkListBlock } from "@src/blocks/LinkListBlock";
import styled from "styled-components";

const TeaserBlock = withPreview(
({ data: { headline, image, links, buttons } }: PropsWithData<TeaserBlockData>) => {
({ data: { headline, image, links, buttons, columns } }: PropsWithData<TeaserBlockData>) => {
return (
<Root>
<HeadlineBlock data={headline} />
<DamImageBlock data={image} aspectRatio="1x1" />
<LinkListBlock data={links} />
<LinkListBlock data={buttons} />
<ColumnsBlock data={columns} />
</Root>
);
},
Expand Down
8 changes: 8 additions & 0 deletions demo/site/src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export async function middleware(request: NextRequest) {
return NextResponse.rewrite(new URL(predefinedPageRewrite, request.url));
}

if (pathname.startsWith("/dam/")) {
return NextResponse.rewrite(new URL(`${process.env.API_URL_INTERNAL}${request.nextUrl.pathname}`));
}

if (request.nextUrl.pathname === "/admin" && process.env.ADMIN_URL) {
return NextResponse.redirect(new URL(process.env.ADMIN_URL));
}

return NextResponse.next();
}

Expand Down
2 changes: 2 additions & 0 deletions packages/admin/admin-babel-preset/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @comet/admin-babel-preset

## 7.7.0

## 7.6.0

## 7.5.0
Expand Down
2 changes: 1 addition & 1 deletion packages/admin/admin-babel-preset/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@comet/admin-babel-preset",
"version": "7.6.0",
"version": "7.7.0",
"repository": {
"type": "git",
"url": "https://github.com/vivid-planet/comet",
Expand Down
7 changes: 7 additions & 0 deletions packages/admin/admin-color-picker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @comet/admin-color-picker

## 7.7.0

### Patch Changes

- @comet/admin@7.7.0
- @comet/admin-icons@7.7.0

## 7.6.0

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/admin-color-picker/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@comet/admin-color-picker",
"version": "7.6.0",
"version": "7.7.0",
"repository": {
"type": "git",
"url": "https://github.com/vivid-planet/comet",
Expand All @@ -26,8 +26,8 @@
"start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput"
},
"dependencies": {
"@comet/admin": "workspace:^7.6.0",
"@comet/admin-icons": "workspace:^7.6.0",
"@comet/admin": "workspace:^7.7.0",
"@comet/admin-icons": "workspace:^7.7.0",
"clsx": "^1.1.1",
"react-colorful": "^5.5.1",
"tinycolor2": "^1.4.1",
Expand All @@ -36,8 +36,8 @@
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.20.12",
"@comet/admin-babel-preset": "workspace:^7.6.0",
"@comet/eslint-config": "workspace:^7.6.0",
"@comet/admin-babel-preset": "workspace:^7.7.0",
"@comet/eslint-config": "workspace:^7.7.0",
"@mui/material": "^5.0.0",
"@types/react": "^17.0.0",
"@types/react-dom": "^17.0.0",
Expand Down
7 changes: 7 additions & 0 deletions packages/admin/admin-date-time/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# @comet/admin-date-time

## 7.7.0

### Patch Changes

- @comet/admin@7.7.0
- @comet/admin-icons@7.7.0

## 7.6.0

### Patch Changes
Expand Down
10 changes: 5 additions & 5 deletions packages/admin/admin-date-time/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@comet/admin-date-time",
"version": "7.6.0",
"version": "7.7.0",
"repository": {
"type": "git",
"url": "https://github.com/vivid-planet/comet",
Expand All @@ -26,8 +26,8 @@
"start:types": "tsc --project ./tsconfig.json --emitDeclarationOnly --watch --preserveWatchOutput"
},
"dependencies": {
"@comet/admin": "workspace:^7.6.0",
"@comet/admin-icons": "workspace:^7.6.0",
"@comet/admin": "workspace:^7.7.0",
"@comet/admin-icons": "workspace:^7.7.0",
"@mui/utils": "^5.4.1",
"clsx": "^1.1.1",
"date-fns": "^2.28.0",
Expand All @@ -36,8 +36,8 @@
"devDependencies": {
"@babel/cli": "^7.17.6",
"@babel/core": "^7.20.12",
"@comet/admin-babel-preset": "workspace:^7.6.0",
"@comet/eslint-config": "workspace:^7.6.0",
"@comet/admin-babel-preset": "workspace:^7.7.0",
"@comet/eslint-config": "workspace:^7.7.0",
"@mui/material": "^5.0.0",
"@types/react": "^17.0",
"@types/react-date-range": "^1.4.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/admin/admin-icons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# @comet/admin-icons

## 7.7.0

## 7.6.0

## 7.5.0
Expand Down
Loading

0 comments on commit de549bf

Please sign in to comment.