Skip to content

Commit

Permalink
Merge pull request #2239 from vivid-planet/merge-main-into-next
Browse files Browse the repository at this point in the history
Merge main into next
  • Loading branch information
johnnyomair authored Jul 4, 2024
2 parents a23d2a7 + 7121032 commit 10fadd6
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 30 deletions.
15 changes: 15 additions & 0 deletions .changeset/cyan-chicken-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
"@comet/cms-admin": minor
---

Add `buttonChildren` and `children` props to `UserHeaderItem`

This increases the flexibility of the `UserHeaderItem` component by allowing the `AppHeaderDropdown` label to be passed via `buttonChildren`. More buttons or other list items in the dropdown can be passed via `children`.

**Example:**
```tsx
<UserHeaderItem buttonChildren="Some custom label">
<Button variant="contained">Some custom button</Button>
<Button>Some custom button 2</Button>
</UserHeaderItem>
```
5 changes: 5 additions & 0 deletions .changeset/neat-paws-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/admin-icons": minor
---

Add `RteUppercase` icon
5 changes: 5 additions & 0 deletions .changeset/spotty-rules-brush.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/cms-api": patch
---

Add missing `@RequiredPermission` to `createZip` route
5 changes: 5 additions & 0 deletions .changeset/tiny-mangos-tease.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/blocks-admin": patch
---

Fix a validation error for default values in `YouTubeVideoBlock`
4 changes: 1 addition & 3 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,7 @@ jobs:

- uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/i18n.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ jobs:
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
path: "demo/admin/lang/comet-lang"

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ jobs:
test -f demo/site/lang/comet-demo-lang/site/en.json || echo "{}" > demo/site/lang/comet-demo-lang/site/en.json
test -f demo/site/lang/comet-demo-lang/site/de.json || echo "{}" > demo/site/lang/comet-demo-lang/site/de.json
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ jobs:
git config user.name github-actions
git config user.email github-actions@github.com
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: pnpm/action-setup@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v3
Expand Down
3 changes: 3 additions & 0 deletions packages/admin/admin-icons/icons/rte-uppercase.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const YouTubeVideoBlock: BlockInterface<YouTubeVideoBlockData, State, You

displayName: <FormattedMessage id="comet.blocks.youTubeVideo" defaultMessage="Video (YouTube)" />,

defaultValues: () => ({ youtubeIdentifier: "", autoplay: false, showControls: false, loop: false }),
defaultValues: () => ({ autoplay: false, showControls: false, loop: false }),

category: BlockCategory.Media,

Expand Down
9 changes: 6 additions & 3 deletions packages/admin/cms-admin/src/common/header/UserHeaderItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gql, useMutation } from "@apollo/client";
import { AppHeaderDropdown, Loading } from "@comet/admin";
import { AppHeaderDropdown, AppHeaderDropdownProps, Loading } from "@comet/admin";
import { Account, Info, Logout } from "@comet/admin-icons";
import { Box, Button as MUIButton, useMediaQuery, useTheme } from "@mui/material";
import { styled } from "@mui/material/styles";
Expand Down Expand Up @@ -34,10 +34,12 @@ const signOutMutation = gql`

interface UserHeaderItemProps {
aboutModalLogo?: React.ReactElement;
buttonChildren?: AppHeaderDropdownProps["buttonChildren"];
children?: React.ReactNode;
}

export function UserHeaderItem(props: UserHeaderItemProps): React.ReactElement {
const { aboutModalLogo } = props;
const { aboutModalLogo, buttonChildren, children } = props;

const theme = useTheme();
const isMobile = useMediaQuery(theme.breakpoints.down("md"));
Expand All @@ -47,7 +49,7 @@ export function UserHeaderItem(props: UserHeaderItemProps): React.ReactElement {
const [signOut, { loading: isSigningOut }] = useMutation<GQLSignOutMutation>(signOutMutation);

return (
<AppHeaderDropdown buttonChildren={isMobile ? <Account /> : user.name} startIcon={isMobile ? undefined : <Account />}>
<AppHeaderDropdown buttonChildren={buttonChildren ?? (isMobile ? <Account /> : user.name)} startIcon={isMobile ? undefined : <Account />}>
<DropdownContent padding={4}>
<Button
fullWidth={true}
Expand All @@ -59,6 +61,7 @@ export function UserHeaderItem(props: UserHeaderItemProps): React.ReactElement {
>
<FormattedMessage id="comet.about" defaultMessage="About" />
</Button>
{children}
<Separator />
{isSigningOut ? (
<Loading />
Expand Down
2 changes: 2 additions & 0 deletions packages/api/cms-api/src/dam/files/folders.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { Controller, ForbiddenException, Get, Inject, NotFoundException, Param,
import { Response } from "express";

import { GetCurrentUser } from "../../auth/decorators/get-current-user.decorator";
import { RequiredPermission } from "../../user-permissions/decorators/required-permission.decorator";
import { CurrentUser } from "../../user-permissions/dto/current-user";
import { ACCESS_CONTROL_SERVICE } from "../../user-permissions/user-permissions.constants";
import { AccessControlServiceInterface } from "../../user-permissions/user-permissions.types";
Expand All @@ -14,6 +15,7 @@ export class FoldersController {
@Inject(ACCESS_CONTROL_SERVICE) private accessControlService: AccessControlServiceInterface,
) {}

@RequiredPermission(["dam"], { skipScopeCheck: true }) // Scope is checked in method
@Get("/:folderId/zip")
async createZip(@Param("folderId") folderId: string, @Res() res: Response, @GetCurrentUser() user: CurrentUser): Promise<void> {
const folder = await this.foldersService.findOneById(folderId);
Expand Down
2 changes: 1 addition & 1 deletion storybook/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
],
"scripts": {
"build-storybook": "build-storybook",
"storybook": "start-storybook -p 26638",
"storybook": "start-storybook -p 26638 --no-version-updates",
"lint": "run-p lint:eslint lint:tsc",
"lint:eslint": "eslint --max-warnings 0 src/ package.json",
"lint:tsc": "tsc --noEmit"
Expand Down
8 changes: 4 additions & 4 deletions storybook/src/admin/form/DependentAsyncSelects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ storiesOf("@comet/admin/form", module)
<AsyncSelectField
name="manufacturer"
loadOptions={async () => {
const { data } = await client.query({
const { data } = await client.query<{ manufacturers: Manufacturer[] }>({
query: gql`
query Manufacturers {
manufacturers {
Expand All @@ -43,14 +43,14 @@ storiesOf("@comet/admin/form", module)

return data.manufacturers;
}}
getOptionLabel={(option: Manufacturer) => option.name}
getOptionLabel={(option) => option.name}
label="Manufacturer"
fullWidth
/>
<AsyncSelectField
name="product"
loadOptions={async () => {
const { data } = await client.query({
const { data } = await client.query<{ products: Product[] }>({
query: gql`
query Products($manufacturer: ID) {
products(manufacturer: $manufacturer) {
Expand All @@ -64,7 +64,7 @@ storiesOf("@comet/admin/form", module)

return data.products;
}}
getOptionLabel={(option: Product) => option.name}
getOptionLabel={(option) => option.name}
label="Product"
fullWidth
disabled={!values.manufacturer}
Expand Down

0 comments on commit 10fadd6

Please sign in to comment.