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

Merge next into feature/refactor-admin-component-theming #1753

Conversation

jamesricky
Copy link
Contributor

No description provided.

johnnyomair and others added 30 commits January 4, 2024 11:49
Merge `main` into `feature/translation-module`
Wrap a component with a `ContentTranslationServiceProvider` to add
support for content translation to all underlying `FinalFormInput`
inputs.
Wrap a component with a `ContentTranslationServiceProvider` to add
support for content translation to all underlying `FinalFormInput`
inputs.
…n-feature-branch

Merge main (v6) into translation feature branch
---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…set to `false` in the decorator (#1674)

https://github.com/vivid-planet/comet/assets/118435139/c38eece2-afcd-487c-80f3-ffe02e7eed87



COM-419

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
This reverts commit 91885fb which
initially was already merged in the current main but then reverted. This
PR readds it again.
These types of error shouldn't normally appear if the AuthProxy is
configured correctly. However, if it happens this improves the error
messaging when in an ErrorBoundary or CurrentUserProvider (which
normally is the outermost component which calls the API).

Also throw the correct Exception in the CometGuard and append the
underlying error message (though don't show it to the user as like
mentioned before this normally should not happen).

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Removes the unnecessary layer between auth-strategies and the
CurrentUser-object. Since the UserPermissionsModule is mandatory by any
means it is allowed for it to provide the one and only CurrentUser-DTO.

This change is mainly internal facing. However, the usage of 
CurrentUserInterface has to be replace by CurrentUser.
-   Use theme wherever possible
-   Move styles where they're more fitting
-   Fix some paddings
Allows easier migration as the userService is only needed for
the UserPermissions administration panel
Fix `validateUrl` validator by using `isURL` instead of `isHref`
validation.
…t a InputType class (#1688)

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…alidation functions (#1710)

Usage:
```
        {
            type: "text",
            name: "title",
            validate: { name: "validateTitle", import: "./validateTitle" },
        },
```

see also demo in this pr and it's generated code
…1708)

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…1689)

Support `helperText` `Field` prop in Forms
<details><summary>Screenshot of Demo:</summary>
<p>

<img width="685" alt="Screenshot 2024-02-15 at 09 06 28"
src="https://github.com/vivid-planet/comet/assets/122883866/ca0a1c5b-fc10-4940-83a8-6788e6b4ab18">

</p>
</details> 

- [ ] Add changeset (if necessary)

---------

Co-authored-by: Niko Sams <niko.sams@gmail.com>
Use new field components to simplify forms. 

New available field components: 

-   TextField
-   TextAreaField
-   SearchField
-   SelectField
-   CheckboxField
-   SwitchField
-   ColorField
-   DateField
-   DateRangeField
-   TimeField
-   TimeRangeField
-   DateTimeField

---------

Co-authored-by: Julia Wegmayr <julia.wegmayr@vivid-planet.com>
### Description
In this PR IconButtons in the BlocksBlock header are exchanged to
RowActionsItems to add tooltips. Also, slight spacing adjustments were
made.

### Screenshots/ Screen Recordings
#### Before

https://github.com/vivid-planet/comet/assets/56400587/bae9bec3-829e-449e-b7dc-155edca4dcf9

#### After

https://github.com/vivid-planet/comet/assets/56400587/df7e2bb1-6f7b-46e5-8a8a-426933e35688

---------

Co-authored-by: Thomas Dax <thomas.dax@vivid-planet.com>
Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Add loading state for edit `StackPage` in `PagesPage`

Prevents flash of "Document not found" error message when reloading the
page editor

---

Previously:



https://github.com/vivid-planet/comet/assets/13380047/8f401034-f5a3-40df-a52e-7039a936cef7


Now:



https://github.com/vivid-planet/comet/assets/13380047/ac68b2ca-71b3-4c9e-9a9f-676dfb189b2b


---

Closes COM-469
COM-202 , COM-203


https://github.com/vivid-planet/comet/assets/118435139/c230b360-c8ea-42d0-af0e-901e53ec172e

## Test custom inline styles: 

<details>
    <summary>Used customInlineStyles for RichTextBlock</summary>

```tsc
export const RichTextBlock = createRichTextBlock({
    link: LinkBlock,
    rte: {
        customInlineStyles: {
            HIGHLIGHT: {
                label: "Highlight!",
                icon: Highlight,
                style: {
                    backgroundColor: "yellow",
                },
            },
        },
    },
});
```

</details>


https://github.com/vivid-planet/comet/assets/118435139/bea488ec-99f7-448b-a9e0-c2d1e67580c3

## ⚠️ Note: The translation tool has to be smart enough to ignore the
html tags!

![Screenshot 2024-02-01 at 09 08
30](https://github.com/vivid-planet/comet/assets/118435139/26660266-990b-434e-9c50-b7eb387a54b4)

<details>
    <summary>External+News Link FinalFormInput disable Button</summary>

# dbe8ae3


https://github.com/vivid-planet/comet/assets/118435139/b85f5753-1619-4ccb-9634-4dc201221799
    
</details>
Merge main into feature/translation-module
…gn (#1716)

Also remove dialog sizes above MD from story. 
Sizes above 1024px (other than `fullWidth`) should not be used,
according to the design guidelines.
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @comet/admin@6.1.0

### Minor Changes

-   b35bb8d: Add basis for content translation

Wrap a component with a `ContentTranslationServiceProvider` to add
support for content translation to all underlying `FinalFormInput`
inputs.

    ```tsx
    <ContentTranslationServiceProvider
        enabled={true}
        translate={async function (text: string): Promise<string> {
            return yourTranslationFnc(text);
        }}
    >
        ...
    </ContentTranslationServiceProvider>
    ```

You can disable translation for a specific `FinalFormInput` by using the
`disableContentTranslation` prop.

    ```diff
    <Field
        required
        fullWidth
        name="myField"
        component={FinalFormInput}
label={<FormattedMessage id="myField" defaultMessage="My Field" />}
    +   disableContentTranslation
    />
    ```

- 8eb1375: Add `SaveBoundary` and `SaveBoundarySaveButton` that helps
implementing multiple forms with a centralized save button

Render a `Savable` Component anywhere below a `SaveBoundary`. For
`FinalForm` this hasn't to be done manually.

-   a4fac91: Rework `Alert` component

    -   Use theme wherever possible
    -   Move styles where they're more fitting
    -   Fix some paddings

### Patch Changes

- dcfa03c: Fix a crash when using the `Alert` component inside a MUI
`Snackbar`
-   Updated dependencies [08e0da0]
    -   @comet/admin-icons@6.1.0

## @comet/admin-rte@6.1.0

### Minor Changes

-   f1fc9e2: Add support for content translation

### Patch Changes

-   Updated dependencies [dcfa03c]
-   Updated dependencies [08e0da0]
-   Updated dependencies [b35bb8d]
-   Updated dependencies [8eb1375]
-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0
    -   @comet/admin-icons@6.1.0

## @comet/admin-theme@6.1.0

### Minor Changes

-   a4fac91: Rework `Alert` component

    -   Use theme wherever possible
    -   Move styles where they're more fitting
    -   Fix some paddings

### Patch Changes

-   Updated dependencies [08e0da0]
    -   @comet/admin-icons@6.1.0

## @comet/cms-api@6.1.0

### Minor Changes

- 7ea43eb: Make the `UserService`-option of the `UserPermissionsModule`
optional.

    The service is still necessary though for the Administration-Panel.

- 86cd5c6: Allow a callback for the `availableContentScopes`-option of
the `UserPermissionsModule`

Please be aware that when using this possibility to make sure to cache
the
    response properly as this is called for every request to the API.

- 737ab3b: Allow returning multiple content scopes in
`ScopedEntity`-decorator

-   f416510: Remove `CurrentUserLoader` and `CurrentUserInterface`

Overriding the the current user in the application isn't supported
anymore when using the new `UserPermissionsModule`, which provides the
current user DTO itself.

### Patch Changes

- ef84331: Fix type of @RequiredPermission to accept a non-array string
for a single permission
- 8e158f8: Add missing `@RequiredPermission()` decorator to
`FileLicensesResolver`
- 5018441: API Generator: Add missing `scope` argument and filter to
`<entity>BySlug` query
- 1f6c58e: API Generator: support GraphQLJSONObject input for fields
that are not a InputType class
    -   @comet/blocks-api@6.1.0

## @comet/admin-color-picker@6.1.0

### Patch Changes

-   Updated dependencies [dcfa03c]
-   Updated dependencies [08e0da0]
-   Updated dependencies [b35bb8d]
-   Updated dependencies [8eb1375]
-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0
    -   @comet/admin-icons@6.1.0

## @comet/admin-date-time@6.1.0

### Patch Changes

-   Updated dependencies [dcfa03c]
-   Updated dependencies [08e0da0]
-   Updated dependencies [b35bb8d]
-   Updated dependencies [8eb1375]
-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0
    -   @comet/admin-icons@6.1.0

## @comet/admin-icons@6.1.0

### Patch Changes

-   08e0da0: Fix icons inside tooltips by forwarding the ref

## @comet/admin-react-select@6.1.0

### Patch Changes

-   Updated dependencies [dcfa03c]
-   Updated dependencies [b35bb8d]
-   Updated dependencies [8eb1375]
-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0

## @comet/blocks-admin@6.1.0

### Patch Changes

-   Updated dependencies [dcfa03c]
-   Updated dependencies [08e0da0]
-   Updated dependencies [b35bb8d]
-   Updated dependencies [8eb1375]
-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0
    -   @comet/admin-icons@6.1.0

## @comet/cms-admin@6.1.0

### Patch Changes

-   7ea5f61: Use `useCurrentUser` hook where possible

-   693cbdb: Add loading state for edit `StackPage` in `PagesPage`

Prevents flash of "Document not found" error message when reloading the
page editor

-   Updated dependencies [dcfa03c]

-   Updated dependencies [08e0da0]

-   Updated dependencies [b35bb8d]

-   Updated dependencies [f1fc9e2]

-   Updated dependencies [8eb1375]

-   Updated dependencies [a4fac91]
    -   @comet/admin@6.1.0
    -   @comet/admin-icons@6.1.0
    -   @comet/admin-rte@6.1.0
    -   @comet/admin-theme@6.1.0
    -   @comet/admin-date-time@6.1.0
    -   @comet/blocks-admin@6.1.0

## @comet/eslint-config@6.1.0

### Patch Changes

-   @comet/eslint-plugin@6.1.0

## @comet/admin-babel-preset@6.1.0



## @comet/blocks-api@6.1.0



## @comet/cli@6.1.0



## @comet/eslint-plugin@6.1.0



## @comet/cms-site@6.1.0

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
github-actions and others added 16 commits February 20, 2024 23:50
The name `isHref` is too specific for a link target, because we can't
always expect a HTML anchor element, since Comet DXP is headless. This
PR renames the `isHref` validator, the `IsHref` decorator and the
`IsHrefConstraint` respectively to `isLinkTarget`, `IsLinkTarget` and
`IsLinkTargetConstraint`.

---------

Co-authored-by: Thomas Dax <thomas.dax@vivid-planet.com>
- `packageDimensions` was nullable, although the database fields aren't
nullable (caused an DB error if null was saved)
- Admin Generator (present and future) doesn't support nested fields
(for future it is WIP, present will never get it)
- Easy solution: remove it
- #1729 will showcase nested fields and everything (as replacement for
packageDimensions)
- add "price" input field as it is required by the api
- add missing toolbar including save button in add form

---

Closes COM-460

---------

Co-authored-by: Phillip Lechenauer <phillip.lechenauer@vivid-planet.com>
Co-authored-by: Niko Sams <ns@vivid-planet.com>
Co-authored-by: Niko Sams <niko.sams@gmail.com>
… of SVGs (#1732)

COM-366  
Change the icon generator to accept icons with more than one path, as
well as circles etc. and more complex structures like:
```
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="none" viewBox="0 0 16 16">
  <g clip-path="url(#a)">
    <path fill="#242424" fill-rule="evenodd" d="M7.529.401a.5.5 0 0 1 .275.082l.076.06 3.647 3.574a.5.5 0 0 1-.63.772l-.07-.058-3.501-3.43-5.99.015.003 5.968 7.474 7.475 5.994-5.994-1.578-1.681a.5.5 0 0 1-.038-.64l.06-.067a.5.5 0 0 1 .64-.038l.067.06 1.91 2.034a.5.5 0 0 1 .046.628l-.056.068-6.69 6.69a.5.5 0 0 1-.639.058l-.069-.057L.486 7.945a.5.5 0 0 1-.14-.274l-.007-.08L.335.918a.5.5 0 0 1 .41-.492l.09-.008L7.528.4ZM5 4a1 1 0 1 1 0 2 1 1 0 0 1 0-2Z" clip-rule="evenodd"/>
  </g>
  <defs>
    <clipPath id="a">
      <path fill="#fff" d="M0 0h16v16H0z"/>
    </clipPath>
  </defs>
</svg>
```
The new icons have the same structure as the input svg files but without
the `fill` prop. All other props are kept.
I tested resizing and coloring, both work.

---------

Co-authored-by: Phillip Lechenauer <phillip.lechenauer@vivid-planet.com>
Adds dependency
https://github.com/golevelup/nestjs/tree/master/packages/discovery

We lose code completion in RequiredPermission-decorator and
getPermissionsForUser as there are only strings but that's not a huge
deal as the system gets much more flexible.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
Co-authored-by: Ben-Ho <bh@vivid-planet.com>
`demo/site/src/blocks/seo` was moved to the `@comet/cms-site` package.
Additionally, an open graph image resolver function
(`resolveOpenGraphImageUrlTemplate`) was added as prop. It ensures that
if the open graph image block is custom, a function also has to be
passed that can resolve object and return the url template as string.

---------

Co-authored-by: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com>
…cus (#1745)

Prevent the document editor from losing its state when (re)gaining focus

In v6.1.0 a loading indicator was added to the document editor (in
`PagesPage`).
This had an unwanted side effect: Focusing the edit page automatically
causes a GraphQL request to check for a newer version of the document.
This request also caused the loading indicator to render, thus
unmounting the editor (`EditComponent`). Consequently, the local state
of the editor was lost.

This didn't strike when testing locally because the focus aware polling
is disabled in dev mode.

---

Before:


https://github.com/vivid-planet/comet/assets/13380047/d72c7286-e5f3-434c-ad9c-5c32b95a6135

After:


https://github.com/vivid-planet/comet/assets/13380047/c2658da2-b8e6-438d-b770-c108ac21a344

---

Closes COM-482
for a usecase with double-nested fields. Added second version using
embeddable as this should also be considered/tested in some cases. I'm
not sure if the naming should be "real" (like renaming
addressAsEmbeddable e.g. "officeAddress") as the idea behind the second
version is to test the same structure but with a different technique.

```
query QueryManufacturer {
  manufacturer(id:"8251c3ad-07f4-4493-9d5b-42fa7ea73b98") {
    id
    address {
      street
      streetNumber // optional
      zip
      country
      alternativeAddress { // optional
        street
        streetNumber // optional
        zip
        country
      }
    }
    addressAsEmbeddable {
      street
      streetNumber // optional
      zip
      country
      alternativeAddress {
        street
        streetNumber // optional
        zip
        country
      }
    }
  }
}
```
Embedded fields can only be optional if all nested fields also are
optional. In case of manufacturer only streetNumber is optional.
@jamesricky jamesricky self-assigned this Feb 26, 2024
@johnnyomair
Copy link
Collaborator

@jamesricky the pipeline fails

@johnnyomair johnnyomair merged commit c962a24 into feature/refactor-admin-component-theming Feb 26, 2024
2 checks passed
@johnnyomair johnnyomair deleted the merge-next-into-feature-refactor-admin-component-theming branch February 26, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.